11 ms·
Elm and Phoenix/Elixir in Production for France TV
- todd3834 10y agoThis was great to read and it inspired me to give both a try soon. Question: Did the app receive millions of visitors or was it basically 1 visitor with millions of viewers via the television showing a recorded screen? At first I thought Phoenix was used because of scaling reasons but now I'm not so sure. Either way, nice work and thanks for the write up!
- sotojuan 10y agoIn my experience, Phoenix is used because a) it's easy to get started with b) isn't a monolith like Rails (e.g. Phoenix could be one part of your complete application) but it has good conventions and c) it leverages the Erlang VM's performance and concurrency through Elixir. I know HN gets a lot of hype for X new tech every month, but I'm really liking Phoenix. Ignore the "Phoenix is the future/saved our lives/best thing ever!!" Medium posts and try it out. It's actually pretty good.
- matt4077 10y agoI'm enjoying working with phoenix, but when comparing it with Rails, it would be fair to say "it's basically rails" and add a few footnotes about the differences. People who started after Rails was released don't see it because they haven't seen how it was done before. But it's incredible how many conventions DHH created with rails that have since entered the basic repertoire of all web frameworks: migrations, its take on MVC, :belongs_to, the router DSL, the asset pipeline, generators – while you can probably find prior art for all of them somewhere, it's the implementation in Rails that, 10 years later, is still the blueprint for new frameworks. Rails was also the best teaching tool ever invented in the space. Code quality was atrocious, people were reinventing "clever" solutions for every project, testing was probably rare (I never saw it, but it must have been around, right?) I distinctly remember a templating system that turn .xls into a perl script that would write php. If you changed projects, you'd usually be greeted by a directory tree 8 levels deep with the main config.php in /[..]/tmp-2008_b, along with config.inc, main.html.php.old and construction.gif~2. (Not that Phoenix doesn't add lots of refinements that make it a pleasure to use)
- kinofcain 10y agoI'd add that Rails was also hugely influential in its focus on developer productivity. A lot of it was magic and incredibly difficult to debug or modify when it went wrong, but it raised the bar for how you market a framework to developers.
- brightball 10y agoYep. The Dev productivity area is where Rails really set the bar high. All the other "win the benchmark" stuff that everybody goes to to try to dethrone it is a fair example of people missing the point. :)
- brightball 10y agoFwiw, I'm writing a Phoenix is the Future post at the moment that I hope to publish in the next month. :) Might have to revise the title.
- Cyph0n 10y agoNice writeup. Elixir definitely seems like a solid language for web dev. For the frontend, I prefer Scala.js since I'm kind of a Scala fanboy, but I've heard great things about Elm. One little comment. At the beginning of the post, you make it seem like the app needs to scale with the number of viewers, when in fact it doesn't. I think you should clarify this to avoid confusion.
- weitzj 10y agoWe are doing a fairly large Elm app right now. And especially the refactoring reasons and static type system are appealing to us when you work in a team. Also being a functional language it is easy to crank out features in an afterthought, e.g. we added an Undo/Redo feature for operations the user does in this single-page client app. And being side-effect free this "merely" boils down in wrapping function calls in an "undo/redo" function. So Elm is really exciting stuff. But still the Api is not completely stable, yet. So you have to invest some time to adapt to these (small) Api changes. Also interoperablility with so-called "Native" JavaScript browser functions, e.g. JavaScript typed arrays is possible but not finalized, yet.
- Cyph0n 10y agoFrom what I can tell, basically all of the reasons you state for using Elm are also present in Scala.js.
- shados 10y agoElm has a sound type system, no compromise and is purely expression based. Scala, not quite. You can still have runtime exceptions in "normal" situations, you can still have statements that aren't expressions, etc. Scala gives you the options to do it right, but Elm enforces it. Heck, because of how the application type works, its pretty much impossible to make an Elm app that doesn't follow proper architecture. It just won't compile.
- Cyph0n 10y ago
- sotojuan 10y agoElixir and Phoenix are stable and by now they're a solid choice (more than enough warranted praise on HN), but I'm still skeptical about Elm from a "platform" perspective. From what I can tell, Elm apps are a single blob of JavaScript that either loads or doesn't (e.g. you can't read the Elm site without JavaScript enabled), while the JavaScript ecosystem is moving towards server-rendering, dead code elimination, and "progressive web apps" so to speak. PureScript for example has dead code elimination—you can make a <1kb PureScript "Hello World" app. I know the Elm team is capable of all of these—I just haven't heard of anything yet. While they're "nice to have" now, these features might become crucial and important. Another interesting thing about Elm is its progressive removal of features (I think the infix operator was or is going to be removed soon) in order to make the language more approachable. I actually support this because if you need "true" ML/Haskell features, there's PureScript. Anyway, glad to see Elixir and Elm being used productively!
- gotofritz 10y agoServer side rendering doesn't remove the need for loading js on the client.
- sotojuan 10y agoThe idea is to render as much of the app (usually the "shell" or the static content) through the server and then the client-side JavaScript takes over. As of right now support ranges from excellent (Ember FastBoot, out of the box), okay (React with some configuration), and nonexistent (Elm).
- matt4077 10y agoYou can do progressive web apps quite easily. Your Elm code is included as always with <link..> and you pass the id of any container to initialize it. The container can be <body>, but you can just as well attach to some <div> in the footer and the rest is rendered independent of Elm. Regarding dead code elimination: yeah, elm doesn't do it yet. But the code generated by elm-make is very predictable and therefore easy to process. I just tried uglifyjs: raw elm-make output; 196kb uglifyjs -m -c: 68kb tar czf: 20k The inventor of elm is very deliberate in the project's development. I believe his argument is that including dead code elimination now is premature, because it adds a lot of maintenance work, especially at a time where the language is still evolving. Once the raw js is no longer a moving target it shouldn't be too difficult, and until then uglify and similar do a good job.
- deleted 10y ago[deleted]
- Ericson2314 10y agoDamn, look at this European protectionism /s. (I'm a functional programmer, so yay for them!)
- qaq 10y agoHave not had time to try Elm yet but Elixir is such a pleasure to use, it's painful going back to JS :)
- comboy 10y agoHopefully something grows out of https://github.com/bryanjos/elixirscript https://github.com/bryanjos/elixirscript so far it seems very actively developed.
- qaq 10y agoYep hope it becomes production ready at some point, but you obviously will loose isolation and all soft real time properties when running transpiled JS.
- bryanjos 10y agoIf issues such as source maps are figured out, I would feel better about people using it. Also, I would like to work on its user friendliness. Saying all of that, Elm is pretty nice and I really enjoy using it for some of the same reasons I enjoy Elixir.
- noam87 10y agoIt really is. We're rebuilding our entire backend in Elixir and it's just been incredible every step of the way. I can't recommend it enough. The language and ecosystem are an amalgamation of industry lessons from the past three decades on what it takes to build robust networked applications. It's the most painless programming experience I've had. These days other languages feel like museum pieces when I have to jump back into them. Not to mention being able to run dozens of services, background jobs, and API in a single box as one "umbrella application"!
- jbeja 10y agoWhy mix a dynamic language with a statically typed one? I never understood this pairing this mix.
- leshow 10y agoI hope Elm doesn't get too closely tied with Elixir. It's a great language no matter what backend you choose.
- brightball 10y agoMost people seem to be coupling the two together based on getting into functional programming. It also doesn't hurt that the Daily Drip, a great Elixir "Railscasts" clone also has a section for Elm.
- sotojuan 10y agoI also don't get why they're coupled a lot... they're very different once you get past that they're both "functional" (and Elixir really just has HOFs and immutability by default, it's very practical). If it makes you feel better, I only see this coupling online. Most people just use server-rendered pages or regular JavaScript.
- s_kilk 10y agoIt's really just a weird overlap in the communities. There's nothing tying Elm and Elixir together aside from the anomaly where many people who started experimenting with one also started experimenting with the other.
- qaq 10y agoI see a lot of interest in Elm in Elixir community but if you take actual production projects written in Elixir very few use Elm on FE.
- ggregoire 10y agoEven if you don't like JavaScript, it's really surprising to me that a CTO picks something like Elm that nobody uses and only a few know or are interested in [1]. I'm curious to know how the author will recruit developers, specially in France. My last company migrated all its backend in Node this year, ONLY because it was the easiest option to recruit full-stack developers. The market is completely saturated here (there are a lot more offers than developpers), you spend months to recruit a front-end developer or a full-stack developer with front-end knowledge, and I don't see how you can attract someone with Elm. Having 1 or 2 years of xp in Elm on a resume is not really usefull when all the companies use JavaScript. You don't even know if Elm will still be there in 2 years. [1] http://stateofjs.com/2016/flavors http://stateofjs.com/2016/flavors
- biot 10y agoIt's no different than listing a Java job vs listing a Scala job. There are many great developers who would jump at the chance to be hired to write Scala (Elm), so you might just end up with better developers who self-select to work on the shiny, new technology.
- bjz_ 10y agoAs he said, it was going to be used live and he wanted to be sure that it wouldn't blow up on set, whilst still allowing for rabid development in a small time window. Seems like a perfect use case.
- di4na 10y agoRecruti someone that do not know it and teach. It takes at most a week. And probably productive in a day.
- polotics 10y agoAre your statement not a tad bit prejudiced? How is Elm a Javascript flavor? it's not surprising that it gets a bad rap from a stateofjs flavors survey. Elm is very much a competing language and ecosystem, it happens to be much better. I am certain I will still be interested in elm two years from now, the productivity gain is there to stay.
- rhlala 10y agothe guests were Nicolas Sarkozy (12 millions viewers), Arnaud Montebourg (9 millions) and lately Alain Juppé (13 millions). I would like to see the results of the two other guests.
- conradfr 10y agoThere has only been three shows so far IIRC.
- kevinastone 10y ago> As a business owner/recruiter, I wanted something with a low entry barrier for my future hirings. Elm has a low entry barrier, the JS ecosystem/fatigue/mess doesn't. This is nonsense. There's a much greater pool of talent familiar with javascript than Elm. Using Elm might be marketable ("come work with Elm here!"), but it's a riskier bet for a developer given it's relative immaturity and adoption.
- sotojuan 10y agoAt this point the "come work with Elm" only works at places that have long-term Elm experts and fans (e.g. No Red Ink which hired its creator, has their lead evangelist, and probably more than half the top Elm people in the world).
- deleted 10y ago[deleted]
- mattetti 10y ago> Elm has a low entry barrier Sorry Vincent, you lost me there. Elm is interesting for sure, but it's far from having a low entry barrier. Something has basic has having a button play a sound takes forever to figure out. You almost have to learn everything all over again. It's a cool project and I'm glad it's working out well for you, but Elm has a serious learning curve.
- not-much-io 10y agoJust my 2c: Paradigm wise: Yes functional programming can seem strange and hard if you haven't done it before. But that really isn't the fault of Elm, elm makes FP as simple as it can. Language wise: Yes, the Elm architecture takes a bit to grok, but for me it was just an afternoon. Once you grok it, there isn't really much else you need to learn - you can hit the ground running, look up what you need when you need it. Tooling wise: Just some basic tooling you get will get you very far, no setup either, just install and use. If you do js interop, yes that can be cumbersome, but it is intentional. Elm strives to keep js out and write libraries in Elm. This is so we can have more of the guarantees that Elm provides. (no runtime exceptions!) I'd rather say: "Elm has a low entry barrier for a FP language". One of it's main goal is to bring FP to the masses after all. :)
- leshow 10y agoElm is one of the simplest languages you will ever stumble across. I realise the simple is subjective, but you must be having some kind of mental roadblock, because it really does almost ALL the work for you.
- dvcrn 10y agoSo I saw Elixir+Elm, Elixir+Elixirscript, Elixir+Scala.js here so far. Chiming in with Elixir+Clojurescript. It's what I've been using for most of my projects these days and absolutely love it. Pure functional programming on both, server and client, with the server concentrating on well distributed concurrency and parallel processing with GenServers and the client on immutable front-end code while using Go-blocks for async stuff.
- conradfr 10y agoAs a French trying Elixir these last few months (don't have much time for Elm) it's great seeing the language picking up some hype. At work I don't see it happening though, we're a PHP shop now addind nodejs (to my despair) and maybe some Go. I think there is a Haskell fan and that's it.