11 ms·
An animated introduction to Elixir
- whalesalad 4y agoThis is very neat. For a while I’ve wanted to create a visual wysiwyg editor for creating/visualizing supervision trees in Elixir/Erlang - love to see visualizations. (The observer is epic)
- ch4s3 4y agoThat exists in LiveBook now[1] as part of some visualization improvements. [1] https://news.livebook.dev/whats-new-in-livebook-0.7-2wOPsY https://news.livebook.dev/whats-new-in-livebook-0.7-2wOPsY
- ipnon 4y agoPhoenix with LiveView is an antidote to the pernicious Web we weave. Massive concurrency, hydration, and that ever elusive stateful single page app experience, are all handled at the framework level instead of in the application. You write the app and it Just Works. If React or the JavaScript du jour isn’t already your horse in the race, Elixir is well worth a weekend test drive.
- gorgoiler 4y agoDo you have a link to something that’s shipped with these technologies?
- ch4s3 4y agoI think https://www.cars.com/ https://www.cars.com/ is largely done with LiveView now.
- fillskills 4y agoIts really fast. Their site used to be really slow. Big change
- ch4s3 4y agoThey rewrote the whole back of house system from Java to elixir and apparently it’s been a huge success.
- e3bc54b2 4y agoI tried to look around, but is there a blog or something detailing before/after/why etc.? Should be very interesting read..
- yurishimo 4y agoThis is probably the most comprehensive thing online[0]. Not an article but you can read the transcript of the podcast episode[1]. 0: https://smartlogic.io/podcast/elixir-wizards/s7e2-jose/ https://smartlogic.io/podcast/elixir-wizards/s7e2-jose/ 1: https://smartlogic.io/podcast/elixir-wizards/transcripts/s7e2-jose.txt https://smartlogic.io/podcast/elixir-wizards/transcripts/s7e...
- ch4s3 4y agoOne of them gave an elixir conf talk about how they built an elixir team[1] and this one from 2022 which isn't online yet[2]. I know a little more about it from talking to them, but couldn't accurately describe the transition from memory. [1] https://www.youtube.com/watch?v=zKifFG4i-bY https://www.youtube.com/watch?v=zKifFG4i-bY [2] https://2022.elixirconf.com/speakers/zack-kayser https://2022.elixirconf.com/speakers/zack-kayser
- throwawaymaths 4y agoDiscord uses elixir quite a bit. I believe pagerduty as well.
- whoooooo123 4y agoElixir has some case studies written up on its official site. https://elixir-lang.org/cases.html https://elixir-lang.org/cases.html Also there's https://elixir-companies.com/en https://elixir-companies.com/en
- ch4s3 4y agoIt even have a jupyter competitor in LiveBook[1]. [1] https://livebook.dev/ https://livebook.dev/
- AlchemistCamp 4y agoUnfortunately VIM bindings are a non-goal, so I’m not going to be spending much time with it (due to a history of RSI).
- fish45 4y agoI use it with Firenvim: https://github.com/glacambre/firenvim https://github.com/glacambre/firenvim
- bongobingo1 4y agoWhen I tried that the in-page editor would fight it ferociously, was there a trick?
- ch4s3 4y agoYeah, that is unfortunate.
- timc3 4y agoIt doesn’t just work in my experience. Once its working it is fine, better than fine in fact. But I am going through a process of upgrading a Phoenix LiveView hobby site and its been miserable. For some reason LiveView has changed between versions, and the documentation isn’t the greatest on explaining why or what to do to remedy it, but its broke my app. I’ve managed to fix the majority of it but then the third party libraries used have not kept up (for authentication of all things). There is so little people using Elixir/Phoenix/LiveView that libraries are often poor quality and maintained by one person or very few people. It makes me miss Django for the batteries included completeness, quality of documentation and eco system. Phoenix also feels a little bit magical in the way Rails is, and I hated Rails for that. Give me configuration over convention and stop with the damn macros. I am also not convinced with Elixir as a language, I miss types, I miss C# and Typescripts documentation or the fact they feel well designed, I want something to replace Python as my goto and Elixir just feels like a dead end that happens to have a web framework with some excellent ideas. So I am currently thinking of rewriting the whole damn thing and leaving Elixir.
- ipnon 4y agoI agree with your assessment. You have to know what you’re signing up for. Remaining in the JavaScript ecosystem still maintains many tangible benefits.
- throwawaymaths 4y agoYeah you got bitten by the 0.15-0.16 transition in live view. My condolences. Documentation across the elixir ecosystem is pretty good, I find. I am way more comfortable in elixir ecosystem docs over python ecosystem docs.
- AlchemistCamp 4y agoThe transitions from about half of the versions between 0.3 and 0.10 were worse for me. From 0.10 to 0.15 were smooth. 0.16 was tied to phx 1.6, which made it worse again, but I didn’t find it that bad. 0.16 to 0.18 has been mostly okay again, but I’ve seen bugs introduced into an app just by adding IDs to HTML elements with a phx-hook on them. This is a problem since heex templates enforce that each hook does have an ID. It’s also strange that a totally new ID never used elsewhere in the app would break existing JS interop, but it does and it’s what I’ll be working on this week so we can continue upgrading… Not sure what it’s going to be like upgrading to Phoenix 1.7, but I think it’s going to be a major undertaking and unfortunately most my Phoenix-related screencasts will become obsolete. Elixir itself and Ecto have been really stable, though.
- weatherlite 4y ago> If React or the JavaScript du jour isn’t already your horse in the race, If only it were up to us simple devs who actually do the work. But its not. CTOs make the decisions and they bring in tech that "everyone else" is using. That means Java/Node/Python/C#/ and Angular/React is probably 90% of web code out there. I can try fighting the trend and specifically apply to niche tech jobs but its no fun...been doing that with Ruby for awhile until jobs literally dried up where I live. If you live in a remote friendly area (big parts of Europe) you can get by .. but I don't.
- tifadg1 4y agoAs someone completely new to js world, I've started learning nextjs and for hobby projects atleast I've come to the conclusion that negative opinions about js are overblown - yes theres not one dominating framework, but that's how innovation is born. Plus they're all about dev experience - you don't have to migrate if you're happy with what you've got. Controversially I'm also pleased about breaking changes if it means things get significantly better and there's less legacy to deal with. All in all a fast-paced ecosystem for a fast-paced world. I did seriously give it a try with elixir but felt I wouldn't appreciate it without dealing with js first, so it'll be something if I ever outraged with js, but between typescript, nextjs, jsx templates and all the excellent vscode tooling I'm happy. Infact much happier than dealing with Django's black magic.
- tartoran 4y agoHow’s the job market for elixir? It seems a lot of stacks are popular due to their employability.
- lawik 4y agoNot as straight forward as the massive languages as the pool of developers and work are both smaller. But remote EU or US is not very hard if you have some experience (Elixir or in general). Junior positions are quite uncommon and seem to require some hustle on the networking side. Market seems to be cooling a bit for consulting (I do that) as the economy makes companies more careful. None of the highly motivated Elixir devs I know are struggling to find work. Consulting/contract clients has been trickier lately but not impossible. Source: I help companies connect with Elixir devs as a specialist recruiter. And I do contracting/consulting. Feel free to ask questions here or via contact through underjord.io
- e3bc54b2 4y agoTangential, but what's the best way to get Elixir dev environment with database on Windows? A friend and I have been trying it for a project and for a NixOS dweller like me it was less than 2 minutes of work. But for her it has been never ending troubles. Otherwise, Elixir and Phoenix are fantastic! No explicit JavaScript is necessary and that alone sells it for me, but the concurrency story is so easy to grok that I'm amazed nobody else managed to recreate it in so many years..
- conradfr 4y agoIt used to work on Windows but for some reasons nowadays I get trouble to make Elixir works with the OTP version the installer gets. I couldn't get Elixir 1.14 to work in September actually and reverted to 1.13.4, maybe I should try again.
- josevalim 4y agoMake sure you are also running Erlang/OTP 25. I will try to make this clearer in the installer!
- conradfr 4y agoFirst, part of my confusion was that the installer effectively asks your OTP path but I think it used to actually install OTP? So I didn't read the dialog carefully and didn't realized it changed, my bad :) But, after installing Elixir and pointing it to the otp 25.0.4 folder. > elixir -v > Cannot find file at 'c:\program files\erl-24.0\erts-12.0\bin\erl.exe' c:\program files\erl-24.0\erts-12.0\bin\erl.exe). This usually indicates a missing or moved file. I install erl-24.0 > elixir -v > Could not load module C:\Program Files\erl-24.2.2\erts-12.2.1\bin\erlexec.dll. I install erl-24.2.2 > elixir -v > {"init terminating in do_boot",{undef,[{elixir,start_cli,[],[]},{init,start_em,1,[{file,"init.erl"},{line,1191}]},{init,do_boot,3,[{file,"init.erl"},{line,889}]}]}} init terminating in do_boot ({undef,[{elixir,start_cli,[],[]},{init,start_em,1,[{_},{_}]},{init,do_boot,3,[{_},{_}]}]}) All the while erl-25.0.4 doesn't seem used (while being in the PATH env), I guess that's the problem but how do you enforce the OTP version? ---- edit: So I kinda made it work. First I noticed that I had erl-24.0 installed by Chocolatey (which I don't remember using ahah) so I uninstalled that. To make it clear, I'm on Windows 7 so the problems may come from that, but maybe it will help somebody else. But then the elixir-websetup.exe (2.2) would not actually complete any longer (while doing so when erl-24 was installed by Chocolatey?), it could not find the actual elixir downloaded installer in C:\<Me>\etc (not the valid user path in Windows 7 but maybe in 10+ ?) I then used elixir-websetup.exe 2.1 and got almost the same error but this time it complained about "elixir-v1.14.1 (Erlang/OTP 25)-setup.exe" while it actually downloaded "elixir-v1.14.1-setup.exe", which I was able to launch myself and finish the setup. And voilà, Elixir 1.14.1 ;)
- mungobungo 4y agoPractical question here. How are Elixir/Erlang apps being deployed nowadays? My understanding is that BEAM is designed for long running setups where hot reload of the code makes sense, and reboots are not happening that often thanks to the supervision trees. But practically speaking how does it work under k8s env? When pod is being destroyed, what happens to all the messages sitting there? Pushing state out of actors is a possibility, but isn’t it ruin the whole idea of stateful actors ?
- egze 4y agoJust to make it clear: you don't have to write stateful apps, just because you can. It's still possible to have the more traditional stateless model like Rails. If you do write a stateful app, and run it in k8s, you can have state handover to a newly created pod. It works pretty well.
- mungobungo 4y agoWell, let’s assume we are talking about a webshop. Every user is represented as an actor, a cart might be a state. So cart as a state should be stored somewhere else, let’s say redis. And every single read/write operation would be a network hop. What are the benefits of using actor model then ? As for state handover between pods - what are the keywords to look for ?
- conradfr 4y agoYou're not forced to make your user an actor just do it the "regular" way.
- ramchip 4y agoWhat you describe sounds more like Orleans grains. Erlang's lightweight processes serve a different purpose than actors or objects, they're really about fault tolerance. A typical Phoenix app spawns one process for every HTTP request, websocket channel, or DB connection, for example. All these things have a lifetime shorter or equal to the pod's. The VM gives guarantees and tools to ensure one of these process crashing will not affect the others, unless you want it to. For instance, if a request crashes, its memory will be reclaimed, open files will be closed, DB connections will be re-opened, the exit reason will be logged, error metrics incremented, etc. This is possible with no defensive programming like try/catch and so on, because the processes are isolated. For example they don't share memory, so it's always safe to deallocate something if its owner process died. This gives a two-layer safety net that allows for very reliable apps, where the VM protects you against bugs in your own code, and Kubernetes protects you against bugs in Erlang, or really catastrophic failures. There's a good blog post on this: http://blog.plataformatec.com.br/2019/10/kubernetes-and-the-erlang-vm-orchestration-on-the-large-and-the-small/ http://blog.plataformatec.com.br/2019/10/kubernetes-and-the-...
- Joel_Mckay 4y agoVery nice, the world needs more people to write in Elixir/Erlang, and escape the polyglot hell the cloud shift incentivized.
- markm208 4y agoI am the author of the tutorial. I created a tool that captures keystrokes and file operations in a popular editor and allows them to be played back in a browser. The author can then add a narrative as the code evolves with text, pictures, and videos. I have more 'books' on C++, python, SQL, web dev, dart/flutter, clojure, ruby, and more: https://markm208.github.io/ https://markm208.github.io/ I use these for the programming-focused cs courses that I teach instead of having the students buy bloated textbooks. The students prefer them to books (no surprise) and videos (somewhat surprising). The code is searchable and copy/pasteable so the students actually use it. The tool is free and open.
- pjm331 4y agoawesome work - will definitely be checking this out not surprised that this is more popular format than textbooks and videos
- warpech 4y agoI love it. It is an interesting twist on the literate programming idea. Congratulations on designing and developing the system, as well as pouring such a high quality content to it. I can see the code of a book on GitHub[1]. It seems that the data of a single chapter is crushed in a single JS object[2]. Is the chapter data manageable in some text format, or is it only through the GUI presented in the docs[3]? [1] https://github.com/markm208/exbook https://github.com/markm208/exbook. [2] https://github.com/markm208/exbook/blob/master/chapter1/01/js/loadPlayback.js https://github.com/markm208/exbook/blob/master/chapter1/01/j... [3] https://markm208.github.io/storyteller/index.html https://markm208.github.io/storyteller/index.html
- dy 4y agoThis is such a cool tool - I worked in coding education and always loved tools that let you playback/annotate code. Thanks for posting!
- djaouen 4y agoI have been on again/off again with Elixir for the past ten years, and I can imagine that the upgrade path between Phoenix/LiveView versions would be a pain for orgs that adopted Elixir early. I am not sure how Rails handled breaking changes (as I was never a Rails dev), but I think the rate of change is somewhat problematic if one were to adopt Elixir (and Phoenix/LiveView) today. Hopefully, this will change over time. Edit: and especially with the release of LiveView 1.0.
- josevalim 4y agoElixir has been backwards compatible since v1.0, released more than 7 years ago. Phoenix has also been API stable for a similar period of time and Ecto for 4+ years. LiveView has changed over time but that’s precisely why it is on a 0.x release cycle. Even then, we do our best to deprecate first whenever possible. But the goal is that established projects have been stable. In any case, LiveView is nearing 1.0 now, which makes us comfortable enough to promote it as part of the default Phoenix experience.
- djaouen 4y agoThanks for the reply, José. I think the bigger problem with Elixir is the smallness of its community. There were several libraries that I started using (for example, Gringotts) that were actively developed for a while but then died off and nobody picked up where things were left off. Unfortunately, I am not skilled enough to put forth contributions myself (aside from the occasional bug report). But once LiveView hits 1.0, I think that if the community continues to expand, Elixir has an even brighter future. Thanks for all your hard work making it possible! :)
- lock-the-spock 4y agoVery nice tutorial. But what I'm missing here and for many other similar ones isthe "why" question. Great that it is a functional language with immutability but what can I do with it? Please give me some example of what it does, how I can use it, how within a few minutes I can create something that works and is useful, ... Is it for web programming or a service or a backend or ... Don't tell me I'll love it because of some programming feature. Make me see why I would love it by showing me how cool it is !
- djfobbz 4y agoDoes anyone have detailed instructions on how to get Erlang Observer up and running on WSL/Win10? This has been my biggest gripe since I started learning Elixir. I love everything about it expect why isn't there a web-based observer for folks not using MacOS? Having to install all this JVM stuff to make it work gives me a severe headache. I've already looked on Google and didn't find anything with the level of detail that I was looking for. Someone please help!