Hiring guide for Elixir Plug Engineers

Elixir Plug Developer Hiring Guide

Elixir Plug is a specification for composable modules in web applications built using the Elixir programming language. Introduced in 2011, Elixir is a dynamic, functional language designed for building scalable and maintainable applications. The Plug library, part of the Elixir ecosystem, provides tools to build web application infrastructures, handling connection adapters for different web servers. It was inspired by the Rack library in Ruby and Connect in Node.js. This information is sourced from Elixir's official website and documentation.

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

First 20 minutes

General Elixir Plug app knowledge and experience

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

What are the main components of Elixir Plug?
The main components of Elixir Plug are Plug.Router and Plug.Builder. Plug.Router is used to define a simple router that dispatches to different plugs based on the URL, while Plug.Builder is used to define a pipeline of plugs.
How would you create a new Plug in Elixir?
To create a new Plug in Elixir, you need to define a module that implements two functions: init/1 and call/2. The init function is used to initialize the plug's options, while the call function is used to process the request.
Describe the difference between Plug.Router and Plug.Builder.
Plug.Router is used to define a simple router that dispatches to different plugs based on the URL. On the other hand, Plug.Builder is used to define a pipeline of plugs, where each plug transforms the connection or side-effects.
What are the two main types of plugs in Elixir?
The two main types of plugs in Elixir are function plugs and module plugs. Function plugs are simple functions that take a connection and options and return a connection, while module plugs are modules that implement the Plug behaviour.
How would you use Plug.Builder to compose multiple plugs?
You can use Plug.Builder to compose multiple plugs by using the plug keyword inside a module that uses Plug.Builder. Each plug will be invoked in the order they are defined.
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 have a solid understanding of Elixir and Plug?
Has the candidate demonstrated the ability to write clean, efficient code?
Can the candidate solve complex problems using Elixir and Plug?
Does the candidate have experience with testing in Elixir?

Next 20 minutes

Specific Elixir Plug 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.

What is the purpose of the init/1 function in a Plug module?
The init/1 function in a Plug module is used to initialize the plug's options. It is called when the server starts, and its return value is passed as the second argument to the call/2 function.
How would you handle errors in a Plug pipeline?
You can handle errors in a Plug pipeline by using a plug that catches errors and transforms them into appropriate HTTP responses. This can be done by using the Plug.ErrorHandler plug.
What is the purpose of the call/2 function in a Plug module?
The call/2 function in a Plug module is used to process the request. It takes a connection and options as arguments, and returns a connection.
How would you parse query parameters in Elixir Plug?
You can parse query parameters in Elixir Plug by using the Plug.Parsers plug with the :urlencoded parser. This will parse the query parameters and store them in the conn.params map.
What are the responsibilities of a Plug.Conn struct?
A Plug.Conn struct represents a connection. It holds information about the request, such as the request method, headers, and body, and also about the response, such as the status code, headers, and body.
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 Plug engineer at this point.

At this point, a skilled Elixir Plug engineer should demonstrate strong problem-solving abilities, proficiency in Elixir Plug 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 Plug.

What does this simple Elixir Plug code do?
defmodule MyPlug do
  import Plug.Conn

  def init(options), do: options

  def call(conn, _opts) do
    conn
    |> put_resp_content_type("text/plain")
    |> send_resp(200, "Hello world")
  end
end
This is a basic Elixir Plug module. It responds to any incoming request with a 'Hello world' plain text message and a 200 OK status.
What will be the output of this Elixir code?
IO.inspect(Enum.map([1, 2, 3, 4], fn x -> x * 2 end))
This code will output '[2, 4, 6, 8]'. It uses the 'Enum.map' function to iterate over the list and multiply each element by 2.
What does this Elixir code do?
Enum.reduce([1, 2, 3, 4], 0, fn x, acc -> x + acc end)
This code sums up all the numbers in the list. It uses the 'Enum.reduce' function to iterate over the list and add each element to an accumulator, which is initially set to 0.
What does this Elixir code do?
Task.async(fn -> 1 + 2 end) |> Task.await()
This code executes the anonymous function 'fn -> 1 + 2 end' asynchronously using 'Task.async' and then waits for the result using 'Task.await'. The function simply adds 1 and 2, so the code will return 3.

Wrap-up questions

Final candidate for Elixir Plug 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 Plug application deployments. Inquire about their experience in handling system failures and their approach to debugging and troubleshooting.

How would you send a response with a custom status code in Elixir Plug?
You can send a response with a custom status code in Elixir Plug by using the send_resp function with the status code and body as arguments.
Describe the difference between a connection and a plug in Elixir.
A connection in Elixir represents the state of a web request or response, while a plug is a component that operates on a connection. A plug takes a connection and returns a new connection.
How would you implement authentication in Elixir Plug?
You can implement authentication in Elixir Plug by creating a plug that checks for the presence of an authentication token in the request headers or parameters. If the token is valid, the plug allows the request to proceed, otherwise it sends a response with an error status code.

Elixir Plug application related

Product Perfect's Elixir Plug development capabilities

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