4 ms·
I use Phoenix with all my newer projects. The performance is stellar. I single-handedly was able to create what many startups out there have built with 100s of
by neya 9y ago
I use Phoenix with all my newer projects. The performance is stellar. I single-handedly was able to create what many startups out there have built with 100s of thousands of engineers[1] in a short period of time. This may be possible with Rails too, but then, I found a lot of things are much more convenient to get done in Phoenix than in Rails - For example, Contexts (nested models), Routes, etc.
When I started with Phoenix I was anxious that the experience was going to be just like when I first tried out Play/Scala, but no. To my surprise, my experience was fantastic. Truly, this framework allows you to focus on your business problems rather than fighting with configurations/conventions.
One of the best decisions the team has made is introducing the concept of contexts from DDD[2]. Initially, I was pretty confused, but now, I simply cannot imagine myself going back once that I've understood it. It's basically breaking down your business into smaller tiny modules, like I've done in [1]. The other thing I love about Phoenix is the concept of umbrella applications. I'm not sure if Rails has an equivalent, but I think this alone is worth exploring Phoenix for.
I don't even have micro-services in my architecture yet, but because of these patterns, I'll be able to break out and scale my application if I require to, in the future.
Phoenix has proven to me that it can not only scale performance-wise, but also architecture-wise. Last time I tried developing [1], it was in PHP and I had to hire 5 devs to get it done..6 months later and we still weren't done. However, in just a matter of weeks, I was able to finish a complete working prototype of this mammoth application, with UI and frontend. As for my production setup, I use Docker + AppEngine (using a custom VM) and it has served me really well. The performance is top notch and everything works so flawless.
As for the language itself, I really love Elixir. I simply cannot imagine going back. It really forces you to think differently about your code. Last time I tried to learn a functional language, it was Scala - also a beautiful language on top of the JVM. But, the problem is, it's so academic in the sense that even a good book on scala had 400+ pages. Some of them had 700+ pages. But Elixir isn't like that, you can pick up the language in a matter of weeks (YMMV, it took me 2) AND build a project in no time.
For Elixir, if you're coming from a Ruby background, you'll be able to pick it up fairly easy. However, you will find it challenging when you hit a situation where you would have used a traditional for loop, but in Elixir, you would be forced to re-architect your code. And that's a good thing.
[1] https://news.ycombinator.com/item?id=14785209 https://news.ycombinator.com/item?id=14785209
[2] https://martinfowler.com/bliki/BoundedContext.html https://martinfowler.com/bliki/BoundedContext.html
- dvlsg 9y agoInteresting. I've been trying to decide which language to learn next. Between Scala, elixir, and haskell at the moment. Was leaning Scala, but all the praise here is starting to convince me to go elixir. What problems did you run into with Scala?
- neya 9y agoIn Scala, there are many ways to write a function. I wish I can share some code snippets, but, I'll just summarize for the sake of simplicity: 1) Functions have different forms and even nomenclature based on how many parameters they accept, how they are represented, etc. 2) Scala still has OO, which means it needs to carry a lot of baggage. The breadth of Scala's nomenclature combined with OO will take you a long way to learn the language. 3) Scala still runs on JVM which means you need to learn some of the JVM concepts if you'll be using it in prod. If you're from a Rails background, this is completely a new arena, because this is usually the Java guys' arena. 4) I wanted to be able to simply open up the source code and be able to understand what's happening. This was possible in Ruby/Rails, and ultra easy to do in Phoenix/Elixir, but painful in Play/Scala. IF you open up the source code of a Play! framework project, there's code so succinct that you would need to be strong with the language's understanding to get the full picture. Case class, implicit, etc., just to cite a few. In Elixir/Phoenix, it's just modules and it's just simple, yet elegant. 5) That being said, it's still good to learn Scala because there are tons of libraries out there with special use cases which you can use Scala for - It's still a good strongly typed language to build a robust project on. IF I remember correctly, David Pollak mentioned in his book that he'd written an app in Scala that ran for years without any problems. As for Haskell, I read this somewhere - "Haskell is nice and all, but it's no Erlang." Since Erlang also has a bit of a learning curve, the next best alternative is Elixir. P.S, - languages should be chosen based on one's own philosophy and in this case, Elixir strongly resonates with my own philosophy and all this is just my own opinion on why I chose it :) Cheers.
- bostonvaulter2 9y ago> I wanted to be able to simply open up the source code and be able to understand what's happening. This was possible in Ruby/Rails, and ultra easy to do in Phoenix/Elixir While it is possible to look at source code in Ruby/Rails, in practice for me (even after a few years of production ruby experience) it was extremely painful to look at any number of libraries due to the amount of redirection and implicit state, and monkey patching. But Elixir has (almost always) been VERY easy to follow, sometimes the code is just so simple.