Web development setup

Any work of a java programmer is based on the basis, which means not only direct knowledge of the programming language itself, but also knowledge of additional components, without which programming in its pure form becomes quite difficult or uncompetitive in time. That is what we will talk about in this article.

The following presentation does not claim to be complete, but it may be useful to someone.

Using frameworks is the first thing

▍Spring

This framework is at the top of the list of utilities. It speeds up development due to the fact that it consists of many modules, each of which is responsible for a separate area and, in fact, serves to inject the appropriate dependencies.

We can say that it is a kind of framework with which you can solve many typical tasks, which are solved with the help of the corresponding modules.

Speaking more specifically about speeding up development using the appropriate Spring module, for example, I have seen information about reducing the amount of code by 80% when using the Spring Data module.

Spring can be used to create enterprise-scale web applications, and back-end developers can also use it. However, its scope is not limited to these two areas, and it can be used for mobile development or desktop applications as well.

You can find a complete list of Spring modules that close the solution of specific tasks on the official website at this link:

As you can see, there are quite a lot of modules, however, despite this, some stand apart, and you could often see them in the requirements for various vacancies.

▍Spring Boot

It serves to simplify the configuration of Spring for a specific project and contains a number of utilities to simplify this process, since setting up pure Spring can be a long process.

For those who want to get acquainted with it, there is a good manual for working with Spring Boot, as well as an official manual for a quick start in 3 steps.

▍Spring Data

If the application requires data storage in relational or non-relational databases for its work, then it makes sense to use this module, which provides the ability to work and mechanisms for interacting with specific databases of various types. The key concept of Spring Data is the repository, a good article on working with this module can be found here.

▍ Hibernate

A little deviating from the topic, it makes sense to mention this framework. It allows you to significantly reduce the amount of generated manual code for interacting with databases and represents working with them within the framework of the object-relational mapping model (ORM), within which class fields are linked to the corresponding columns of tables in the database.

Thanks to the use of Hibernate, it is possible to reduce the amount of code at a low level, since it takes over the interaction with the database, and the developer remains to interact in code, with a convenient representation of the database in a virtual form.

Thanks to a large community of developers and a theoretical base, learning this framework is greatly facilitated. In addition, it can interact with almost any database.

There is a good article here about using hibernate for the first time in your project.

▍Spring Security

Any application created on the basis of Spring requires its own protection, this is exactly what this tool is designed for, which allows you to provide support for authentication and authorization, protection from attacks, etc.

In addition, since we are not talking about web applications, it makes sense to mention two more modules.

▍Spring REST

It is an architectural style of interaction in components within a computer network, in which the presentation state is transferred, that is, in other words, various components located in physically remote places from each other exchange data within a certain style. Within this style, data exchange between web agents can be carried out in different formats – JSON, XML, etc. This way of interacting within this architectural style is also called RESTful.

There is a good article here about developing a RESTful service.

▍Spring Web Services

Designed to facilitate the process of creating services that support the SOAP protocol that exchange data in XML format. A detailed official guide to creating a SOAP service is available here.

By the way, if your application is based on a microservice approach, then it makes sense to use a message broker to communicate between individual services.

Of the well-known brokers, two come to mind: RabbitMQ and Apache Kafka. The first of them is designed more to be able to implement fairly complex message routing scenarios, while the broker from Apache is for scalable high-load systems, which also provides the ability to store messages and retrieve them (for the desired time period) for analysis purposes.

Testing

The quality of the developed software directly depends on how error-free the final code is. Unit testing and integration testing can be done to ensure quality. The first is designed to check each individual module, which means checking the correct operation of code elements at the level, up to and including each individual method; in contrast, integration allows you to check the correctness of the code as a whole and the relationship of individual components.

▍ JUnit

For testing in Java, the JUnit framework is used. In its latest version, it consists of three components:

JUpiter is a support for new programming models.

JUnit – to run testing.

JUnit Vintage – Provides backwards compatibility to support tests written for previous versions of JUnit.

But testing in its purest form using this framework will not be very convenient, since for unit tests it is necessary to use instances of the tested classes, whose functionality must be limited in order to provide certain behavior within the framework of the test. It is not very convenient to provide this and is fraught with errors.

This is what the following framework is designed for.

Leave a Reply

Your email address will not be published.