Hi everyone!
Over the past months, I have worked on backend specifications for a personal project. I must now choose the framework Iโll be using.
...
For further actions, you may consider blocking this person and/or reporting abuse
Quick answer, because Go is better.
It is just me or all your needs are met by Go? You do not need a framework, making backends is very easy.
Server intro example
It's low level so your future hardware control should be easy to add.
Scalability is one of the key factors of Go
Testing - it has builtin unit testing and benchmarks tools
Large amount of data & performance - see 1M requests per minute with 2 servers
Reusability - the languages enforces the usage of small packages.
Continuous integration - yes. It's light, you do not need a container, you will have only 1 binary file
templating - it has a builtin simple template system
You will learn it fast.
Hi Adrian,
Thanks for the sources, they are very helpful.
I am currently interested by Golang and the performance that it provides. To be honest, I love how so easily the language deals with stuff like routine, code coverage, cross-platform development, etc.
Nevertheless, I am a little worried about two things that slows me a lot to choose this language : dependency management and the project's files structure. I know that
dep
is in the good way but I am used to Maven and its stability, soit frightened me a little. About the files structure, I don't want to mess with packages arborescence and I didn't find a good example of file structure on the web yet. :/
Thanks for your reply !
Hi, the official dependency management is almost launched, see here.
The structure I find to be a plus, packages == your business logic == your structure. In Php/Ruby etc you have to obey a Frameworks structure, not your business one, which I think is a big flaw.
repo/user/project/
repo/user/library1/
repo/user/entities/entity1
In addition about the lack of dependency management, I would say that it frightened me because Go provide a large ecosystem that contains certainly all my needs (OAuth2 provider, GraphQL implementation, etc.). So, if my system have to be based on other's work, I really want to have a good and stable dependency management. :)
RoR is great to get started. It allows you to make great progress quickly, and get a service up and running in no time. It can save you a ton of time and money. However, since you are asking "why not," here are a few major pains:
That said if I was starting a project I'd probably choose RoR. It gets you started and going quickly and you can worry about scale to the next level when you get there. At that time, there will probably be something new and better anyway.
And #4 is currently what perplexes me! SOOO much magic. I'm in bootcamp right now, and the curriculum is fine. Actually on my first Rails project. However, my brain can't deal with the magic at times and it's slowing me down! I've had people tell me to look at GO (like many folks in here), but I really do want to understand Rails. Maybe I just need to walk away from it for a while...
They call the pattern "convention over configuration". You could name it "magic over logic", but that wouldn't sound too good :-)
The major issue I have found is that when something is magical, the way the magic works can change over time, and there is nothing that tells you. That is one of the reasons why upgrading to new versions of Rails is never too easy.
(had profile issues, but it's me!) Thanks! I actually like "magic over logic". It's a good band name - but also very true.
It is a good band name, isn't it? :) Also, it the domain name is not taken :)
It didn't take very long :)
:kaff:
I wondered if you were going to see that! LOL. Just know it's in good hands! Thank you so much for the idea. I feel like we could make a twitter account for it that....oooh. Give me a sec. I feel a project coming on!
Haha, that's cool. When you bring up the side just consider adding a link to my blog somewhere. That's all I ask :-) ;-)
Will definitely do!
;-)
Hi Lorenzo and thanks a lot for your reply !
When I posted this post on dev.to, this is the type of answer I have expected :)
I didn't know that Ruby and RoR were slow !
About your last sentence, I'm also reading about GoLang to see if it can be a good choice. I didn't find a good framework yet but it seems like the ecosystem contains a lot of modules that can be used to build backend services. Any idea about this language ?
GoLang is new(ish) compared to other languages. It was developed by Google and it is quite low-level. It is very fast, mostly because it is a compiled language that compiles to native code.
I don't have any direct experience with it, I only worked with it for small experiments. I am aware of the existence of a framework called revel, but I don't have any direct experience with it.
I also heard people say that you don't necessarily need a framework with Go, because it was created with modern Web development in mind. Here is an article on the topic.
If I had to start a project I'd choose Ruby on Rails if I want to get something running quickly. I'd choose GoLang or Java if I wanted something fast that can scale well.
That said, note that there are several very large websites built in RoR (including GitHub). So, it is possible to do it. It just takes some work a good design. Another example is dev.to itself, that is also built on RoR, and it is nice and fast.
Hi Sylvain - integration with external services and 3rd party APIs is something that's a strength of Ruby/Rails that's often overlooked when people are comparing web frameworks.
Browse rubygems.org to get a sense of the size and scope of the contributions made by the community. As your app grows and you look to connect with other services for authentication, storage, monitoring, etc... you'll find that someone has already written a gem for that service resulting in less code that you need to implement.
I won't lie, this can lead to dependency hell if you start adding others to the dev team. But in the long run you're still more productive than writing everything from scratch.
or you could just start with JRuby from day one :-) i.e. have your cake and eat it too
Yes, starting with JRuby is a good strategy as it allows you to write parts in Java, if you need the speed. You give up compatibility with some gems, but if you start that way it should not be a huge deal. Regardless, it is still slower than other technologies and you have to deal with Rails, which is still heavy (but things are getting better overtime.)
Rails is quite modular [0], [1] - one can easily strip the heavy parts or replace ActiveRecord with Sequel; bonus: with concurrent-ruby [2] things get fast real quick.
[0] - modular Rails controller
[1] - modular Rails
[2] - ruby-concurrency gem
It is definitely improving. Version 5 is quite modular. It is a new(ish) thing and it has indeed changed the game quite a bit. Before version 5 it was just mostly a big fat thing :) It has been a slow progress, and I hope they don't screw it up. The unfortunate way they tend to deal with backward compatibility is still somewhat of a concern, but maybe they'll figure it out. If one is willing to always upgrade to every new version religiously, then things get easier. The major problem I have seen is when people stop keeping up.
Threading in Ruby is not real parallelism. Also, most gems out there are not thread-safe, which makes it difficult to work with threads in Ruby.
That said, I am far from being bashing Ruby on Rails. I have been coding in RoR for 10 years, and I like the framework. One just needs to be aware of the tradeoffs and cost at scale. I have been through that pain with versions 2, 3 and 4 and it wasn't fun :) Version 5 promises to do better, but I don't have much experience with it yet.
Iโve been working on a system built with Java Spring for the past 2 years
Stick to what you know. Use Java Spring.
I say this as someone who does not like to touch Java and uses Rails for a living.
The no.1 thing that will kill your project is not language/framework slowness, but messing around with tools instead of shipping software.
Hi Hrishi,
This is a side project that I work on my free time. So, I have the time to choose, try and learn the most adequate language for my project. :)
But yeah, you are right, if a project need to be shipped in a short time, I would rather use Java Spring to avoid messing around with tools !
Thanks for your reply !
Ah I see. If you want to explore, then go wild! I'd say try Node as well as Rails.
Basically you recommend the "when you have a hammer everything looks like a nail". Not a good approach for professionals.
Anyway Java can do web services, but shouldn't.
Or maybe because both Spring and RoR are swiss knifes, not hammers. Both perfectly valid for the task.
Have you had a look at Phoenix/Elixir? It checks off many of your boxes. When I was hunting for a framework I had criteria very similar to yours, and I ended up with Phoenix/Elixir.
Here are some interesting links to check out:
Phoenix/Elixir Overview
Pinterest re: Elixir gains
Bleacher Report 18 months in Production
Moz.com use
I've been developing side projects with Phoenix/Elixir (and Vue) for about a year now...happy to connect if you're interested in delving any further. My projects are smaller and don't yet have the scaling requirements, which is why I included those links above as those companies are using it at a much larger scale in production.
Unfortunately this requires a shift in programming paradigms, something that will severely slow most developers. The framework is new-ish as well and support (e.g stackoverflow answers) is still not up to par with RoR.
I'd argue it is not worth it unless the author really needs to scale his application.
Otherwise, I agree, Phoenix is an amazing framework!
If you want to delve in Ruby/Rails performance I would start here:
Scaling Ruby Apps to 1000 Requests per Minute - A Beginner's Guide
Is Ruby Too Slow For Web-Scale?
Obviously each app has its own requirements, traffic and consideration but one thing I've learned over the years in web development is that Donald Knuth's "premature optimization is the root of all evil" still holds ;-)
Start with what you know. Analyze each requirement and see if your platform of choice has all the tools and the libraries you need. Also consider if the app is going to be developed by you or a team of people and so on.
Finding people to help you with Java or Ruby is way easier than finding talent in Elixir.
As with most "is this better than that?" questions the answer is almost always: it depends.
Hi,
Thanks for the links, I will had them in my research ! I know that optimization is evil when we start to develop a project. But like others said in their replies, if the language and/or the framework are slow, optimization will be needed earlier than with other languages.
About the question "is this better than that?", it was the first title of this post. I thought that it wasn't the good question. Then I asked myself "Why do you want to compare Java Spring with Ruby on Rails?" and I knew that it would be a debate that I had already read on the internet ! ;) What I really wanted to know is the experience of others about this language : why they left it or why they chose it. I'm glad to see that the community bring me a lot of answers that I didn't find on the internet before. :)
Thanks for your reply !
No worries.
I think it's important is to find the balance between speed of development, time to market and available skills. If it takes you double the time to develop in Elixir instead of Spring and then you have a system that only you can work on, the "superior speed" might not matter.
That's my point, sorry if it wasn't clear earlier.
From what I've read it seems that most large companies have more than one application component in their stack. For example twitter uses RoR for its frontend but the API is written in Java/Scala (using finagle framework IIRC).
To me it sounds like one of the major deciding factors will be the ability to process large amounts of data. The only two languages which I can think of that have a proven track record for this is Python and Java. I don't recommend going with something risky like Go or Elixir for a project that sounds fairly large.
Do you have sources that explain how they manage their stack of applications ? I would love to see how those companies deal with differents runtimes ! :)
And yeah, I know that Java can deal with a large amount of data but I don't want to be stucked in a language that I choose because I know it. ;)
Thanks for your reply !
Their setup is pretty complex to say the least. IIRC they're using puppet, mesos, etc as part of their infrastructure.
If you're looking for how to manage this on your own project I recommend just learning a configuration management tool like ansible, saltstack, puppet or chef. I personally prefer ansible.
I didn't know the existance of that kind of tools! I will take a look, thank you. :)
Its a bit like a script runner. For ansible its just a YAML configuration and setting it up is pretty simple. You just need ansible of installed on the machine you're executing your "scripts" (they're called playbooks in ansible world) from and ssh configured for all of the servers you want to automate.
Because Ruby is wacky? :) (sorry, personal distaste for Ruby :p)
But you could try Grails as a mix of both worlds: inspired by Ruby on Rails, powered by Spring Boot, in active development since 2005, uses Groovy as its language (Groovy is like injecting Ruby mojo into Java).
I've completed several projects with Grails and while I'm increasingly using micro-frameworks lately for web, Grails is still a very fine framework.
Hi Gregor,
I will take a look on Grails to see how it works ! I already tried the Kotlin implementation for Spring and it was very cool to use :) Nevertheless, I don't know if Grails is similar to Kotlin...
Thanks for your reply !
Grails is a framework while Kotlin is a language so you can't directly compare them.
You can compare Grails vs. Spring Boot (regardless of the language in use, and you have quite a few to choose from) in which case Grails is a more opinionated, convention-over-configuration framework with lots of helpers, integrations and concepts that would be left for you to implement on your own in Spring Boot. It has, for instance, its own persistence framework, based on Hibernate down below but looking a lot more like Rails' active record to the programmer. There's plenty more: centralized URL mappings, command objects, a service layer, HTML helper tags and JSON & HAL renderers come to mind first, but do take a look at the docs yourself (and the docs are pretty good btw, which is a huge bonus).
As for the languages, Groovy and Kotlin are loosely related; Kotlin actually took a few of its concepts from Groovy (as did Swift). Groovy is a bit wilder, optionally typed, script-like language, comparable to Ruby. Crazy productive! .. though sometimes its wild side is a bit too much. Kotlin on the other hand is strongly typed, with extra strictness added on top (e.g. null safety and immutable variables). Personally I prefer to use Groovy for scripting and the view layer, and Kotlin for the business logic.
Theoretically, you could use Kotlin to write Grails code, but it's probably not optimal because a lot of the Grails magic relies on Groovy's concepts.
I would go with RoR if Ruby was a statically typed language. As it's not I'm afraid that in most cases dynamically typed language can only be maintained (in really most cases) only by the developers who wrote the code.
Well...... I'm more a Java and Python guy but I'd be extremely pragmatic about that: Choose whatever you get along with best right now and keep open to re-evaluate a given framework decision. Yes you might hit a wall using Ruby. Maybe you might end up in performance pitfalls, you might see certain requirements (like low-level development close to actual hardware) difficult to meet in your chosen tools.
Right now, it seems you're mostly in a draft / design state of your project, and I dare to say that (a) Java/Spring or any other Java based framework and Ruby On Rails would be able to meet your current requirements and (b) you could spend a few more weeks or months evaluating your framework of choice and still end up with a decision that will fall over two weeks after your project went "into production".
I'd rather, here, follow the agile approach of getting a "minimum viable product", a working early version of your desired application, out on the road as fast and with as little effort as somehow possible (including effort for comparing or learning languages and frameworks), let it roll for a few days or weeks, learn how it behaves, learn which trouble you will run into and which requirements actually will show up. By then, step by step your product will grow and you also will get a better idea of which problems you need to solve (including performance and stability requirements). By then, you also will have a much clearer idea of what your "ideal" programming language, the "optimum" framework, ... looks like. ;)
Hi Kristian,
Thank you a lot for your advices !
I am more and more thinking that it is the right decision : make a choice and build a minimum viable product then test it.
Hi Faustino !
Thanks for your reply, I didn't know the existance of Crystal and Amber Framework. I understand that many of my project's needs can be reached with a lot of languages and frameworks.
However, I wanted to know why I shouldn't choose Ruby on Rails, not what framework I need to choose in particular. :)
To me, this is very important because I'm already proficient on Java with Spring Framework but I didn't want to stop me at what I already know so, I learned how Ruby and RoR work. What I wanted to know is the experience of others on this framework and this language in particular.
Could you give me some sources about known companies that works with those languages and what difficulties have they faced with those technologies ?
i see that both are "inspired" by ruby or RoR which means I won't have all the ruby gems (if i'm not mistake) and will not have all the RoR plugins... so i would still in that case unforutnately do the same and cannot go with them but prefer something more official which has more plugins like an official nodejs + typescrypt (because of the types in typescript) and then go with a major framework like angularjs/react/vue but this is only and only because ruby is not a statically typed language.
isrubyfastyet.com/
The benchmarks here are two years old man :x