Is elixir good for beginner programmer?

While I certainly understand the sentiment, I wasn’t referring to it for learning how to write macros but to underline that “macros that generate code during compilation” are of central importance in Elixir - and people coming from languages where that capability isn’t a core feature need to be made aware of it as soon as possible.

In my mind some macros express code that “hangs in the sky in much the same way that bricks don’t” - as a result from a novice’s point of view it isn’t at all clear how that code can have any run-time effect and/or how the code connects to the “rest-of-the-world” until they are made fully aware of Elixir’s meta-programming facilities (I’m surprised this hasn’t made it into Elixir’s biggest gotchas).

One good example is the plug router:

defmodule MyRouter do
  use Plug.Router

  plug :match
  plug :dispatch

One has no hope of understanding what is happening here until the realization comes that a whole bunch of code is “hydrated” here, in place, during compilation. The faster any novice realizes that the better. So while writing macros can wait, reading them and understanding their implications on the language as a whole cannot - at least in my opinion.

4 Likes

Thank you for the reply. Do you think I should learn Javascript and Elixir at the same time ? or just focus primarily on Elixir for now? I am asking because one language is for front-end and the other is for backend.

Thank you for your reply. I could not find any good on-line learning video for elixir and its Phoenix framework, and the only functional programming languages that I could find their online classes are scala and f#. My question is, will it better for me to learn other languages such as python with django, ruby with rails or javascript with nodes while I am reading “Learning Elixir 1.3” book?

Do you think I should learn Javascript and Elixir at the same time

You definitely could learn them both, while I still would recommend learning them in separate intervals like focus 2 days on elixir, then switch to js for a day or two, then back again, since the context switch during a day can slow you down, plus it might be too much. Once you feel comfortable with both of them, you can start using them together in frameworks like phoenix.

I could not find any good on-line learning video for elixir and its Phoenix framework.

I don’t recommend learning programming languages from videos, they are good for theory and specific subjects but in general to learn a language I would avoid videos anyway.

will it better for me to learn other languages such as python with django, ruby with rails or javascript with nodes while I am reading “Learning Elixir 1.3” book?

I personally would not try to learn simultaneously more than 2 languages, as you will be also learning lot of technologies and concepts with each and it will quickly become overwhelming. If you are gonna commit to Elixir I would stay away from Rails all together, Phoenix is simply superior, Rails created something awesome and inspiring, it began all this MVC framework movement and was inspiration to Phoenix and many others, however I feel its time has come, there are however many Rails jobs and many are gonna stay for years to come. Cannot say the same for Phoenix yet, but one can expect that in about 3-4 year time there are gonna be more demand for Phoenix than Rails. But if you know no Ruby just look at it as Phoenixes granddaddy.

Lastly about learning Phoenix there is the Phoenix book, “Programming Phoenix”, its a really good book to get you up and started, I know 2 books to buy might be a bit too much. But given you are learning, I take it you are probably a student and I am sure your parents would be more than happy to help you get the money if you tell them its for books.

2 Likes

Honestly, you’re probably better off going deeper with JS and Python first. Build some things. There are orders of magnitude more beginner-friendly resources available for those languages. Most Elixir developers are already experienced programmers so it will be harder to find blog posts and Stack Overflow posts about the basics.

The better you get, the easier it will be to pick up new languages, so don’t worry about wasting time learning something else first even if Elixir is your goal for later.

1 Like

The problem is that your first language has an incredible impact on how you think about programming - the good thing about starting from scratch is that you don’t have any preconceived notion on how things are supposed to be. Learning “those other languages” first can actually erect obstacles to learning languages like Elixir. I’ve already expressed my current preference on “how to learn to program” elsewhere so I’m not going to repeat it here.

Short answer: Give priority to Programming Elixir 1.3 and depending on how committed you are, consider acquiring it via the Starter Kit for Elixir Development (it also applies to “Programming Elixir 1.3”).

Now of all the other languages you listed JavaScript is the next most important one because there is just no getting away from it in web development - no matter how much you may learn to “hate” it in the future (same for NodeJS, not because of its use as a server but because it is such an integral part of the web development tool chain). It is essential that you become competent in it eventually - no matter what your personal opinion on JS in the future will be. But it probably is a good idea to pick up some good habits in Elixir first so that they can rub off on your JS.

Ultimately you should aspire to the JS style that is showcased in JavaScript Allongé, the “Six” Edition to make your JS-experience as pleasant as possible. Focus on ES6/EcmaScript 2015 - not because of classes (:unamused:) but because of destructuring, template literals, generators, etc. Probably the best on-line resource to expanding your JS knowledge is the “You don’t know JS” series:

See also the [ECMAScript book topic] (ECMAScript book).

3 Likes

Hear hear, that is why I am a huge proponent of people learning a low-level assembler (old Motorola or so, not necessarily a nasty one like x86), as well as LISP. Both of those prepare you for both understanding how the CPU works and high level concepts (every high level concept if you learn LISP well).

4 Likes

I’m afraid I have been spoiled. :frowning: I will not name by which language. :slight_smile:
But Peer’s quote reminds me of Edsger Dijkstra:
“It is not only the violin that shapes the violinist, we are all shaped by the tools we train ourselves to use, and in this respect programming languages have a devious influence: they shape our thinking habits. This circumstance makes the choice of first programming language so important.” (E.W.Dijkstra Archive: To the Budget Council (concerning Haskell))

