Compare commits

..

1 Commits

Author SHA1 Message Date
Shadowfacts 896e3091a6
Add Learning Elixir 2019-10-10 12:32:23 -04:00
1 changed files with 3 additions and 3 deletions

View File

@ -11,7 +11,7 @@ About a year ago, I set out to learn the [Elixir](https://elixir-lang.org) progr
To actually learn Elixir, I did a few things. I started by reading through the official [Elixir Guide](https://elixir-lang.org/getting-started/introduction.html), and after that, following along with the [Elixir School](https://elixirschool.com/en/lessons/basics/basics/) lessons. These were useful in giving me a general idea of how the language works. To actually learn Elixir, I did a few things. I started by reading through the official [Elixir Guide](https://elixir-lang.org/getting-started/introduction.html), and after that, following along with the [Elixir School](https://elixirschool.com/en/lessons/basics/basics/) lessons. These were useful in giving me a general idea of how the language works.
I strongly believe that the best way to learn a programming language (especially if you already know others) is to just start writing code. [Exercism](https://exercism.io/tracks/elixir) is a resource I've found to be quite useful in that process. It has a sequence of programming challenges that increase in difficulty, so it gives you a good feel for what it's like to use Elixir to actually solve problems and helps shift your brain into thinking about problems in a functional context. I strongly believe that the best way to learn a programming language (especially if you already know others) is to just start writing code. [Exercism](https://exercism.io/tracks/elixir) is a resource I've found to be quite useful in that process. It has a sequence of programming challeneges that increase in difficulty, so it gives you a good feel for what it's like to use Elixir to actually solve problems and helps shift your brain into thinking about problems in a functional context.
By this point, it was almost December, so I decided I was going to try to do the [Advent of Code](https://adventofcode) problems only using Elixir. These challenges were more difficult than the Exercism ones, but they provided the same benefit of letting me get experience actually writing Elixir and solving problems with it an isolated context, without a whole bunch of moving parts. By this point, it was almost December, so I decided I was going to try to do the [Advent of Code](https://adventofcode) problems only using Elixir. These challenges were more difficult than the Exercism ones, but they provided the same benefit of letting me get experience actually writing Elixir and solving problems with it an isolated context, without a whole bunch of moving parts.
@ -25,9 +25,9 @@ After having learned Elixir, and continuing to use other languages for other pro
Firstly, it is a functional language, but not obtusely so. It's not steeped in terms and ideas that sound like you need an advanced math degree to understand. Of the functional programming languages that I've tried to learn, Elixir has been by far the easiest. It uses FP concepts, but in a way that makes it easy to learn coming from an imperative mindset. There's no worrying about monads and functors and combinators. The hardest change is learning to use recursion by default instead of instinctively reaching for imperative constructs like loops. You don't have to think about how specifically to structure your code so that FP concepts fit will with it. You can just write your code in a way that feels normal, and the functional aspects will become second nature. Firstly, it is a functional language, but not obtusely so. It's not steeped in terms and ideas that sound like you need an advanced math degree to understand. Of the functional programming languages that I've tried to learn, Elixir has been by far the easiest. It uses FP concepts, but in a way that makes it easy to learn coming from an imperative mindset. There's no worrying about monads and functors and combinators. The hardest change is learning to use recursion by default instead of instinctively reaching for imperative constructs like loops. You don't have to think about how specifically to structure your code so that FP concepts fit will with it. You can just write your code in a way that feels normal, and the functional aspects will become second nature.
Secondly, Elixir is _fantastic_ for REPL driven development. It comes with a built-in REPL (`iex`) which lets you quickly test code fragments, recompile your project, and view documentation. Secondly, Elixir is _fantastic_ for REPL driven development. It comes with a built-in REPL (iex) which lets you quickly test code fragments, recompile your project, and view documentation.
Like [Erlang](https://www.erlang.org/), which it's built on, Elixir runs on the BEAM virtual machine, which provides super-robust code-reloading. During the normal course of development, the only time I ever need to restart the running program is when I change the config file. Other than that, I can make a change or alteration and just run `recompile` from the `iex` session and nearly instantly have the all my latest changes running. Even when there are changes to data types or method signatures or compile-time constants, everything can just get swapped in seamlessly. Compared to the hot-swapping in other environments (nowhere near as good on the JVM, non-existent in many more), this is incredible. Like [Erlang](https://www.erlang.org/), which it's built on, Elixir runs on the BEAM virtual machine, which provides super-robust code-reloading. During the normal course of development, the only time I ever need to restart the running program is when I change the config file. Other than that, I can make an change or alteration and just run `recompile` from the iex session and nearly instantly have the all my latest changes running. Even when there are changes to data types or method signatures or compile-time constants, everything can just get swapped in seamlessly. Compared to the hot-swapping in other environments (nowhere near as good on the JVM, non-existent in many more), this is incredible.
The reason I find this makes such a big difference to the way I code is that lets me speed up my internal development loop immensely. I can very rapidly flip back and forth between writing code and testing it; I never feel like I'm being held up by the tools. I can stay in the flow much longer because there are no [lengthy compile times](https://www.xkcd.com/303/) to let me get distracted or start procrastinating. The reason I find this makes such a big difference to the way I code is that lets me speed up my internal development loop immensely. I can very rapidly flip back and forth between writing code and testing it; I never feel like I'm being held up by the tools. I can stay in the flow much longer because there are no [lengthy compile times](https://www.xkcd.com/303/) to let me get distracted or start procrastinating.