This article will come in handy when you need to test a Ruby on Rails programmer, but you’re not sure what questions to ask your Rails buddy. You can consider this article as a Ruby on Rails programmer interview guide.
We are not going to include all the questions you might want to ask as this would require more than one article. For example, we decided to omit questions about coding idioms and tricky expressions in Ruby. We also don’t want to give away all the questions we might ask during a developer interview. We don’t want the developer to just search the web for answers, as our main goal is to make sure we test the developer’s understanding of the language and structure. We just want to see how a Ruby software developer puts their domain knowledge to the test.
Now let’s outline the structure of the Ruby on Rails interview. The article will be divided into several parts, as we usually test individual areas of knowledge. Here is the structure we usually use:
- Ruby questions;
- Questions about Ruby on Rails;
- Pair programming problem;
Ask Ruby Questions to Test a Web Developer
Why are we asking Ruby-related questions to Ruby on Rails developers? Since the Rails framework is written in Ruby. This means that when we write Ruby on Rails code, we are using Ruby. The main problem we have with Ruby on Rails programmers is actually that they don’t fully understand the basics – the programming language itself. We want to hire forward-thinking programmers who will produce high-quality code, and as such, we want to evaluate their Ruby expertise.
Ruby questions for a Ruby on Rails developer
Our Ruby interview questions usually deal with the object-oriented programming paradigm and object-oriented design patterns. Class hierarchy, encapsulation, inheritance, and polymorphism are key concepts that every Ruby on Rails web developer should know well.
If you have no idea about the principles of object-oriented design, read this detailed article. We have included helpful examples.
If the programmer correctly answers a list of questions like the ones below, then we’re moving forward. For a Ruby programmer, quality preparation for an interview is important. Therefore, if they cannot satisfactorily answer the following questions, then the interview is already over.
- What is a class?
- What is the difference between class and module?
- What is an object?
- How would you declare and use a constructor in Ruby?
- How would you create getters and setters in Ruby?
- Describe the difference between class and instance variables?
- What are the three levels of method access control for classes and what do they mean?
- Explain how (almost) everything in Ruby is an object.
- Explain what singleton methods are. What is a native class in Ruby?
- Describe the search path for a Ruby method.
- Describe the available Ruby callbacks. How to use them in practice?
- What is the difference between proc and lambda?
Second Series of Ruby Questions: Business Applications
Knowing the basics is not enough to work at RubyGarage or any other serious web development company. A programmer should also be able to explain how to write code for business applications. Because Rack is a very popular interface for developing applications in Ruby, we ask specific questions about Rack. Here are four possible questions and concerns:
- What is a rack?
- Explain the Rack application interface.
- Write a simple Rack application.
- How does Rack middleware work?
Third series of questions about Ruby: Ruby Gems
Ruby is a very popular programming language and it has a huge community of developers who create many useful libraries. In this part of the Ruby on Rails interview, we want to know how a Ruby web developer perceives the basic structure of a gem library. A programmer will use several gems when building applications at work, so it’s important for us to see if a developer can read and understand code written by other programmers. The interviewee must also describe RubyGems, a dedicated system for creating, implementing, and sharing.
- What is Ruby Gems? How it works?
- How can you create your own Ruby gem?
- Could you give me some examples of your favorite gems besides Ruby on Rails?
Ruby on Rails interview questions
It’s time to dive into the world of the Rails framework. A skilled developer should be familiar with the model-view-controller approach to building applications. The series of Ruby on Rails interview questions for experienced programmers is divided into three groups. First, we ask a few general questions related to the Rails framework. Secondly, we want to know what the developer knows about routing, controllers and views – the main parts of any business application.
And finally, questions related to ActiveRecord allow us to check how the programmer understands the model part of the application. To work effectively, the developer should write as little configuration code as possible when creating ActiveRecord models. We also ask about the conventions used to implement such logic.
Ruby on Rails interview questions:
- What is ActiveJob? When should we use it?
- What is Asset Pipeline?
- Explain the difference between Page, Action, Fragment, Low-Level and SQL caching types.
- What is the Rails engine?
- Routing, Controllers, and Views
- Give an example of routing and a RESTful controller.
- Describe CRUD verbs and actions.
- How to test routes?
- How to use filters in controllers?
- What are strong parameters?
- What do we need to test in controllers?
- How to use content_for and yield ?
- How to use nested layouts?
- Explain the Active Record pattern.
- What is Object-Relational Mapping?
- Describe the Active Record conventions.
- Explain the migration mechanism.
- Describe the types of associations in Active Record.
- What are regions? How to use it?
- Explain the difference between optimistic and pessimistic locking.
Ruby on Rails Questions: Security
A good application must be secure. In addition to possible attacks, the developer also needs to know everything about the existing protection methods. The developer knows when to use these methods and what protections are appropriate for what situations. As you will see in the suggested list of questions, we may be interested not only in Ruby on Rails security, but also in general web security concepts such as using HTTPS instead of HTTP.
- Explain what a session mechanism is. How it works?
- Describe cross-site request forgery, cross-site scripting, session hijacking, and session fixation attacks.
- What is the difference between SQL injection and CSS injection?
- How should secure data, such as a password, be stored?
- Why do we need to use HTTPS instead of HTTP?