INTRODUCTION (skip to the Spring section if you are not willing to read about my past experience)
The web offers dozens of full stack web application frameworks for any language. In the last 10 years, after Ruby on Rails came out, all of them evolved into something which greatly boosts developer productivity, like Symfony and Laravel for the PHP community, Play and Grails for the JVM community, and so on.
Most of them are based on interpreted languages, dynamically typed. In the last decade software the typical web developer shifted to languages like Ruby, Python and JavaScript, feeling that he has a huge productivity
boost since the bad days, when old programming languages like
Java and C were used and web frameworks took hours to configure just to get up and running.
But what I've learned in the past two years is that the initial productivity gain NEVER pays off on the long term. Whatever I and my team did in dynamically typed languages, like PHP, quickly turned into a nightmare, in which we spent more time debugging and writing tests than adding functionality to the system. We had this big project which had to be completed in a short time, we decided to use Symfony because we knew it well enough, and had many years of experience on PHP. We thought it was the right choice... at first we were incredibly happy because it already had bundles for everything we needed: a whole bundle for managing user accounts, with hashed and salted password, token via mail, password reset, etc, a very nice bundle for paypal payments, many javascript bundles, excellent support for PHPUnit and so on. After the few weeks, we realized that we were loosing enormous amounts of time just waiting for the ridiculous response times for Symfony to handle requests in dev mode, or with errors that could be found ad compile time if it wasn't a dynamic language, and debugging. Even functional running tests was a tremendous pain, since the response times were so slow. On the long term, we lost money on the project, because we thought it could be done in 3 months and it took 6!
The same thing happened to me when using Grails: I was up and running in no time. In a few hours, I had my entities, my database structure automatically generated, scaffolded pages. But after a few days of development, I found myself losing precious time in horrendous stack traces and bugs which required me to reboot Grails, which takes an exaggerate amount of time, really.
On the other side, I had a project done in Java with raw
servlets and
jdbc, and on top a component-based MVC framework. I always thought I was improductive: building a form, validating data, making database queries was such a long (and verbose) task to accomplish! But on the long run, this was the most succesful project for my company. Only 30% of the app is tested, nonetheless we never found more than a few bugs a month. There is absolutely no javascript, the whole view rending and interaction is compiled in Java. All the communication between the view and the backend is compiled. Database performance is AMAZING, we put dozens of deployments of the same app for different clients on just one cloud server, which also holds the mysql database and costs just 60 € / month (approx 70$).
Spring time!
After learning this lesson, I decided that I would do all my development in Java. So I started learning the Spring framework. At that point, I started to understand why everybody escaped from the Java world. It took me days just to know how the framework worked, and how to configure it. It took me hours of doc-reading to find how to do my stuff with annotations instead of XML. It took me hours to decide which templating system to use, and after trying to figure out how to use Json in my controllers, I just said "oh f*** you" and manually used the Jackson library. When I tried Spring Boot and Spring Data it seemed so cool, but again, you get up and running in 5 minutes but then you have spend even more hours on documentation and learning, to be able to configure and customize what you need, or to get Spring Data up and running with anything which isn't the default in memory db entity manager.
I was a pain. It's not difficult, and I appreciated how powerful and customizable Spring is. But it's so unproductive when you have to learn how to use it! I was never able to start a project with Spring, because I couldn't afford losing so much time just to start the project. I had to start sacrificing my free time.
So I thought to myself: why has nobody ever done a full-stack framework based on Spring? Sure, we have Grails, but when a software takes 20+ seconds just to start, and requires 640+ M of memory, trust me, this is a pretty bad sign. It's not only about performance: it's just that complexity is dangerous: what is under the hood is so complex that it's very likely to be difficult to maintain, to understand, to customize and to debug. Same goes for the Play! Framework: when I ran it for the first time I was shocked by how many dependencies it was loading. When I say the memory footprint, again, I said: "f*** you" (it was 700M).
So, again, why is there no fullstack framework based on Spring? Take the example of the Symfony PHP framework: let's forget for a moment the bad performance in dev mode and the dynamically typed language... it's INCREDIBLE. It has dependency injection, it's highly customizable, very easy yml or annotation or php configuration, and the ORM and templating engines chosen as default are the best of the best for PHP environments. It has bundles for EVERYTHING. You never have to re-implement something already done by somebody else in the PHP community.
Wouldn't it be great to have a full stack framework based on Spring? Something which ships Spring pre-configured for Hibernate and, let's say, Freemarker or Thymeleaf, with pre-configured environments like
test, dev and prod, out of the box support for Json in controllers, out of the box support for externalized configuration, mailing, user account and session management, in-database sesssions, helpers for Jquery/ajax, Form components with CSRF, Scaffolding, CLI for cache management and database schema upgrade and entity creation, and so on. And most importantly, the possibility of easily creating reusable bundles or plugins, which is quite easy when a standard Data layer and templating engine is chosen.
Sure, you can customize Spring as you wish, use Spring Boot or Roo, whatever. But that's another story. What I dream of is a real, fullstack, standardized Spring distribution. A beautiful, lightweight, productive framework with a small and easy documentation, based on the best Java technologies and best practices, 100% Java with our beloved compile-time safety, autocomplete in
IDE, and not too much reflection / runtime magic. What do you think about it? Yes, such frameworks already exist (take a look at Ninja, it's very cute), but having something Spring-based would make it enterprise-ready from top to bottom.