Layered Architecture
The most common architecture pattern is the layered architecture pattern, otherwise known as the n-tier architecture pattern. This pattern is the de facto standard for most Java EE applications and therefore is widely known by most architects, designers, and developers. The layered architecture pattern closely matches the traditional IT communication and organizational structures found in most companies, making it a natural choice for most business application development efforts.
What Is Layered Architecture?
Have you ever wondered how Google makes Gmail work in different languages all over the world? Users can use Gmail every day in English, Spanish, French, Russian, and many more languages.
Did Google develop different Gmail applications for each country? Of course not. They developed an internal version that does all the message processing, and then developed different external user interfaces that work in many languages.
Google developed the Gmail application in different layers:
There is an internal layer that does all the processing.
There is an external layer that communicates with the users in their language.
There is also another layer that interacts with a database where user email messages are stored (millions or maybe billions).
Gmail is divided into at least three layers, every one of them has a mission, and they exist separately to handle different processes at different levels. It is an excellent example of layered architecture.
Most popular software architectural methodologies
- Client-server model (2-tier, n-tier, peer-to-peer, cloud computing all use this model)
- Database-centric architecture (broad division can be made for programs that have a database at its center and applications which don’t have to rely on databases, E.g. desktop application programs, utility programs, etc.)
- Distributed computing
- Event-driven architecture
- Front end and back end
- Implicit invocation
- Monolithic application
- Peer-to-peer
- Pipes and filters
- Plugin
- Representational State Transfer
- Rule evaluation
- Search-oriented architecture (A pure SOA implements a service for every data access point.)
- Service-oriented architecture
- Shared nothing architecture
- Software componentry
- Space-based architecture
- Structured (module-based but usually monolithic within modules)
- Three-tier model/Layered Architecture (An architecture with Presentation, Business Logic, and Database tiers)
So let's go through each layer in detail.
Data Access Layer.
The data access layer is specific for handling the persistent unit of the application. Basically, database CRUD operation. It manage access to persistent storage of some type. Simply the persistent storages are relational database, data XML file, and data files.
The primary reason to separate the data access from the rest of the application is. that’s easy to switch data sources and share DAOs between application.
A couple of patterns for data objects are most common. The simplest pattern has each persistent object represent as a DAO. The more complex and but more flexible pattern in common use is a factory base pattern.
Value Object Layer
Every application has data items that logically belong and typically are used together. It's programmatically convenient and with enterprise beans performance-enhancing to treat this logical group of data items as a separate object.
Business Logical layer
Objects in the business logic layer combine data with business rules, constraints and activities. Business objects should be separated from DAOs, VOs, and deployment layers, such as enterprise beans to maximize the possibility of reuse. Business objects often use and coordinate the activities of multiple data objects.
Deployment layer
Objects in the deployment layer called deployment wrappers are the heart of J2EE architecture. Deployment wrappers publish business object functionality to java classes that could be on a separate machine.
Presentation layer
The presentation layer is the section of the application responsible for everything end-users physically see in the end-user interface. This layer can be build using JSP, Servlet, Html,javascrip,t, etc.
Architectural component Layer
Ideally, all general utilities and components would be provided by JDK. But according to your requirement, you will need to use third-party libraries and components. All those components reside in this layer.
Finally, this is all about layered architecture. Next blog I will show coding project examples for the Layered architecture.


Comments
Post a Comment