Hiring guide for Elixir Behaviours Engineers

Elixir Behaviours Developer Hiring Guide

Elixir Behaviours is a software design pattern that was introduced in the Elixir programming language in 2013. It is based on the concept of "composing functions together" and allows developers to create modular and reusable code. Elixir Behaviours have been used in a variety of projects, including the development of the Phoenix framework and the Nerves platform. Sources: * [Elixir Behaviours documentation](https://hexdocs.pm/elixir/Behaviours.html) * [Elixir Behaviours on GitHub](https://github.com/elixir-lang/elixir/tree/master/lib/elixir/behaviours) * [Elixir Behaviours in the Phoenix framework](https://hexdocs.pm/phoenix/Behaviours.html) * [Elixir Behaviours in the Nerves platform](https://hexdocs.pm/nerves/Behaviours.html)

Ask the right questions secure the right Elixir Behaviours talent among an increasingly shrinking pool of talent.

First 20 minutes

General Elixir Behaviours app knowledge and experience

The first 20 minutes of the interview should seek to understand the candidate's general background in Elixir Behaviours application development, including their experience with various programming languages, databases, and their approach to designing scalable and maintainable systems.

How would you define a behaviour in Elixir?
In Elixir, a behaviour can be defined using the defmodule keyword followed by the use of the @callback directive to define the function's signature. For example: defmodule MyBehaviour do @callback my_function(arg1 :: type, arg2 :: type) :: return_type end.
What are the benefits of using behaviours in Elixir?
Behaviours in Elixir provide a way to define a set of functions that have to be implemented by a module. This helps to promote code reuse, readability, and maintainability. It also provides a way to define a contract that the implementing module must adhere to.
How would you implement a behaviour in Elixir?
A behaviour can be implemented in Elixir by defining a module and using the @behaviour attribute followed by the name of the behaviour. Then, all the functions defined in the behaviour must be implemented in the module.
What are the differences between behaviours and protocols in Elixir?
Behaviours are about the interface, while protocols are about the implementation. Behaviours define a set of functions that a module needs to implement, while protocols define a mechanism for dispatching on a type.
How would you handle a situation where a module does not implement all the functions of a behaviour?
If a module does not implement all the functions of a behaviour, Elixir will raise a compilation warning. This is a way for Elixir to enforce that all the functions of a behaviour are implemented.
The hiring guide has been successfully sent to your email address.
Oops! Something went wrong while submitting the form.

What you’re looking for early on

Does the candidate understand the concept of Elixir Behaviours?
Has the candidate demonstrated the ability to implement Elixir Behaviours in a project?
Can the candidate explain the benefits of using Elixir Behaviours?
Does the candidate have experience with other Elixir concepts that are related to Behaviours, like Protocols and Polymorphism?

Next 20 minutes

Specific Elixir Behaviours development questions

The next 20 minutes of the interview should focus on the candidate's expertise with specific backend frameworks, their understanding of RESTful APIs, and their experience in handling data storage and retrieval efficiently.

Describe the difference between behaviours and abstract modules in Elixir.
Abstract modules are a compile-time construct that allows defining functions that must be overridden by the module that uses it. Behaviours, on the other hand, are a way to define a set of functions that a module needs to implement, without providing any default implementation.
How would you use behaviours to implement polymorphism in Elixir?
Polymorphism in Elixir can be achieved by defining a behaviour that specifies a set of functions, and then implementing that behaviour in different modules. Each module can provide a different implementation of the functions, allowing for polymorphic behaviour.
What are the drawbacks of using behaviours in Elixir?
One of the drawbacks of using behaviours in Elixir is that they can lead to tightly coupled code if not used carefully. Also, behaviours do not provide a default implementation of the functions, which means that each implementing module must provide its own implementation.
How would you test a module that implements a behaviour in Elixir?
A module that implements a behaviour can be tested in Elixir using ExUnit, the built-in testing framework in Elixir. You would write tests for each of the functions that the module implements, ensuring that they behave as expected.
Describe the difference between behaviours and macros in Elixir.
Macros in Elixir are a way to define reusable chunks of code, while behaviours are a way to define a set of functions that a module needs to implement. Macros are about code reuse, while behaviours are about defining a contract for modules.
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 Elixir Behaviours engineer at this point.

At this point, a skilled Elixir Behaviours engineer should demonstrate strong problem-solving abilities, proficiency in Elixir Behaviours programming language, and knowledge of software development methodologies. Red flags include lack of hands-on experience, inability to articulate complex concepts, or unfamiliarity with standard coding practices.

Digging deeper

Code questions

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

What does this simple Elixir code do?
IO.puts "Hello, World!"
This code prints the string 'Hello, World!' to the console.
What does this Elixir code do?
defmodule Math do 
 def add(a, b) do 
 a + b 
 end 
 end
This code defines a module named 'Math' and a function named 'add' within the module that takes two arguments and returns their sum.
What will be the output of this Elixir code that manipulates a list?
list = [1, 2, 3, 4, 5] 
 Enum.map(list, fn x -> x * 2 end)
This code doubles each element in the list. The output will be a new list: [2, 4, 6, 8, 10].
What does this Elixir code do related to concurrency?
spawn(fn -> 1 + 2 end)
This code spawns a new process that executes the function, which adds 1 and 2. However, the result of this computation is not returned to the calling process.

Wrap-up questions

Final candidate for Elixir Behaviours Developer role questions

The final few questions should evaluate the candidate's teamwork, communication, and problem-solving skills. Additionally, assess their knowledge of microservices architecture, serverless computing, and how they handle Elixir Behaviours application deployments. Inquire about their experience in handling system failures and their approach to debugging and troubleshooting.

How would you handle errors in a module that implements a behaviour?
Errors in a module that implements a behaviour can be handled in Elixir using the standard error handling mechanisms, such as try/rescue/else/after and with/else. The specific method used would depend on the nature of the error and the requirements of the application.
What are the differences between behaviours and interfaces in other languages like Java or C#?
Behaviours in Elixir are similar to interfaces in languages like Java or C#, in that they define a contract that a module must adhere to. However, unlike interfaces, behaviours do not provide any default implementation of the functions they define.
How would you use behaviours to implement a strategy pattern in Elixir?
A strategy pattern in Elixir can be implemented using behaviours by defining a behaviour that specifies a set of functions, and then creating multiple modules that implement that behaviour. Each module represents a different strategy and provides a different implementation of the functions.

Elixir Behaviours application related

Product Perfect's Elixir Behaviours development capabilities

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