OTP Course




What's in this preview?

We want you to get the feel for typical Groxio content and the reasons we provide each type of content. Each Groxio module comes in four scheduled releases consisting of the central PDF, videos, and resource links. Later releases have projects as well. You can see part of the first release here.

Did you try turning it off and on again?



Buy Course Today!



Preview PDF!

Version: July 1, 2020


Just $70.00, A La Carte
(other options available)




Programmer Passport OTP






Why a book?

The scientific teaching method we follow is the Dreyfus learning model. Books provide the metaphors experts need to build context, step-by-step instructions for beginners, and the exercises that intermediates need to learn.

Itinerary


1. OTP Basics

2. OTP Communictation

3. OTP Lifecycle

4. OTP Dynamic Supervisors

Why an itinerary?

The itinerary is a virtual guide. This optional list describes the highlights of each release to maximize your learning time.

Description

OTP is the heart and soul of Elixir’s concurrency and reliability. It is based on 30 years of experience with the Erlang framework that provided the core reliability and availability of Erickson phone switches for many years. OTP gets its reliability by separating the concerns of reusable project lifecycle from project custom code.


Elixir developers use OTP by creating a generic service layer and then augmenting that template with their own custom code. Instead of starting their own application directly, they use a supervisor, a process server of sorts that knows how to stop, start, and detect failure in processes.

This slight separation may seem like a small thing, but it is the basis of extraordinary availability metrics for the Erlang language. You can leverage OTP to build your own services into your own Elixir applications, whether you’re using Phoenix, Nerves, or some other kind of service.


History

In 1988, Joe Armstrong, Robert Virding, and Michael Williams were working on making software more reliable at Ericsson. They built a library called the Open Telecom Protocol. That acronym was an exercise in marketing, but the acronym was eventually dropped.


The project was opensourced as part of the Erlang project, and the popularity of the programming framework began to pick up. In 2012, Elixir was created, expanding OTP’s footprint. Scala’s Akka framework extends OTP to the Java virtual machine.


Videos

Public & Private




Why videos?

Groxio language modules have two kinds of videos. Our overview videos set the history and context of a language, or wrap up the work we've done, and are free to support language ecosystems. Our coding instruction videos, mostly starting with the second release, are paid content, and each one offers a live coding project.

Every learning level benefits from pair programming. Our videos are professional, but do not scrub away every tiny mistake. That way, you can see how experienced programmers deal with errors and changes in code organization.

Video

12: Layers: Do Fun Things with Big Loud Worker-bees

Throughout this grox.io OTP series, we've built up services with single-purpose functions and modules. In this video, we'll refactor one of our programs to use the system of layers built in the book Designing Elixir Systems with OTP, written by James E Gray II and Bruce Tate.
Subscriber content

Video

11: OTP Dynamic Supervisors in Elixir: In your own time

Starting GenServers and Supervisors with your dependencies at application start time is useful, but it's not the whole story. You also need to be able to start services that you may not know about at compile time. The dynamic supervisor is the tool for the job, and we'll show you how to register and start a dynamic service with an API.
Subscriber content

Video

10: OTP Registries: By any other name...

Building the infrastructure to start, stop, and restart a service is only part of the problem. You also need to be able to register a service and find it once you have done so. We'll discover the services OTP provides to solve thiis problem.
Subscriber content

Video

9: Phoenix Dashboard

In this session, we talk about OTP supervisors by building in an intentional error and then watching what happens in the Phoenix LiveView dashboard. LiveView can help us track resources like atoms, memory, and time.
Subscriber content

Video

8: State Machines

In OTP state machines are representations of mathematical constructs. They are ideal for implementing processes that move from state to state. Examples are light switches, web requests, and document routing. In this video we'll build a document routing example using a finite state machine.
Subscriber content

Video

7: Big Brother, The OTP Supervisor

Big Brother is always watching and OTP supervisors are too. By monitoring our processes with supervisors that know how to manage lifecycles, Elixir can take action when another process crashes or must be shut down. In this video, we'll explore ways to set policy for shut down, start up and restart.
Subscriber content

Video

6. Backpressure

When you build GenServers, should you use calls or casts? The answer might surprise you. In this video, we talk about backpressure, and how preferring calls to casts will improve reliability by shortening your message queues.
Subscriber content

Video

5. Response Tuples

When you're writing typical OTP applications, the typical responses you use are `:reply` and `:noreply`. Did you know there are other response tuples, and that you can add timeouts or other options as an additional option in a response tuple? Learn to find which responses are allowed, and how to use them.
Subscriber content

Video

4. Tasks and Agents

Dave Thomas made an interesting contribution to Elixir's OTP ecosystem. He suggested lightweight GenServers for processing state called agents, and functions called tasks. In this session, we use tasks and agents in the context of OTP.
Subscriber content

Video

3. When Not to OTP

Sometimes, OTP looks too much like a golden hammer. When you have a golden hammer, everything looks like a nail. In this video, you'll learn why some applications are *not* nails. This video will walk you through an example that intentionally builds in a race condition.
Subscriber content

2. mix new --sup

When the mix tool was created, projects always had a supervisor. Shortly after, supervisors were removed in favor of the --sup flag. This video will show you precisely what happens when you create a project with --sup. You will find out how Elixir builds OTP applications, and what you need to do to integrate them.

1. OTP. Did you try turning it off and on again?

OTP is the reason Erlang developers say to "Just let it crash." In this video, you'll learn why. Rather than building an application in a process and starting it direcly, OTP has a *process server* called a supervisor that's responsible for the whole application lifecycle. In short, the supervisor knows how to "turn it off and on again!"

0. Bring On the Workerbees

If you like what you find here and want to design software concepts that use these systems, you can use this book that teaches you how to build software using the layered approach talked about in these videos and the book. This video talks about the layers you'll find in there.

Community Resources

Cool quick trips for OTP




Why resource links?

Each new chapter has a set of links, separated into three categories. The categories reflect different competency levels and resources that match that stage of learning, for each Groxio release.

Learn It

These resources will get you on the path to learning with background information, tooling and exercises.

Do It

You decide how deep to go. These resources are exercises and projects to cement your learning.

Grok It

These resources will help you put your new knowledge into context so you'll be better at your everyday job.

Projects

Longer Excursions (chapters 3 and 4)






Why projects?

The Dreyfus model is originally instruction for pilots. A typical pilot course is based on reading material to understand context, and then flying a plane. Our videos and PDFs are important, but in the end, programmers need to program in order to learn. Our projects offer different levels of assistance, from "give me the answer" to "make this test pass".