Recently, I started working on a startup project that I am motivated doing. I had been looking for an idea ever since I can remember. But every idea I thought of always required a heavy upfront ramp-up. The only condition for this idea was that I would find frameworks that were easy to use. Yet would be easy to swap out at a later time. So I set out to search for what I needed to get started.
I did a lot of research into all sorts of frameworks and was impressed with what I was finding. I had already decided that I was going to develop my solution in Java with a MongoDB database. My only condition is that the frameworks and libraries had to be simple, focused and mature.
A Spark of Genious
Java has no shortage of web frameworks from the famous Spring Framework to Play and Ninja. After evaluating several of them I settled on the Java 8 based Spark Framework. Spark is as straightforward and simple as it gets with no BS configuration. Spark is what a high-level language should look like. With a single call to a Lamba function, I can configure a single Get end-point. No annotations, configuration or Dependency Injection of any kind. Click run and the Jetty server is ready to serve up web pages.
A Pebble in the Pond
Next, I needed a templating engine. Spark supports several of them through a bridge API. After some research, I decided on Pebble. Pebble is another simple framework. It provides some simple meta commands to render web pages. It’s not as powerful as Velocity, Freemarker and Mustache, but it can hold its own for what it can do.
Jackson of All Trades
And finally, MongoDB. I hadn’t used MongoDB before, although I was well aware of what it was and what it could do. But I didn’t want to read a tonne of documentation just to start using it. I looked around for a library that would ease me in. The solution came fast and again was super simple. MongoJack is the ultimate hybrid of libraries. It’s a convergence of the MongoDB library with the famous FasterXML Jackson JSON parser. In five lines of code, it will serialise my POJO into a usable BSON format and insert that baby into MongoDB. Querying MongoDB is just as simple.
Putting it all Together
Glue all these frameworks together with a healthy dose of Beans, DTOs, DAOs and the usual suspect of libraries like Orika Mapper and Apache Commons plus some clean packaging and you’ve got yourself a veritable force to build a website in no time flat.