Skip to content

Instantly share code, notes, and snippets.



Last active Nov 19, 2018
What would you like to do?
Interview questions


Tip: even if the answer is listed here, don't ask the question if you don't fully understand the answer.

This isn't 100% a knowledge test. Questions that can't be answered should be followed by a discussion of how the answer could be discovered.

Listen for questions from the candidate

These are examples of questions that good hires would ask:

“What does a typical day look like for this role?” “What are the greatest challenges for your team right now?” “What is the greatest challenge for this particular role?” “How long have you been with the company and what is it like working there?” “What’s the company culture like?” “What can you tell me about the team or group that I would be working with if I get the job?” “I noticed this trend in your current job openings—what does it say about the company’s direction right now?” “Can you tell me about career growth opportunities for this job?” “What would a long-term career look like at this company?” “Are there any special initiatives or side projects the team is working on right now?” “How has the company changed in the past year?” “What is your favorite thing about working for this company? Least favorite thing?” “What are your expectations for this role in the first 90 days?”

General questions

What's your first instinct when starting on building a feature?

Design? Experiment with code? Both? Just a good starter that doesn't feel like a test.

Describe a production performance problem you've run into, and how you debugged and solved it

To see if they've more been focused on churning out features or also maintaining a production stack.

What are your thoughts on Javascript's rise to popularity? ES6? NodeJS?

For assessing language/framework bias.

What's the biggest mistake you've made working on a production backend?

For assessing humility and tendency towards blame.

Ruby language

What's the difference between a lambda, block and a Proc?

Lambda and Proc are instances of the Proc class. Block is not an object.

Any number of Lambdas and Procs may be passed to methods. Blocks are syntax, may only be passed as a method argument. Only one block may be passed.

There are more differences, but any answer is better than none.

What's the 'inject' Enumerable method useful for?

Two common uses:

  • summing numbers
  • building a hash or array from another construct

The goal here is first to know that it exists, and second, to see if one naturally reaches for functional rather than procedural tools to solve a problem. Good for a quick code exercise.

Why would you end method names with a question or exclamation marks? Are they part of Ruby syntax?

Short answer: question marks indicate a boolean return value, and exclamation marks vaguely indicate a destructive or irreversible change. Not part of Ruby syntax - just idioms.

Knowing about and having opinions about community idioms is important in Ruby.

How would you find the parent class of an object's class?

Simply call .superclass on any object.

The goal here is to start a discussion around metaprogramming. Without this very basic knowledge, it's unlikely they'd have more. More advanced questions:

What's method_missing for? Catching calls to undefined methods and acting on them.

What's the difference between a class variable and a class instance variable? Class instance variables are not inherited.

What's the MRI Global Interpreter Lock and why is it important?

A runtime feature of MRI Ruby that forbids parallel thread access to shared memory.

Since this feature influences performance and memory usage, any of the following are good things to hear:

  • It slows down execution due to overhead from context switching
  • It limits the number of requests a single process can handle concurrently
  • It helps avoid having to think about writing thread-safe code
  • It simplifies writing C extensions and garbage collection
  • It limits the concurrency models available to Ruby programs

What is monkeypatching? Why would you resort to using it?

Monkeypatching is a community idiom. It refers to a Ruby feature that allows augmenting or overriding behaviour in previously loaded code.

The goal here is to see they're aware of this idiom, and to hear them discuss both its practical uses and downsides to its abuse.

Example practical use: Rails adding convenience methods to Integer like 2.days.ago

Example misuse: Overriding large chunks of a gem's internals, only to have that break on the next upgrade of the gem and having to rewrite the patch

Rails ecosystem awareness

Test knowledge about specific gems, trends and novel Rails features. The goal is to understand their level of curiosity about Rails and how all parts fit together. Not to tally up how much they know.

What's the difference between the Warden and Devise gems? Why would you choose to use them, or no gem at all, for authentication?

If they have worked with these, they might know that:

  • Warden is a simple Rack extension for authenticating users via different schemes, setting up sessions, and handling failures
  • Devise is built on top of warden, providing an entire suite of tools for authentication

Discuss why you might opt for building your own authentication tooling. Good answers might be:

  • Deeper understanding of authentication flow
  • Flexibility when having to deal with many types of clients or APIs (mobile, graphql, etc)

How do Rails 5.2 encrypted credentials work, and why would you use them?

Credentials are stored in an encrypted file stored in source control. The decryption key, a master.key file, should be distributed amongst developers. This is an alternative to using environment variables or .env files which could reveal plaintext credentials.

What does the capybara gem provide?

Full stack testing of frontend and backend behaviour using one of many browser drivers.

What would be the advantage of switching from Paperclip to ActiveStorage?

Arguably it would reduce friction should one later decide to change file processors. Use as a starting point for discussing file processing in general.

Rails techniques

What's special about Rails API mode?

What is a has_many :through relation and why would you use it?

What are service objects, and why would you use them in place of ActiveRecord callbacks?

A popular command pattern approach using plain ruby objects to encapsulate logic. Sometimes useful as a replacement for a string of callbacks that interfere with testing, or whose dependence on internal object state is hard to understand.

What's the difference between fixtures and factories? What are pros/cons of each?

Fixtures are brittle and hard to debug, but reduce clutter. Factories are explicit but encourage tying tests to implementation details.

How would you solve the problem of slow requests caused by slow connections to an external email provider?

Background jobs...

How does Rails CSRF protection work? How would you use it in a Single Page JS app?

A secure token is passed along with incoming POST requests and compared to the same token stored in the encrypted session.

The token added by default to meta tags, but it can also be requested per-form. Fetching the tag either way would work for SPAs.

What's the N+1 problem? What are some ways of solving it in Rails?

Code tests

To be submitted and discussed afterwards.

Invite system

Given an existing app with users and companies, design a simple user invitation system for inviting users to a specific company.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.