Subscribe now

Elixir Weekly Drip #1 and Exercise: String Upcaser "Microservice" [02.13.2017]

This week we dove into Elixir from the beginning, learning about syntax, tooling, and processes. Each week we will provide a self-directed exercise and provide a solution in the following episode. For our first exercise, we'll build a process that accepts string messages and responds with the same string, upcased. First, though, let's look at some links that are relevant if you're new to Elixir. Later linkdumps will include new content from the community, but in the early days I'll be focusing on more beginner content.

José Valim - How I Start (Elixir)

A nice introduction to Elixir covering Agents, Structs, and distribution.

José Valim (Elixir's creator) wrote a post for How I Start covering everything from the basics through to sending messages between distributed nodes. It's a great survey of the language from the man best suited to write it :)


Elixir School

Lessons about the Elixir programming language, inspired by Twitter’s Scala School.

Elixir School is a great resource for learning Elixir, from the basics to more advanced topics. It's open source and it's been translated to a lot of languages, which is nice.

[ h/t @doomspork ]


Elixir Fountain

Bringing you the News & Interviews from around the Elixir Community.

Johnny Winn's been running Elixir Fountain for quite a while. It's a podcast with a mix of news and interviews from the community, and it's a great way to get your regular fix of Elixir goodness.

[ h/t @elixirfountain ]


Elixir's Getting Started Guide

The official guide for getting started with Elixir

Going through the official guide goes a long way for learning the basics of the language.


Elixir docs

The official Elixir documentation.

The official Elixir documentation is a great read late at night with a pot or two of coffee if you want to deep dive into everything the standard library has to offer :)


hex.pm

The package manager for the Erlang ecosystem.

Hex is the repository that holds all of the packages that you might want to use in your applications. Looking through recently used and most frequently used packages is always a fun way to spend some time.

[ h/t @emjii ]

Exercise

For this week's exercise, we're going to build a small microservice that can be sent strings and will reply with those strings, upcased.

  • Create a new process in the same way that we did in the PingPong episode.
  • Send the process messages like {"some string", self}
  • The process should pattern match out the string and the process id from the 2-tuple in the message.
  • It should then call String.upcase on the provided string, responding with {:ok, "SOME STRING"}
  • Write a function that will send the message to the process and then immediately wait to receive the response back.

This is a very contrived example - doing this in a process provides no benefit whatsoever over just calling the function directly. However, it provides a nice and simple opportunity to apply what you've learned this week.

See you soon!