Watch a 30-minute Preview
Welcome To Red:4
In this chapter we’ll install Elixir, setup our environment, and take a look at various editors. A good editor is very important – and it turns out there are many for Elixir.
Letting Elixir Soak In
Learning a new programming language takes time, and we don’t have it. In this chapter you’ll get the firehose and hopefully understand why so many developers are falling in love with Elixir.
Functional Programming Primer
Many developers are new to functional programming – if this is you, we’ll take a few minutes to explain some of the core concepts and boring jargon that go into this different way of creating applications.
Setting Up a Project
We get off the ground in this chapter using Mix, creating our new project and having a look around. Each directory has a significance, and we’ll also run our tests for the very first time.
Calculate Escape Velocity
We pick up the pace a bit, as the Science Team really needs our help! In this chapter we calculate escape velocity so our orbiter can reach (and stay in) orbit. We’ll write our first tests to make sure things work as they should… which they might not…
Pattern Matching Basics
You’ve been using pattern matching pretty well so far, but the details are probably lacking. In this chapter we take a look at this fascinating aspect of Elixir.
Calculate Orbital Distance and Term
The next part of our Physics library – we need to expand what we’re doing and correct some silly errors that Rob introduced to the code. We’ll refactor what we did before, having learned some interesting idioms in the previous chapter. You’ll fix his silly tests and, hopefully, add a few more to make sure things work.
Fixing borked code is no fun (especially when it’s Rob’s) – in this chapter we’ll take a look at various strategies for debugging common errors (both compiler and runtime). You’ll be asked to fix some more broken tests as well as to pretty up some messy code.
Solar Flare Project Setup
The Physics library is looking great! Now it’s time to turn our attention to solar flares. We need a tracking system so our astronauts in orbit don’t get fried during EVA. We have real solar flare data from tracking stations around the world, now we just need to be sure our calculations are correct.
List and Enumeration Basics
We’ve setup some test solar flare data and have to decide what the best way is to structure and work with it. You’ve worked with lists a bit, now let’s get into the details.
Recursion and Refactoring Our Solar Flares
The Science Team really likes what we’ve been doing, but would like to see some alternatives to our approach for finding the deadliest solar flares as well as different ways we can track the no EVA triggers. We’ll see 3 different ways to work with our flare list: recursion, the Enum library, and comprehensions.
Using if, unless, and cond
Learning syntax is a great first step – but how do developers who use Elixir every day actually structure their code? In this chapter we’ll take a breather and examine various idioms and code smells – all centering around conditional statements. You’ll write some tests and decide for yourself which syntactic structure you prefer.
Persisting Data With Elixir
It’s time to store our solar flare and planetary data – but where… and how? In this chapter we’ll setup Mnesia – the built-in NoSQL store that is part of OTP, the core library you use in both Elixir and Erlang. It’s ACID-compliant, fast, and simple to use. You’ll set up some tests to see if it will work for us.
A Quick Look at OTP
In the last chapter you setup Mnesia, part of the vast, wonderful OTP (Open Telecomm Platform) framework. When you write applications with Elixir, you use OTP. This is where the true fun starts!
Working With Ecto and PostgreSQL
Troubleshooting OTP Errors
What You Will Build
Our science team needs an astrophyics library, and you’re going to build it. We need to:
- Calculate equations for our prototype orbiter, including Escape Velocity for the Earth, Moon and Mars, Orbital Term, and Orbital Acceleration.
- Track Solar Flare Activity using Ecto and PostgreSQL
- Store Planet information with Mnesia
- Use OTP to DDoS our PostgreSQL database so we can oust our new CTO
This is not a tutorial where you get to sit back and watch us code – you’re on the hot seat!
What You Will Get
18 Chapters. Beautiful, concise, entertaining material designed to keep you engaged and writing elegant Elixir. You’ll get epub, mobi, and an HTML site. The book and video contain the same material.
3 Hours. Top-quality, focused, high-production value video tutorials from the creator of Tekpub. Tightly edited with great sound quality – this isn’t just a voice in front of a set of boring slides.
18 Commits. All of the code in both the book and the video is available in our company Github repo. Step through the commits, or download entire chapters – it’s up to you.
Answers. Have a question? Need some help? You can visit our Github Repo and ask questions, make suggestions or offer corrections.
8 Debug/Refactors. You don’t learn unless you do, and Rob writes some pretty bad code that you get to fix for us. You will also learn skills to troubleshoot Elixir and OTP.
Mischief. Now let it work. Mischief, thou art afoot. Take thou what course thou wilt… We think Rob might be up to no good – plotting to take our database offline. You wouldn’t help him with that… would you?
What Others Say
— Aniruddha Sen (@AniruddhaSen235) November 13, 2016
— Jeremiah Redekop (@Jredekop) February 2, 2016
— Josh Charles (@charlesj) February 1, 2016
Just finished _Take off with Elixir_ by @robconery. Best language-intro book I've read in a long time. Fun read + interesting demo project.
— Adrian Dunston (@bitcapulet) July 21, 2016
— Ilkka Laukkanen (@ilkkalaukkanen) February 1, 2016
— Richard de Zwart (@mountain1965) January 20, 2016