Architecture

Application architecture is prepared as per non-functional requirements. Architecture is formally documented in an MS Word doc file called System Architecture Document (SAD). Architecture is prepared by the Application Architect during the elaboration phase. After making SAD, the Architect is responsible to create its POC ( Proof Of Concept ) with the help of Sr Developer or Technical Lead. POC is approved by the Client which is called sign-off.

Technical Architecture

The application follows a layered architecture. It has four layers, Presentation, Business, Data Access, and Integration layers. All layers are independent of each other. This is the advantage, If you change one layer then it will not impact other layers. In other words, each layer is independently replaceable.

Angular is being used in the presentation layer.

All layers are integrated by the Spring IOC container.

Figure: Layered Architecture

Presentation Layer

The presentation layer implements the user interface of the application. One application may have multiple presentation layers like one for the web interface second for mobile interface. It renders view contents and interacts with User. It takes input data from User and submits to Controller components.

The presentation layer contains View and Controller components. The view contains presentation logic and Control contains navigation ( or control ) logic.

The presentation layer is implemented using Spring MVC, Tiles, and JSTL frameworks. Views are implemented by JSPs. JSP takes data from the Model object and renders using JSTL tags. Controllers are implemented by Spring MVC Controller components. Controller communicates with Service classes to perform business operations. Controller classes are defined in Spring MVC using @Controller annotation.

This layer implements the following Design Patterns:

  1. Command

  2. Builder

  3. DTO

  4. Front Control

Business Layer

Business layer performs business transactions of the Application. It contains business logic and communicates with the Data Access and Integration layer. It does transaction handling.

The business layer is implemented by Spring Service classes. Service classes are defined in Spring using @Service annotations and declarative transactions are managed by @Transactional annotation. Spring AOP is used to implement declarative transactions.

This layer implements the following Design Patterns:

  1. Session Facade

  2. Bridge

  3. DTO

Data Access Layer

Data Access Layer communicates with the database using JDBC or ORM frameworks. Hibernate ORM framework is used in this application to communicate with the database.

Data Access Objects (DAOs) are implemented to perform database CRUD ( Create, Read, Update, and Delete) operations.

This layer is implemented using Spring ORM and Spring DAO. Spring ORM is used to integrate Hibernate ORM and Spring DAO is used to implement consistent data access exception hierarchy.

DAOs are defined in Spring using @Repository annotation.

This layer implements the following Design Patterns:

  1. DAO

  2. Bridge

  3. DTO

Integration Layer

The Integration layer provides application a way to integrate with other applications, servers, and components. A server could be EMAIL, SMS, and Other Web Services.

Spring Mail and Spring Security are used at this layer to integrate the Email Server and the LDAP security server.

Advantage:

Layers are independent of each other. If you change one layer it will not impact other layers. In other words, each layer is independently replaceable.

Architecture Components

1. JSP

It is implemented by JSP and JSTL tags. It contains presentation login and renders the HTML view

2. Controller class

It is implemented by the Spring MVC controller. It contains navigation logic. It depends on the Service class that is autowired by IoC container.

3. Service class

It is implemented by Spring Service classes with the help of @Service annotation. It contains business logic. It handles transactions. When an unchecked exception is propagated in a method then the transaction is committed by Service class. It depends on DAO class that is autowired by IOC container.

Buy using Bridge design pattern we can replace one Service layer (say Service classes) with another Service layer (say RMI) without changing the other three layers.

3. DAO class

It is implemented by Spring DAO classes with the help of @Repository annotation. It contains data access logic. It depends on Datasource that is autowired by IoC container.

Buy using the Bridge design pattern we can replace one DAO layer (say JDBC) with another DAO layer (say Hibernate) without changing the other three layers.

FAQ

Q: Which architecture do you use in your application?

A: We use layered architecture.

Q: What is the advantage of layered architecture?

Q: Which document is containing architecture information?

Q: Which spring modules do you use at the presentation layer?

Q: Which spring modules do you use at the business layer?

Q: Which spring modules do you use at the data access layer?

Q: How do you integrate all these layers?

Q: Which design patterns do you use at the presentation layer?

Q: Which design patterns do you use at the business layer?

Q: Which design patterns do you use at the data access layer?

Q: