Written By: Steve Zagieboylo, Senior Architect at Calavista
One thing Calavista does very well as a company is building Web Applications from scratch. If you have a great idea for an application and you plan to bet your life savings on building a company around it, a smart move would be to find a development organization with a on-time, within-budget record of greater than 90%, such as Calavista. One way that we achieve this record is by using some great tools to jump start the application.
JHipster is more of a one-and-done quickstart — at least, that’s the way I’ve always used it. Once we had the initial project with the data model basically defined, we did not use the tool any more. JHipster does support such a mode, I understand, but it feels more awkward. Cuba Platform, on the other hand, is completely designed to be used for the lifetime of the project. There is an exit strategy if you find you are not happy with it, but clearly the intent is that you continue to use it.
Best Practices for a Java Web Application
There are a number of elements that are common too many applications — web framework, security, build environment, etc. It doesn’t make any sense to develop them from scratch each time. Of course, every new project comes with its own different challenges, so we do not want some “one size fits all” framework. What we need is a great starting point, but one that does not limit where we will eventually end up. It should provide us exactly what we would have created if we had the time and skill to build it properly from the ground up, but do so in minutes rather than weeks. All the pieces should use Industry Best Practices, which, for this purpose, I’ll define as follows.
- Spring Boot Web Framework
- Clean separation of layers: Data Model, API, Business logic
- Authentication using Spring Security
- Database access using JPA
- REST services defined with JAX-RS annotations
- Maven or Gradle build system, with proper project structure
- Unit tests with at least 80% code coverage
- Use a “best of breed” UI framework
Complete, Functioning Application
The big requirement for our Jump Start is that it should create a complete application, with some easy way to create our data model without having to construct all the pieces by hand. There should be some meta level at which I describe the Data Model, and the Jump Start tool builds the pieces for me, from the UI to the DTOs to the database entities.
I can’t overstate the importance of a complete, functioning application. Consider every project where you spent the first few days, at least, just getting a basic “Hello, World” working. Of course, for a “Hello, World” in a web application, you need at least user identity, database connection, login, basic user management, a UI framework, and a REST framework. Building those from scratch is going to take a few days, at least. Building them with one of these quick starts is under an hour, and you get a lot more functionality besides.
There are a few tools which purport to give such a quick start to your application. This set of blogs is going to focus on two of them which are very different in approach but both accomplish the goal admirably. They are:
These other tools were also considered, but discarded for different reasons:
- Django — https://www.djangoproject.com/ This also looks promising, but it creates a Python-based application, rather than Java. While this also is a viable alternative for web applications, we rather arbitrarily decided to limit our choices to Java for now.
- Several no-code application builders: bubble.io, kintone.com, journeyapps.com, all discarded because we are planning for an application that is something more than just a glorified CRUD application over a database. We want the ability to get to the core code, once the basic application has been generated for us, to write custom business logic and to create custom UI.
We’ll consider these two platforms on these criteria:
- Installation and setup
- Defining the Data Model
- Creating and Running the Application
- Built-in Functionality
- Analysis of the Generated UI for the Entities
- Analysis of the Generated Code
- Analysis of the Generated Unit Tests
I have a lot of experience with JHipster, having used it successfully for three different projects for Calavista customers. So I plan to spend more time with the Cuba Platform, because I am learning it for this exercise. (That’s actually the reason for the exercise.) But I promise to try to look at JHipster as if I were approaching that with equally unfamiliar eyes.