citizen428.blog()

Try to learn something about everything

Review: Programming Elixir

Disclaimer: The good folks at The Pragmatic Bookshelf were nice enough to provide me with a free copy of this book, but this has no influence on the contents of the review.

My first contact with Dave Thomas was the famous “Pickaxe book” for Ruby. It wasn’t my first contact with the language, but it certainly helped in deepening my understanding of it. It’s a great book, and I went back numerous times to re-read certain chapters. I already had a crush on Ruby, but “the Pickaxe” helped turning that into a solid and lasting love affair.

Fast-forward some years. While I still love Ruby and work with it professionally, I have to admit to having a new language crush: Elixir. I’ve been interested in Erlang for several years, read some books, dabbled a bit, but never really got into the language. Elixir however got me hooked almost from the get-go. I find it’s a simple, elegant language, that’s easy to pick up, but has quite some depth.

The book

Let’s start off by clearly stating what this book is not: a reference. It weighs in at around 340 pages and does not try to cover every aspect of Elixir/Erlang. It still is one of my all-time favorite programming books though. Why? Because I believe it does an amazing job in conveying the “essence” of Elixir. There’s no point in documenting APIs, the language has great documentation online. Instead Dave tries to teach the reader how to think in Elixir.

“Programming Elixir” has three main parts. The first called “Conventional Programming” introduces some core concepts like pattern matching and immutability, before covering Elixir types, functions, modules, language constructs, and project organization. It’s easy to read, but not too boring for seasoned developers. However, if you have some previous experience with Elixir, Erlang, or even some other functional programming language you may end up skimming this section a bit, at least I did.

Where it starts to get really interesting is the next part called “Concurrent Programming”, which covers processes, nodes and the basics of OTP. This latter part can easily fill books of its own, so the author only manages to cover some behaviours, like servers (gen_server to be specific), supervisors and applications. It’s some excellent material however, so unless you’re a seasoned Erlang developer this part alone could be reason enough to read this book. Sure, it would have been great to go into some more detail or cover more of OTP, but I think it’s more than enough to make people understand the core principles of the framework so they are able to continue their studies with a solid foundation. I’ve seen many people struggle with the concept of processes and message passing concurrency, despite the relative simplicity of the Actor model. But when Dave suggests thinking of processes somewhat like objects in the sense that they encapsulate state, sending messages suddenly will feel very familiar to OO programmers who find it hard to structure their code around Elixir/Erlang semantics.

Last but not least there’s “More Advanced Elixir”, which covers macros, protocols, the language’s approach to mixins and a grab bag of topics that didn’t quite warrant chapters of their own. I really liked this entire section, especially the parts on protocols and mixins. I feel like it gave me the tools to look at most Elixir code and figure out what’s happening, which is quite an achievement for a book of this length.

Closing thoughts

The world of Erlang/OTP is somewhat different from other programming languages, so no matter what your background is, chances are that certain things may feel somewhat alien to you. This is were “Programming Elixir” shines: it doesn’t just try to get you to write Elixir, it wants you to write good idiomatic code because you understand what makes the language tick. The writing has a good flow and is to the point. On top of that each chapter comes with some well thought-out exercises that should keep motivated readers busy for a while. It’s hard to imagine a better introduction to the language than “Programming Elixir”, highly recommended!

Information Overload 2015-03-08

Information Overload 2015-03-01

Information Overload 2015-02-22

Information Overload 2015-02-15

Information Overload 2015-02-08

Information Overload 2015-02-01

Information Overload 2015-01-25

Information Overload 2015-01-18

2014 Reading List

Here’s my annual reading list post. 2014 saw me read less than I wanted to, but exploring my new hometown (Bangkok) and learning Thai used up a lot of my free time. That said I still managed to get in a decent amount of books, caught up on more comics and added a 4th language (Thai) to my reading, although so far that’s been limited to children’s books.

