Elixir for Programmers, Second Edition (PragDave)

@pragdave has just released the second edition of his course - it looks like it’s changed quite a bit since the first edition so am posting it as a dedicated thread.

A Little History

This is the second edition of this course; the original was written in 2016.

Perhaps surprisingly, the Elixir language itself has not changed much in the intervening years. Some of the tooling works a little differently, but not enough to worry about. The major changes are in the libraries and frameworks we use. Many things in this course are easier now because of this. In particular, we can now use dynamic supervisors to manage our hangman games, and we can exploit Phoenix LiveView to do all of our browser interaction on the server: no more JavaScript.

I’ve also refined some of my opinions on project layout since the first course. Those who took it may remember I recommended far more decoupling of code than is normal in Elixir projects. Coming back to my code four years later I realize that I can take this a step further, and make the separation between the application logic and the application runtime process structure even clearer.

What hasn’t changed is the joy I get from writing Elixir, and writing about Elixir. I hope this course helps you to feel it too.

I haven’t done it myself yet so looking forward to hearing what everyone else thinks :023:

31 Likes

I just bought this course, not sure you’re allow to download. I will go through and share my thoughts on the course content.

3 Likes

Does anyone know if this new editionis updated to Phoenix 1.6.5?
There have been some major changes since previous changes and I believe this would be a potential deal breaker for many.

Good question! I just checked. The latest branch of the public code repo (GitHub - pragdave/e4p2-hangman) was updated to Phoenix 1.6.5 and the latest LiveView 10 days ago.

I bought and finished the second edition of the course, enjoyed it a lot. Haven’t tried the updated code yet, but it’s there.

2 Likes

I can confirm that the new phx.new generators are used in the 2nd edition, but before the switch to HEEx. As far as the course content is concerned though, those are very minor changes that you’d have to do yourself.

Main focus of the course (and main takeaway for me) is the code organization and use of poncho projects. The apps are divided into separate projects and you go through the creation of three different clients (CLI, Phoenix, LiveView) for the hangman game without major changes to the core logic, which is great imho. You also implement a game server as a service that can be run on a different beam instance.

You get a very well thought out but I’d say pretty basic introduction to Phoenix and LiveView. In general, I would see those chapters as a demo for why the separation mentioned above should be considered. Also, there’s no use of Ecto at all, in case that’s important to you. Other than that - I cannot recommend this course highly enough. Fantastic content, well presented with accompanying detailed explanations.

9 Likes

This is a great description of the course! There are plenty of opinions about the best way to organize Elixir projects. But this is great exploration of how and why even simple applications can benefit from a clear separation of concerns.

The latest updates to the sample code does in fact use HEEX templates and sigils. Migrating manually is not very difficult. But it’s still nice and saves time when sample code works “out of the box”.

6 Likes

Huh, seems I’ve missed those updates, thanks for the hint! It also looks like @pragdave is still adding more content here and there. Since last I’ve checked, there’s a new text chapter on killing game server processes after a timeout. Bugged him with that question a couple weeks back and now there’s a chapter addressing it. :heart:

4 Likes

Thanks, I missed that. The branch with the finished LiveView game doesn’t have it, so I didn’t notice. Another nice addition from @pragdave!

I have now finished the course completely.

Issues I faced

  • I will say, at the time of this writing, you will find quite a number of typos in the text. However, do not despair, the course is of good quality and you understand what the author means from context.
  • The Windows experience is quite detrimental. Admittedly, this is not the authors fault, but if you are doing the course on a Windows machine there are some exercises you simply won’t be able to do. This happens because of limitations regarding IEx and the shell. I have reported this and afaik this is being investigated: Autocomplete in IEx broken (on Windows) · Issue #4103 · elixir-lang/elixir · GitHub
  • Dave makes a wild trip through Nodes and rpc calls. While interesting as a mechanism to understand how erlang machines communicate, it is something you will very likely never use in your life. The author states the same. In fact, unless you are building your own framework, you really shouldn’t use any of it. This kinda breaks the flow of the course and it was (for me) the hardest part to digest because I knew I was not really going to use it … (and it is also a gatekeeper from the sections that are also the coolest).

