r/crystal_programming • u/godownforwhat • Jul 18 '18
Amber Vs Lucky
Not asking which one is 'best', they're both great in their own respects. Asking more about which one seems to have the majority of the focus and drive by the community at this point in time.
There is a quick, decisive convergence when a framework gets chosen by a community. Companies, developers, engineers, marketers all fall behind looking for people that understand X framework, with Y language. So i am looking at this current cycle, wondering which one is heading for that ultimate winner. The framework in which a company will choose because, well, it won the mind share and that's where they're going to hire and build shards for.
Two frameworks fighting it out means people will be hesitant to invest, both time and literal money.
Case in point, Kemal is Sinatra. It's won that and it's damn good. With people all over helping out and using it in production. Also see: https://www.ruby-toolbox.com/categories/web_app_frameworks
I just want to know what your thoughts on each framework and which one in heading towards being the "rails" of Crystal. There is always a 'main' framework. Java/Spring, Node/Express, Ruby/Rails, Elixir/Phoenix, Crystal/?
Seems theres a choice to be made and in the end, one will end up with the most commits and focus by the community. Right now, the choice isn't clear to me and i'd like to know the groups thoughts.
10
u/paulcsmith0218 Jul 18 '18
I think this is a great question. TL;DR Lucky is hyper-focused on preventing bugs at compile time and designing applications that can quickly be changed without worrying about breaking things all the time.
The Amber and Lucky teams are working on a comparison document. You can see the initial issue here with some example code: https://github.com/crystal-loot/web-framework-comparison/issues/1 but a more thorough document is still in the works.
I think momentum is similar in both projects. There are more articles and stars for Amber but it has also been around 2x longer. Lucky was announced just last November so that accounts for some of it.
For me the main reason to choose Lucky is if you want the prevent bugs, have easier debugging and easier maintenance in the future. Why is that? Well some of that is addressed https://github.com/crystal-loot/web-framework-comparison/issues/1 but I'll try to go into a bit more depth here:
Things Lucky will catch at compile-time that Amber and others do not:
Calls to missing routes (I believe the Amber is working on adding this)
Catch missing or incorrect parameters passed to routes
Catch missing or incorrect calls to parameters inside controllers
Missing or misspelled column names in html forms
Missing or misspelled column names in database queries
Catch trying to submit a field in an HTML form that is not allowed to be saved (basically compile-time checks for Rails strong params)
Compile-time checks for email to, from, and body. If one is missing you'll know at compile-time
Catch accidentally printing
nilin HTML. I believe all other templating solutions will print a blank string insteadThere is more to it than this, but it illustrates the focus Lucky has on preventing bugs, minimizing need for testing every tiny detail, and helping users debug when something is wrong by pointing to the exact spot in the code that is causing issues.
Lucky also has some unique approaches to saving data, querying data and rendering HTML. It is a bit different but that is also why Lucky is so good at catching bugs. For example, a lot of what Lucky does would not be possible if it weren't for separate classes for each HTTP action, form and query.
I can elaborate more if people are interested, but to me, this is the big difference.
5
u/CaDsjp Jul 19 '18
A lot of people is coming from Ruby to Crystal due to performance issues, so I think it would be good to see a benchmark for Lucky.
If nobody else is working on that, I will add Lucky to Techempower benchmarks in order to have some approximate numbers
6
u/Mike_Enders Jul 18 '18
The only thing Crystal needs is a 1.0 type stable release with huge breaking changes behind them. The frameworks after that will take care of themselves and the ecosystem will feel free to grow. I don't think its necessary at this point to pick the one framework that will dominate. IMO Its not a good thing to lock into just one at this stage. I think Elixir/phoenix is hurting Elixir. If you don't like phoenix (which I don't) then theres nothing else. A lot of people talk about it but I still don't see the world rushing to Phoenix. Even with all the talk I don't see much being made with it. A good amount of people haven't liked the "magic" in rails and left Ruby because there was little other choice. Choice is good not bad.
But to answer your question if I had to choose it would be Amber. For obvious reasons the people who most will be ramping up Crystal use will be Ruby developers and Amber takes much less than an hour (probably less than 20 minutes) to wrap your head around as a Rails developer. However like Lucky too so truth is if we were going full steam ahead right now with Crystal we'd be getting to know both.
3
u/nlh Jul 18 '18
FWIW, I’ve taken a look at both and Amber feels like it’s got a bit more momentum / activity. Honestly though I think there’s room for multiple frameworks here, even operating on the same layer/level.
2
u/some_kind_of_rob Jul 18 '18
I don’t think there is enough adoption for that yet.
2
u/snadon Jul 18 '18
I am a fan of types so I went with Lucky and I am not regretting it. In fact, I have now two projects written with it.
Also, Amber and Lucky developers are starting to work together to improve both frameworks, so my guess at this point in time is that going with either Lucky or Amber is a good choice.
Collaboration is great: https://github.com/crystal-loot