11 ms·
Joy of Elixir
- adamkittelson 9y agoI've certainly enjoyed Elixir as an nth programming language and the idea of Elixir as a 1st programming language is really interesting. I know I've seen at least one educator in the community speculate that Elixir (or FP languages in general) could potentially make great 1st programming languages because they're often conceptually easier than OOP languages and in many ways the difficulties people associate with learning them come from the difficulty of unlearning some of the things they already know.
- deleted 9y ago[deleted]
- urs2102 9y agoI've actually been discussing this with a couple of people within the community. Been hacking with Elixir for a bit, and in an effort to teach it to people around me who've never programmed I've started compiling my notes into a book. Would love to share it here in a bit when I have some time to finish things up and get some feedback. I will say, writing from the perspective of it being one's first language is really interesting, because you just can't assume anything.
- zensavona 9y agoI have first hand experience with this actually... Over the last 6 months or so a good friend of mine has learned to code from scratch. After much deliberation I took a gamble and set him up with Elixir as his first language (largely because he wanted to code so he can work with me on some projects, which use Elixir). I am really happy with this choice and so is he. Elixir is a language with very consistent ideas throughout and I think concepts like functional transformations, immutability, pattern matching and actor based concurrency are both extremely useful to learn early and very accessible to beginners in Elixir. Edit: I didn't think of it when I wrote this comment, but I think the single most helpful thing for beginners (and me!) in Elixir, is the 'h' function. If you run it with any function as an argument in iex (Elixir's repl) you'll get documentation and an example of how to use that function: iex(2)> h Enum.map def map(enumerable, fun) Returns a list where each item is the result of invoking fun on each corresponding item of enumerable. For maps, the function expects a key-value tuple. ## Examples iex> Enum.map([1, 2, 3], fn(x) -> x * 2 end) [2, 4, 6] iex> Enum.map([a: 1, b: 2], fn({k, v}) -> {k, -v} end) [a: -1, b: -2]
- RodericDay 9y agoPython has the same via help(thing)
- robert_tweed 9y agoAs does Clojure with doc. However, neither of these include examples as standard. Idiomatic docstrings tend to be a short string; one sentence or paragraph.
- s_kilk 9y agoHow does your friend deal with Processes, OTP, Supervision trees and so on? I'm a huge Elixir fan, but always thought it would be a hard first language because of OTP, the benefits of which are kinda hard to appreciate without some experience making production software. Happy to be wrong on that though.
- didibus 9y agoHaving the example is really cool. I tend to provide examlme in docstrings for functions I personally write. Would be nice if core functions of other languages did too.
- ryanbigg 9y agoHi! Thanks for the kind comment :) I find it an interesting idea too. I mentor people at Culture Amp in Ruby and Elixir and I'm definitely finding Elixir easier to teach for a couple of main reasons: * It's Just Functions And Data™ * Inheritance isn't a thing * Functions either come from within the same module if they don't have a module prefix * Functions from other modules _must_ have a module prefix. * Immutability, immutability, immutability. It just _feels_ like there's less to learn with Elixir (foundational wise) than Ruby. It's been pretty nice.
- skrebbel 9y agoI beg to differ with most of your points: * Inheritance isn't a thing, but behaviors and protocols are. * Functions from other modules _must_ have a module prefix, except if the current module has `import` statements at the top or, worse, `use` statements which happen to run macros that in turn `import` stuff again. Phoenix does this with controllers, and it's a mess. A million unprefixed functions available and no clue where they come from. Also, you forgot about `Kernel`. * Immutability, except when you inherit code that uses Agents all over (which is really just a Java Bean, a mutable object, or whatever you want to call it) and you lose it all again. Process state is mutable, and the smaller your processes are, the more your code starts to smell imperative. In all honesty, if you add import, use, macros, behaviors and protocols to your list, then all in all there really is pretty much to learn. It's no C++, but I have a hard time calling Elixir simpler than Ruby. Now, I think these are all good features (except Agents). They just make Elixir less simple, that's all.
- passer-by-123 9y agoI would say the difference is that you can start small. You can start thinking about functions and data and you can build a large amount of software with the simpler abstractions. I would say this is not specific to Elixir but to functional languages. A good amount of my code is just functions and data. Processes, macros, protocols, etc come only when strictly necessary.
- jaylynch 9y agoWhen I went to university for CS, Haskell was used in the introductory programming courses and this was one of the main reasons we were told about. Another goal was to take the people who had been learning to code in their spare time and put them on more even footing with those who were totally new, force them to think about things from first principles rather than lean on acquired habits, etc. I had already been coding for a long time by that point but it was the first time I saw a functional language and I think it addressed both goals very well.
- yorwba 9y ago> Another goal was to take the people who had been learning to code in their spare time and put them on more even footing with those who were totally new The thinking behind that is usually a bit fallacious, though. Say the department has been teaching Java in the introductory programming course, and noticed that some people already know most concepts. Then they decide to use a different language to "level the playing field". First of all, what kind of attitude is that? If some people already know the stuff, just let them take the exam without attending the course, so they can take "Advanced Programming Paradigms" or wherever FP is taught. I can understand teaching FP first if you think it's conceptually easier, but counting prior experience of some students as a reason to restructure the curriculum for everyone is silly. Second, using Haskell instead of Java isn't actually leveling the playing field. It just changes who has an advantage from game modders and people who coded their own website to the more mathy types (or people who learned Haskell in high school, like me), who will have an easier time with higher-order functions and the rigid formality of the type system. When they announced in my OOP course that there'd be a few sessions on other paradigms, I was a bit disappointed to find out that this meant only a bit of Haskell and Prolog, when I'd already written a simple Prolog interpreter in Haskell. Should they have changed the curriculum just because of me? Definitely not.
- jaylynch 9y agoIt was a long while ago now, if you had learnt anything before you got there it was pretty much guaranteed that you'd seen either BASIC or C. :) The internet wasn't what it is now either so most people who had done some coding before were indeed lacking in understanding of the fundamental principles of what they were doing – I know I certainly was. There may have been outliers yet beyond the "I've been playing with code" crew but I didn't meet any. I'm not at all suggesting it would be good reasoning today, but I think it helps to show that the underlying idea that FP is a good way to introduce people to code whilst ensuring they develop a strong theoretical understanding was true then and should still be today.
- beedn 9y agois there any news recently about Elixir? I'm asking since recently Im seeing a lot of articles about how to get into Elixir which is really nice since I just started pickup the language as well.
- pawelduda 9y agoErlang/OTP 20.0, Elixir 1.5 and Phoenix framework 1.3 were all released in a timespan of 2 months or so - huge improvements to the already great ecosystem.
- pmarreck 9y agoTwo months? Try all within the last 2 weeks!
- bglusman 9y agoErlang/OTP 20 came out June 21[0], so about 5 weeks ago. Makes sense though, Eliir 1.5 was waiting for final release of OTP, and Phoenix was waiting on final release of Elixir, but they'd all had very stable preview releases for a while, so it wasn't a ton of work left on any of them, just finalizing and testing I imagine. I'm super excited to get my side project[1] upgraded to 1.5 and see the new dev conveniences! [0] https://www.erlang.org/news/114 https://www.erlang.org/news/114 [1] https://github.com/MasbiaSoupKitchenNetwork/open_pantry https://github.com/MasbiaSoupKitchenNetwork/open_pantry
- aarongolliver 9y agoThe Phoenix team was waiting for Elixir 1.5 to release the new version of the framework (or at least one of the devs said as much in a talk I watched a while ago).
- kureikain 9y agoA good youtube channel: https://www.youtube.com/channel/UCFKQ85T69sYhifDHF7dnPgw/videos https://www.youtube.com/channel/UCFKQ85T69sYhifDHF7dnPgw/vid... Kind of like a quick guide: https://elixirschool.com https://elixirschool.com http://elixirbridge.org/02_Intro_to_Elixir/01-why-program-why-elixir.html http://elixirbridge.org/02_Intro_to_Elixir/01-why-program-wh... I think Elixir isn't that hard about syntax. Just start to do something and learn it on the go, see how people do it. I have experience with it, quite nice: https://github.com/yeo/betterdev.link/tree/master/community/betterdev https://github.com/yeo/betterdev.link/tree/master/community/... Which power: http://one.betterdev.link http://one.betterdev.link
- puuush 9y agoThis doesn't improve the current docs or tutorials.
- bostonvaulter2 9y agoIt does if you are an absolute beginner to programming. If you are already seasoned then yes it doesn't add much, it just means you aren't the target audience.
- X86BSD 9y agoWhich the JOE folks make quite clear. Why would anyone assume this was not for complete novices new to programming in general? It seems odd to me. I find it a very good start for someone new to programming with zero experience and wishing to start with elixir. There are hardly any books that approach programming elixir from a complete lack of programming knowledge POV. I'm happy to see this!
- ryanbigg 9y agoThank you for the validation! :) It really helps to see support like this for the project.
- puuush 9y agoAha, then add more fun through pictures (the drop of elixir thing at the homepage could be the spokesperson). How many people are working on this?
- notamy 9y agoThere seems to be an unfortunate number of "TODO: Add image here"-type blocks in this. Other than that, a quick glance seems good to me.
- ryanbigg 9y agoYup, sorry about that! I am a _horrible_ artist and so I'm hoping to rope a good friend of mine in to help with that. He's recently started a new job and so he's been busy. One day there'll be some great images in the book.
- notamy 9y agoCan't wait to see them! I really like the book so far :)
- dgjuuff 9y agoAnother book by someone with no experience in the language. Typical vultures latching onto a community and trying to monetize it.
- shocks 9y ago> by someone with no experience in the language What evidence do you have?
- dgjuuff 9y agoYou mustn't be familiar with the author... The author has been hanging around the community for the past few months, if they wanted to make it a better place, they should work on improving the already amazing documentation. This is all just A self promotional stunts. The author has done this before in the Rails community
- adamkittelson 9y agoI'm not familiar with the author, but writing a programming book has got to have the worst possible effort to return value ratio if one's goal is solely self-promotion. I'm disinclined to believe anyone would put in that kind of time if that's what they were going for.
- pmarreck 9y agoRyan Bigg (github: https://github.com/radar https://github.com/radar) has been active in the Ruby community for years (and is seriously intelligent, at least based on his many past IRC responses to my Ruby questions, assuming he's also named Radar on there), has apparently been working with Elixir on the side for a while, and IMHO can definitely handle an Elixir book intended for new programmers. He would be a very significant asset to the community were he to jump ship and go fulltime Elixir. Your skepticism (which is otherwise probably warranted) is quite wrong in this case. I'm sorry if someone defecated into your Cheerios this morning, though. Sometimes the best way to learn is to teach, and sometimes the best way to teach is to make money teaching. :P
- cordite 9y agoWhile I applaud creating documentation, books, and guides for those new to the language, there's still a significant accessibility gap in resources. I already know the language, I've already done some basic stuff in phoenix, I've even made my own HTTP API wrapper as its own library. But when it comes to architecting backend systems that aren't tied to phoenix or playing around with IEx, I really feel like I am on my own. There are erlang books, of which I am reading, though it feels like there's always emphasis on history for backwards compatibility and the other warts that Erlang has with its age. I'd like to design reliable systems that operate outside of the classic HTTP -> Elixir -> Database pattern. Things that involve working in memory, processing queues, managing sessions and state, patterns for fallbacks and breakers for services, and so on, that is where I seek more content. Unfortunately I hear the big BEAM player around, Basho, is shutting the lights--so I can't expect to witness the wonderful presentations their engineers provide at conferences or through recordings of such conferences.
- tarr11 9y agoFound this post from June about Basho. https://news.ycombinator.com/item?id=14621359 https://news.ycombinator.com/item?id=14621359
- lostcolony 9y agoIt's very definitely dead. https://www.theregister.co.uk/2017/07/31/end_of_the_road_for_basho_as_court_puts_biz_into_receivership/ https://www.theregister.co.uk/2017/07/31/end_of_the_road_for...
- jah 9y agoI feel that Erlang adoption is probably the most realistic growth path for most serious Elixir developers. All of these topics you mentioned (breakers, message routing, etc) have been discussed and developed in the Erlang community for years. The only new thing that Elixir brings to the table in these areas is abstraction and syntax - both of which are arguably not needed in large complex systems. Source: full-time Erlang developer of 7 years who spent a full year coding Elixir in its v1.0.x days
- jondubois 9y agoWhy is there so much Elixir hype on HN at the moment? HN shouldn't be used as a propaganda hype machine. I've seen all the language hype cycles, Year 1: PHP sucks! Node.js is awesome! Everyone must use Node.js! Year 2: Node.js sucks! Go is awesome! Everyone must use Go! Year 3: Go sucks! Rust is awesome! Everyone must use Rust! Year 4: Rust sucks! Elixir is awesome! Everyone must use Elixir! ... And of course you get the odd Haskell article every so often. Communities are promoting their stuff too hard - They are setting up their users for disillusionment and disappointment.
- acjohnson55 9y agoEh, just don't upvote it. Or upvote other PL stuff you do like.
- bhauer 9y agoI too feel there is a generational hype cycle at HN. However, I don't see much in the way of "language N sucks" as a precursor to "everyone should use language N1!" Maybe I am just blind to the negativity, but in general, what I see with each hype generation is only the positive side: "everyone should use language N1!" I suspect with any given hype generation—with each trending language—we're going to see a lot of positive messaging as the fans up-vote articles pertaining to the new hotness. Meanwhile, those who disagree (or simply don't care) probably don't see much value in taking the time to evangelize their disagreement. I'm not upvoting Elixir content, but I'm certainly not going to downvote it either. Why should I care if other people enjoy a platform I don't care about? Good for them! Also, perhaps as everyone is hyping language N1, those who are using N are simply too busy using N and making a living to keep layering on the hype.
- jondubois 9y agoAdding more programming languages just fragments the job market further. That might mean fewer jobs available for other languages and allow software developers less movement between companies. How many times have you seen a job advert and you think oh wow that looks interesting, I'd like to work there... Oh wait, they use X on the backend, I don't have any previous commercial experience with X so damn, I can't join the company. The more programming languages there are, the more often this will happen. The time for creating and promoting new programming languages is over, we have to move forward and work with the languages whose ecosystems have had 20 years to evolve - This is where the real value is. I'm certain that using Elixir over Haskell, Go or even JavaScript/Node.js adds no extra value to any given project... It only restricts the pool of potential job candidates. If you use any programming language for long enough, eventually, you will be very productive with it - The language itself doesn't really matter. Its just a waste because there are already so many languages optimized for the server-side use cases which Elixir aims for and which are already doing a great job.
- amorphid 9y agoSide note... the book's logo is mildly similar to the Drupal icon. Might confuse a few people. https://www.drupal.org/files/druplicon-small.png https://www.drupal.org/files/druplicon-small.png
- achariam 9y agoI've spent the last year building[1] an open source side project with elixir and phoenix. It's honestly been a pleasure to work with once you get over some of the initial hurdles. [1]: http://www.achariam.com/elyxel http://www.achariam.com/elyxel (It's a self plug but I genuinely think it will be helpful to folks)
- bogomipz 9y agoI've been seeing a lot about Elixir lately. I am curious are people seeing a demand for Elixir in the market? Or has anyone recently hired for it? If so what did it look like from the hiring side?
- andythemoron 9y agoI happened to mention interest in Elixir on my LinkedIn page, and now I get hit up by recruiters for it every so often, so it seems so. I haven't heard too much outside of this personal anecdote, however.
- di4na 9y agoAt the london meetup last week, when ask if their company recruit and search for elixir devs, everyone raised their hands. Approx 60 to 80 devs. So probably 20 to 30 company....