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.
On the one hand, I’ve been working on a system built with Java Spring for the past 2 years, and I have been wondering if knowing a technology is a good enough reason to chose it over other languages and/or frameworks. Still, I know that Spring is stable, fast and adapted for big project and can save me a lot of time.
On the other hand, I know that some big companies use Ruby on Rails to build their services (like Gitlab, Airbnb, 37 Signals, etc.). From what I know, RoR seems to be a stable and strong framework.
I looked at some benchmarks between those two on the net (links at the bottom), but I find myself more lost than I was previously.
Here’s my question: Why should I not choose Ruby on Rails ?
Here are my project’s needs:
must deal with a big amount of data and entities
will connect with a GraphQL API (more than 70 endpoints)
public and private endpoints over HTTP and HTTPS
OAuth2 authentication provider
probably a few WebSocket endpoints too
For me, this framework choice is very important because it will help me decide what language I need to use to make internal and external services around the final product. For example, if in the future I need to make a program to control hardware or device like printers, I will use the same language I used to develop the backend in order to make maintenance easier.
I know my question isn't very specific so maybe a list of features I’m interested about will help:
maintenability: code quality, number of line of code
reusability: make the code more modular, generic
performances: HTTP(S) request (JSON or HTML responses), databases
templating: what engine can I use (what is the best ?)
unit testing, code coverage and Selenium test
scalability
continuous integration
Some benchmarks found on the web :
Credits :
- cover image from perfectial.com
- A great thanks to Thierno which helped me to review this article <3
Latest comments (46)
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.
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 ?
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.
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.
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.
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.
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.
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.
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.
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.
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. :)
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
depis 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
isrubyfastyet.com/
The benchmarks here are two years old man :x