Things that I liked

  • The humour. I am not sure if it is the fact he is originally British and that I like Monty Python, but I did enjoy it.
  • IEx customization. Yah, he mentions IEx customization and shares his own file. It is really cool and immediately motivating.
  • Personalized font for your editor. He also shares his cool font , Fira Code which I absolutely love.
  • Dialzyer types. He makes a use of the opaque type. When I saw it in the wild I never understood why - but now thanks to his course I do. And I think it makes a lot of sense for functional programming. Overall he covers the basics of dyazlier, which is something I support in any project.
  • The architecture. When I first made his course I liked the idea of small apps, but I had never really adopted it. I left it as a cool idea. Years later, I have read a few more books and with this course I got to revisit the idea. I still wonder why he didnt go for an Umbrella, but I can definitely say his architecture principles had a major impact on how I code today.
  • Phoenix and LiveView. It is a perfect first dive for anyone wanting to learn. Last year I started a project that I could not complete. This year when picking it up, I found everything had changed in Phoenix and I had no idea on how to start. Now I picked the project and I am close to finishing it. All of it because of Dave’s introduction to both Phoenix and LiveView. I cannot stress how much this helped me.

Cool apps

You also get some cool apps to show off in your portfolio.
I made a Git repo with some of the lessons I learned. I invite you to have a look, maybe this will help you decide if this course is what you are looking for. I can say, it was for me:

I absolutely enjoyed the course and recommend it. For someone who is just 0.000000001% of the world’s population, his opinions resonate with me more than I expected, even years after completing the first edition.

(PS, the population joke is a reference to his course. I guess you now have to buy it to understand what it is all about! Mwuahahahahah).

15 Likes

I also just finished the course. I did not find the typos terribly intrusive and I appreciated that Dave provides a mechanism for reporting the typos directly from each lesson.
I actually really enjoyed the lessons on Nodes and rpc. The topic seems to be the actual killer app feature of Erlang/BEAM but one that is hard to find tutorials on.
I probably benefited most from Dave’s explanation of the architectural choices he made in setting up the app.
I do wish he had at least touched on deployment, or at least building in production versus dev. To be fair though he explicitly states why he does not address it and his point is valid. It seems quite easy to find tutorials and other information on building apps in dev mode but much more difficult to find the same for building production releases and deploying them.
I have paid for a handful of online courses over the last couple of years. Dave’s course is easily the best value of any I have done. He could charge triple and I would have been satisfied with the value.

5 Likes

Would like to take the course too, are we able to watch the videos offline(is there a possibility to download videos)?

I don’t believe the videos can be downloaded for offline viewing.

Because the videos are private and the course does not offer a way to download them for offline use, I dont think you can download them. Even if you had access to the video’s url, you would still not be able to download it due to permission restrictions.

What you can do however, is watch the video in 1x or 1.5x speed, while recording it when a screen recorder.
It is not as fast as a download, but at least you get watch it offline.

The course by Dave. Will definitely have a look.

I’m currently taking this course and this is one of the best learning resource for Elixir. I wish I took it earlier.

3 Likes

Hi guys.
I am currently going trough this course, and I have a strange error when trying to start Hangman, the error is that the file “assets/words.txt” (that is from the dictionary dir) cannot be read, but when I start dictionary application, all works fine.
I have solved it with “…/dictionary/assets/words.txt”, but it does not seem to me a proper way to do it, as the dictionary should be the separate application with its own concerns.
All the code is the same as Daves, checked also on github.
Please if somebody had the same issue to reply to me, or a way to fix it.

Which lesson is it, where it doesn’t work? I’ll check tomorrow

It’s “Make Hangman a Server” , I have resolved the issue, but still it does not seem right to me.
The hangman server app is trying to find the asset under his own dir tree. I needed to point the hangman app to the directory in dictionary application even the asset is called from dictionary app.

What is your opinion on that?

Change it to "./../../assets/words.txt". Check my repo:

1 Like

I had the same issue today, and fixed it like this:

"#{Path.expand(__DIR__)}/../assets/words.txt"

This gets interpolated to /home/rahim/…/dictionary/assets/words.txt