To evaluate your skill level and experience in Ruby, there are some questions that are frequently asked. It’s important that you understand the fundamental concepts behind them.
Whether you want to prepare for an interview or looking to improve your knowledge on the language, knowing the answer to the below questions will put you on the right track.
Ruby
What are some differences between ruby and other programming languages?
What does private do in Ruby?
There are many ways to invoke a method in ruby. Can you give me at least two?
Explain this ruby idiom: a ||= b
What does self mean?
What is a Proc?
What is the difference between classes and modules?
How are include, extend and prepend different?
What is a metaclass? What is it for?
What is a gem?
Object Oriented Design
What is a class? What is an object?
What is a module?
Can you describe the OO paradigm?
How is OO different from other paradigms (structured/functional)?
Define the following OO principles (encapsulation, abstraction, inheritance, polymorphism)
What is cohesion and coupling?
What is duck typing?
Can you give an example of a design pattern in action?
How do you define composition or inheritance? Give examples what cases do they work best for.
How do you organize multiple objects that you want to adhere to a particular behavior in ruby?
I can think of eval("obj.some_method") and obj.method(:some_method).call (or the equivalent obj.method(:some_method)[]) but not sure if they qualify as “different” ways though
These are all reasonable. Also private as a concept in Ruby; this language is so very open and meta, you can always get inside, nice for conceptual organization though.
If anyone tries to grill you on the flipflop operator in an interview, consider if that is really a place you want to work. The most esoteric things are gotcha questions rather than useful measures of language knowledge.
@pcl I found this article with 12 ways to call a method in Ruby, I didn’t knew there were that many!
@andynu You’re right about the private concept/question, but I do think it’s a good way to talk. about tradeoffs and design decisions. I also agree that questions can also help the interviewee to get more information about what is valuable for the company. When I do an interview I like to use questions as a way to guide the conversation more than looking for right/wrong answers, but I also there are others who do more confrontational interviews.
Just so @javier.cervantes ; And perhaps I’m a sensitive soul, but I want to work in collaborative and kind environments. I don’t personally align with confrontational interviews regardless of which side of the interview I’m on.
I don’t mind private being a hint more than a rule. And the only thing I miss from java is a slightly stricter concept of interfaces. So I offer a related interview question: How do you organize multiple objects that you want to adhere to a particular behavior in ruby? (Areas to consider: mixins, abstract classes, duck typing, warnings/exceptions, contracts)
At least I interpreted “There are many ways to invoke a method in ruby. Can you give me at least two?” referring to what’s cooked into the language explicitly to that end, not how many clever ways you can indirectly call a method. ( IMO, looking at point 10 in the article, defining method_missing to invoke another method it’s just indirection… under that light, calling an endpoint in a server that returns the name of the method, parsing the response and invoking that method would count too; ok, that was exaggerated )
That’s a great idea! But my suggestion would be to open a new topic in the Help category so we can keep the discussion independent (and allow for more people to participate too).
When you create the topic, you can add a link to this topic and I believe it show here as “related” automatically.