4 Likes

I think Elixir is approachable for beginner programmers. However, my impression is that most of available resources (including my own book) are targeting experienced programmers. A suitable beginners book might be Introducing Elixir. I didn’t read it myself, but from what I’ve heard, it’s a very gentle introduction to Elixir, so it might be a good place to start.

1 Like

I’d encourage you to use a site like http://exercism.io and work through some of the basic problems in Elixir and then do the JavaScript version. Maybe switch it up and do a problem in JavaScript first and then the Elixir version and so-on. Heck, try one problem in Python and compare to your solution in Elixir.

But back to your question - JavaScript is a big world. I think it is very important to know JavaScript, but the question is in regards to the context. With the large client-side JS frameworks today like Angular, React/Redux, Ember, and so-on - that blurs things a bit versus just knowing JavaScript. And then you have Node, which can be used for tooling or building systems… lots of ground to cover. I guess it really depends on what kind of work you do or are pursuing. I work with JavaScript on a regular basis and at one point was the lead on a client-side framework team for a large product, so I’ve been 100% in JS land at times in my career.

If you’re simply learning for fun or to become a better programmer, I do believe learning the basics of Elixir and how to think functional will help you in almost every other language you encounter. You can write functional code in other languages or use some other functional language altogether, but I feel the Elixir syntax is very approachable and can help you get started quickly.

At the end of the day, I’d not approach it like one language versus another. I love Elixir, so obviously take my suggestions with a grain of salt - but I’d focus on the basics of the language to start. How to handle iterating over a list of data. Learn the Enum module. Learn about Maps. See how that compares to other languages and their core libraries. Basically just get in there and get dirty. After that, learn the more Elixir-specific stuff if you want - OTP related things, Phoenix, etc. But I would stay away from all of that if you’re just beginning.

3 Likes

It all depends if you only had time to learn only one language, than JavaScript let’s you write, desktop(electron etc.), mobile (Rect Native, Ionic etc.), web front end and backend apps. Elixir is so much nicer though and a lot of people make a very valid point about first language shaping your thinking so in that regard Elixir is a good option.

It should be noted that Études for Elixir (O’Reilly) are the companion exercises to the book (see also When learning, what order of books did you start with? and Which Elixir books have you got/read?). Also note the a 2nd edition is slated for November - though I don’t think that is a good enough reason to put off getting started with the first edition :slight_smile:.

If you want to learn something interesting you can try

This XSeries presents a programming method that will enable you to produce well-structured programs — programs that tell a clear story about what they do, are well tested, and are easy for others to improve. This series differs from other online programming courses by focusing on a general design method, rather than how to program in a specific language.

https://www.edx.org/xseries/how-code-systematic-program-design

Thank you for your recommendations. I am thinking to buy Programming Elixir 1.3 and Introduction To Elixir 2nd.

And for getting better with JavaScript I’d recommend http://eloquentjavascript.net/, https://leanpub.com/javascriptallongesix/read, and https://github.com/getify/You-Dont-Know-JS. I wouldn’t necessarily recommend reading all of those in sequence, but mix and match. I listed them in order of approximate difficulty.

I think both of these books cover the same stuff. Better buy one of the two and the Phoenix book.
What I did is after reading Programming Elixir, I went through the guides on http://elixir-lang.org/ to refresh what I learned, and it turned out perfectly!!

If you want to buy 2 books for Elixir I would recommend one of the introductory and then Elixir in Action.

1 Like

Although many people have already answered in this topic, I want to offer my two cents, as I am of the opinion that JavaScript is a really bad language to start out with.

I think Elixir is a really wonderful language to start out in, because when you start out, you don’t have any patterns that you need to unlearn. Many people that come from other contexts (especially non-functional ones), face this when starting with Elixir. (Although it is a lot easier to migrate to Elixir than, say, Haskell).

The main argument in favou of JavaScript I’ve heard so far is based on bandwagoning (i.e. ‘learn it because everyone uses it’), which is an argument that hampers innovation. Javascript itself is (arguably) a terrible language (to start out in), because it has many peculiarities that only exist for historical reasons; It is very easy to write incomprehensible, unmaintainable and/or unsafe code in JS.

I think it is better to learn programming in an environment that actively points you to a way of writing understandable and maintainable code, because once you’re used to doing this, you will carry that over to other languages, including the ones that might otherwise seduce you to write in an unmaintainable way.

2 Likes

Agree with everything you said except for recommending Programming Elixir. Programming Elixir is not beginner friendly. Introducing Elixir may be a good starting point before jumping into Programming Elixir.

2 Likes

yep )

i’d agree with this
i’m a newbie for myself (half a year online courses and half a year working as RoR junior developer)
and i agree completely that Programming Elixir is not the book for a beginner… i started with it, but after about 30% of the book i just can’t move forward and switched to Introducing Elixir, which is much easier…
now i’m back to Programming Elixir

in my opinion this book is for experienced programmer learning new language, not for a student learning programming from zero (even not for learning with some small experience in programming)

2 Likes

I can definitely see your and @max-underthesun point. I have not read Introducing Elixir and though it would be about the same. Thanks for pointing it out.

1 Like