Layered Architecture

Introduction to Layered Architecture

MadhushaPrasad
4 min readJul 6, 2023

--

What Is Layered Architecture?

Have you ever thought about how Google manages to make Gmail available in so many different languages? Gmail is available in a wide variety of languages, including English, Spanish, French, Russian, and many more.

Has Google created regional versions of Gmail? The answer is no. They built an internal version that handles all the message processing and then created a variety of user interfaces for the outside that are compatible with a wide range of languages.

The Gmail app was built by Google in stages:

  • All computation is performed at a deeper level within the system.
  • An external layer provides user-to-user communication in their native tongue.
  • Another layer communicates with a database where countless emails sent and received by users are archived.

At least three distinct layers make up Gmail; each is responsible for a certain function and exists independently to process messages at their respective depths. It’s a perfect illustration of how to use layers to your advantage.

Most Widely Used Methodologies for Designing Software

  • Client-server model (2-tier, n-tier, peer-to-peer, and 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)

Software Layers for J2EE Applications

So let’s go through each layer in detail.

Data Access Layer.

The data access layer’s sole responsibility is to manage the app’s persistent data. Simply put, it’s CRUD operations on a database. It controls how users get entry to whatever form of storage is persistent. Data files, data XML files, and relational databases are the simplest forms of permanent storage.
The fundamental advantage of decoupling data access from the rest of an application is the flexibility it affords in terms of data source selection and DAO reuse.
There are a few main formats for data objects. Every permanent item in the simplest pattern is a Data Access item. The most frequent pattern is a factory-based design, which is more intricate but also more versatile.

Value Object Layer

Data objects in every application have natural relationships and are frequently utilized together. Treating this logical set of data elements as a distinct object is more manageable from a programming perspective and improves speed when using enterprise beans.

Business Logical layer

The business logic layer is where information is combined with business rules, constraints, and actions by means of objects. Enterprise beans and other deployment layers get in the way of reuse. Therefore, it’s important to keep business objects isolated from DAOs and VOs. Business objects frequently use and coordinate multiple data items.

Deployment layer

Deployment wrappers, which are objects in the deployment layer, are fundamental to J2EE design. Wrappers for deploying business objects provide their capabilities to remote Java classes.

Presentation layer

The presentation layer is responsible for handling everything a user sees while interacting with an application. There are several technologies that may be used to construct this layer.

Architectural component Layer

JDK should, ideally, supply all common tools and components. However, you’ll have to employ external libraries and components if doing so is necessary. This layer contains all of those parts.

Finally, this is all about layered architecture.

example repo

--

--

MadhushaPrasad

Open Source Enthusiast | Full Stack Developer👨🏻‍💻 | JavaScript & Type Script , Git & GitHub Lover | Undergraduate — Software Engineering‍💻 | SLIIT👨🏻‍🎓