New technologies in touch (II part)
As you could remember, I am working with some interesting technologies in Pernix. I will tell you about my new experiences with them.
Currently we are migrating from Firebase real-time database to PostgreSQL. To do so, we are programming an API to communicate with the new database to a mobile and desktop applications. This API is using Spring Framework and Hibernate.
In words of Schaefer, Ho and Harrop…
Spring is described as a lightweight framework for building Java applications, but that statement brings up two interesting points. First, you can use Spring to build any application in Java (for example, stand-alone, web, or Java Enterprise Edition (JEE) applications), unlike many other frameworks (such as Apache Struts, which is limited to web applications). Second, the lightweight part of the description doesn’t really refer to the number of classes or the size of the distribution, but rather defines the principle of the Spring philosophy as a whole — that is, minimal impact. Spring is lightweight in the sense that you have to make few, if any, changes to your application code to gain the benefits of the Spring core, and should you choose to stop using Spring at any point, you will find doing so quite simple.
- Schaefer et al.: Pro Spring (4 ed.)
We chose Spring because it is an enterprise Java framework and a mature project. It makes easier the REST layer development and gives a lot of advanced features like integrate a database layer like Hibernate. Because we are not using Spring Boot, some settings are a little tricky so researching and read some books is fundamental. At first, using Spring Frameworks looks challenging, but it becomes easier (I promise!). I don not deny that patience is mandatory (IMHO), but it will pay back.
The second tool we are using is Hibernate.
Hibernate is an open source ORM service implementation, an ambitious project that aims to be a complete solution to the problem of managing persistent data in Java. It mediates the application’s interaction with a relational database, leaving the developer free to concentrate on the business problem at hand. Hibernate is a nonintrusive solution. You aren’t required to follow many Hibernate-specific rules and design patterns when writing your business logic and persistent classes; thus, Hibernate integrates smoothly with most new and existing applications and doesn’t require disruptive changes to the rest of the application.
- Bauer: Java Persistence with Hibernate (1 ed.)
It sounds like magic, isn’t it? Efforts to have a better SoC and using different layers in the application is possible with this amazing tools. And yes, Spring and Hibernate adapts without inconveniences. In our company project, we use DTOs and DAOs that helps to reduce cohesion and avoid to use JPA because it mix functionalities in modules (again, IMHO).
To continue talking about the current design, how things are working together and so on, I will write you a new entry in some days.