Books:

  • Tom Vater: The Cambodian Book of the Dead
  • A.C. Bhaktivedanta Swami Prabhupāda: On the Way to Krisna
  • Timeri N. Murari: The Taliban Cricket Club
  • Jonas Jonasson: The 100-Year-Old Man Who Climbed Out the Window and Disappeared
  • Luis Sepúlveda: Historia de una Gaviota y del Gato Que le Enseñó a Volar
  • Charles Bukowski: Post Office
  • David Sedaris: Let’s Explore Diabetes with Owls
  • Tom Vater: The Devil’s Road To Kathmandu
  • Jean-Claude Izzo: The Lost Sailors
  • Sean Eads: The Survivors
  • Charles Bukowski: Factotum
  • Benny Lewis: Fluent in 3 Months
  • Paco Ignacio Taibo II: Some Clouds: A Hector Belascoaran Shayne Detective Novel
  • Charles Bukowski: Women
  • Aldous Huxley: Brave New World Revisited
  • NoViolet Bulawayo: We Need New Names
  • Alex MacCaw: The Little Book on CoffeeScript
  • Ernest Cline: Ready Player One
  • Andreas Altmann: Der Preis der Leichtigkeit : eine Reise durch Thailand, Kambodscha und Vietnam
  • Charles Bukowski: Burning in Water, Drowning in Flame
  • อีสป: ราคานิทานอีสป2ภาษา อินทรีกับชาวนา
  • Marco Ferrarese: Nazi Goreng
  • Nnedi Okorafor: Who Fears Death
  • Nick Wilgus: Mindfulness and Murder: A Father Ananda Mystery
  • Vikas Swarup: Six Suspects
  • Haruki Murakami: Norwegian Wood
  • Shamini Flint: A Most Peculiar Malaysian Murder
  • D.D. Johnston: Peace, Love & Petrol Bombs
  • Mohsin Hamid: How to Get Filthy Rich in Rising Asia
  • Rodolfo Pardi: The most important Chess Pattern - Critical Squares
  • Dan Kennedy: Loser Goes First: My Thirty-Something Years of Dumb Luck and Minor Humiliation
  • Junot Díaz: This Is How You Lose Her
  • David Sedaris: Dress Your Family in Corduroy and Denim
  • รัชนี ศรีไพรวรรณ: หนังสือเรียนภาษาไทย
  • Ali Almossawi: An Illustrated Book of Bad Arguments
  • Avdi Grimm: Confident Ruby
  • Terry Pratchett: Unseen Academicals
  • Ioan Grillo: El Narco: Inside Mexico’s Criminal Insurgency
  • Mikel Santiago: Historia de un crimen perfecto
  • Charles Bukowski: Mockingbird Wish Me Luck
  • Johnny Cash: Cash
  • Marc-Uwe Kling: Die Känguru-Chroniken: Ansichten eines vorlauten Beuteltiers
  • Barend Jan Terwiel: Thailand’s Political History: From the 13th century to recent times
  • John Siracusa: OS X 10.10 Yosemite: The Ars Technica Review
  • Marc-Uwe Kling: Das Känguru-Manifest
  • Marc-Uwe Kling: Die Känguru-Offenbarung
  • Namita Gokhale: The Book of Shiva
  • Julia Alvarez: In the Time of the Butterflies
  • Peter F. Hamilton: If at First…
  • Simon St. Laurent: Introducing Elixir: Getting Started in Functional Programming
    1. David Eisenberg: Études for Elixir
  • Anthony Grey: Saigon: An Epic Novel of Vietnam

Comics:

  • Scott Snyder: American Vampire, Vol. 2
  • Jeff Lemire: Sweet Tooth, Vol. 1: Out of the Deep Woods
  • Jeff Lemire: Sweet Tooth, Vol. 2: In Captivity
  • Jeff Lemire: Sweet Tooth, Vol. 3: Animal Armies
  • Jeff Lemire: Sweet Tooth, Vol. 4: Endangered Species
  • Jeff Lemire: Sweet Tooth, Vol. 5: Unnatural Habitats
  • Jeff Lemire: Sweet Tooth, Vol. 6: Wild Game
  • Jason: I Killed Adolf Hitler
  • Fábio Moon: Daytripper
  • David Mazzucchelli: Asterios Polyp
  • Brian K. Vaughan: Saga, Volume 3 (Saga #13-18)
  • Fujiko F. Fujio: DORAEMON Vol.4
  • Ed Brubaker: Deadenders
  • Matt Fraction: Sex Criminals, Vol. 1: One Weird Trick
  • Scott Snyder: American Vampire, Vol. 3
  • Neil Gaiman: Marvel 1602
  • Ales Kot: Zero, Vol. 1 An Emergency
  • Fujiko F. Fujio: DORAEMON Vol.5
  • Jeph Loeb: Spider-Man: Blue
  • Mark Waid: Irredeemable, Vol. 1
  • Mark Waid: Irredeemable, Vol. 2
  • Mark Waid: Irredeemable, Vol. 3
  • Jonathan Hickman: The Manhattan Projects, Vol. 1: Science, Bad
  • Mark Waid: Irredeemable, Vol. 4
  • Mark Waid: Irredeemable, Vol. 5
  • Mark Waid: Irredeemable, Vol. 6
  • Mark Waid: Irredeemable, Vol. 7
  • Mark Waid: Irredeemable, Vol. 8
  • Mark Waid: Irredeemable, Vol. 9
  • Mark Waid: Irredeemable, Vol. 10
  • Hugh Howey: Wool: The Graphic Novel
  • Joe Sacco: Palestine
  • Ales Kot: Zero, Vol. 2: At the Heart of It All
  • Mike Richardson: Crimson Empire, Volume 2: Council of Blood
  • Brian K. Vaughan: Saga, Volume 4