Crystal Developer Hiring Guide

Hiring Guide for Crystal Engineers

Ask the right questions to secure the right Crystal talent among an increasingly shrinking pool of talent.

The Crystal programming language, first introduced in 2014 by Ary Borenszweig, Juan Wajnerman and a team of contributors, is a statically-typed, compiled language with syntax similar to Ruby. It is designed to provide the expressiveness of scripting languages with the efficiency and performance of compiled languages. Crystal's unique feature is its powerful type inference which allows developers to write code without specifying types explicitly. The language supports concurrent and parallel execution using fibers for lightweight concurrency while maintaining simplicity in syntax. As an open-source project, it has been developed collaboratively on GitHub by numerous contributors worldwide.

First 20 minutes

General Crystal knowledge and experience

The next 20 minutes of the interview should attempt to focus more specifically on the development questions used, and the level of depth and skill the engineer possesses.

What is the concurrency model in Crystal?

Crystal uses a concurrency model called CSP (Communicating Sequential Processes). It uses 'fibers' which are lightweight threads, to achieve concurrency.

How would you handle nil values in Crystal?

In Crystal, nil values are handled using the '?' operator. This operator allows a variable to be of a certain type or nil.

Describe the difference between Crystal and Ruby.

While Crystal and Ruby have similar syntax, Crystal is statically typed and compiled, which makes it faster. Ruby, on the other hand, is dynamically typed and interpreted.

What are the key features of Crystal language?

Crystal language has several key features including static type checking, C bindings, concurrency model, powerful macro system, and it's compiled.

How would you define Crystal language?

Crystal is a statically typed, compiled, general-purpose programming language that has syntax similar to Ruby. It's designed to be easy to read and fast to execute.

The hiring guide has been successfully sent to your email address.
Oops! Something went wrong while submitting the form.

What youre looking for early-on

Is the candidate able to work well in a team?

Software development often involves teamwork. A candidate who can work well in a team will likely be more productive and contribute more to the project.

Does the candidate show good problem-solving skills?

Good problem-solving skills are vital for any developer. It shows that they can think logically and come up with efficient solutions to coding problems.

Does the candidate understand the differences between Crystal and other similar languages?

This is important because it shows that the candidate has a broad understanding of programming languages and can leverage the strengths of Crystal while avoiding its limitations.

Can the candidate debug and optimize Crystal code?

Being able to debug and optimize code is a critical skill for any developer. It shows that they understand the language in depth and can ensure that the code runs smoothly.

Has the candidate worked on any significant projects using Crystal?

Experience with using Crystal in real-world applications or projects is a strong indicator of the candidate's ability to apply their skills in a practical context.

How comfortable is the candidate with Crystal's syntax and its unique features?

The candidate should be able to demonstrate a deep understanding of Crystal's syntax and its unique features. This is essential for writing efficient and effective code.

Next 20 minutes

Specific Crystal development questions

The next 20 minutes of the interview should attempt to focus more specifically on the development questions used, and the level of depth and skill the engineer possesses.

How would you implement inheritance in Crystal?

Inheritance in Crystal is implemented using the '<' operator. The child class inherits all the methods and properties of the parent class, and can also override them.

What is the difference between '==' and '===' in Crystal?

'==' is used for equality comparison while '===' is used for case equality, or to check if an object belongs to a certain type or range.

How would you handle exceptions in Crystal?

In Crystal, exceptions are handled using the 'begin', 'rescue', 'ensure', and 'end' keywords. You can define custom exceptions by creating a class that inherits from the 'Exception' class.

What are macros in Crystal and how would you use them?

Macros in Crystal are powerful tools that allow you to avoid boilerplate code. They are executed at compile time and can generate methods, types, and perform other transformations on the code.

How would you define a class in Crystal?

In Crystal, a class is defined using the 'class' keyword followed by the class name. The properties and methods are then defined within the class.

The hiring guide has been successfully sent to your email address.
Oops! Something went wrong while submitting the form.

The ideal back-end app developer

What you’re looking to see on the Crystal engineer at this point.

At this stage, a skilled Crystal engineer should demonstrate proficiency in the Crystal language, excellent problem-solving abilities, and deep understanding of web development principles. Red flags could include lack of knowledge in Ruby (since Crystal is heavily influenced by it) or inability to explain complex concepts clearly.

Digging deeper

Code questions

These will help you see the candidate's real-world development capabilities with Crystal.

What does the following Crystal code do?

puts "Hello, World!"

The code prints the string 'Hello, World!' to the console.

What will be the output of the following Crystal code?

x = 10
y = 20
z = (x == y) ? "Equal" : "Not Equal"
puts z

The code checks if x is equal to y. If true, it assigns 'Equal' to z, otherwise 'Not Equal'. The output will be 'Not Equal' because x is not equal to y.

What does the following Crystal code do?

numbers = [1, 2, 3, 4, 5]
numbers.map! { |num| num * 2 }
puts numbers

The code multiplies every number in the 'numbers' array by 2. The 'map!' method modifies the original array. The output will be '[2, 4, 6, 8, 10]'.

What will be the output of the following Crystal code?

spawn do
  puts "Hello from a thread"
end
puts "Hello from the main thread"

The 'spawn' keyword starts a new concurrent thread. The output will be 'Hello from the main thread' followed by 'Hello from a thread'. However, the exact order of outputs might vary due to concurrency.

What does the following Crystal code do?

class Person
  def initialize(@name : String)
  end
  def greet
    puts "Hello, #{@name}"
  end
end
john = Person.new("John")
john.greet

The code defines a 'Person' class with a constructor and a 'greet' method. A new 'Person' object is created with the name 'John' and its 'greet' method is called, which prints 'Hello, John'.

What will be the output of the following Crystal code?

def fibonacci(n : Int32)
  return n if n <= 1
  fibonacci(n - 1) + fibonacci(n - 2)
end
puts fibonacci(6)

The code defines a recursive method to calculate the Fibonacci sequence. The output will be the 6th Fibonacci number, which is 8.

Wrap-up questions

Final candidate for Crystal role questions

The final few interview questions for a Crystal candidate should typically focus on a combination of technical skills, personal goals, growth potential, team dynamics, and company culture.

What are the performance considerations when working with Crystal?

Crystal is a compiled language, so it's generally faster than interpreted languages. However, performance can be affected by factors such as algorithmic complexity, memory usage, and I/O operations.

How would you manage dependencies in a Crystal project?

Dependencies in a Crystal project are managed using a 'shard.yml' file. This file lists the project dependencies and their versions. The 'shards' command is then used to install the dependencies.

What is the difference between 'include' and 'extend' in Crystal?

'include' is used to add instance methods to a class, while 'extend' is used to add class methods.

How would you create a multidimensional array in Crystal?

In Crystal, a multidimensional array can be created by nesting arrays within an array. Each nested array can be of any length, allowing for non-rectangular arrays.

What are the data types available in Crystal?

Crystal supports several data types including Integers, Floats, Booleans, Strings, Arrays, Hashes, Tuples, Ranges, and more.

The hiring guide has been successfully sent to your email address.
Oops! Something went wrong while submitting the form.

Crystal application related

Product Perfect's Crystal development capabilities

Beyond hiring for your Crystal engineering team, you may be in the market for additional help. Product Perfect provides seasoned expertise in Crystal projects, and can engage in multiple capacities.