DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
11 Monitoring and Observability Tools for 2023
Learn more
  1. DZone
  2. Coding
  3. Frameworks
  4. Spring Application Architectures

Spring Application Architectures

Let's take a look at the differences between traditional, MVC-style applications and microservice-based ones as an intro to microservices.

David Kiss user avatar by
David Kiss
·
Aug. 23, 18 · Opinion
Like (11)
Save
Tweet
Share
8.65K Views

Join the DZone community and get the full member experience.

Join For Free

I recently received a question from one of my blog's readers, Ajay, and decided to share my answer here to help others with similar questions in mind.

Here's the question from Ajay:

Hello David, I would like to know the difference btw the two types of MVC application architecture that I have come across recently:

1) The ones used in common spring MVC tutorials...model, view, controller, configs , DAO and resources.
2) A more elaborate architecture where app is divided into modules (eg. checkout, cart), each with their own package containing controller, service interface, service Impl and entity/model.

Thanks, Ajay

Great question!

These two options are not mutually exclusive; in fact, they complement each other in well-designed web applications.

You can think of these two options as vertical and horizontal separations. When talking about separation by model, view, controller, config, DAO, etc., we talk about the different layers and components of the application based on the technical (logical) design.

The reason for this separation lies in one of the most important design principles: Single Responsibility and the Abstraction design pattern.

The Single Responsibility Principle states that any one component should only be responsible for one thing (eg: shopping cart service, but having a single service for both shopping cart and reporting is considered bad design) and there should be no other component responsible for the same behavior/state (there should be no more than one shopping cart service in the app with almost identical functionality).

The Abstraction design pattern introduces a layer of abstraction (e.g. DAO layer) on top of a component (e.g. database) while declaring a contract (interface) on how the rest of the application can communicate with that component through the abstraction layer. This makes it easier to replace the underlying implementation of the contract (eg: your DAO layer today may use JPA, but tomorrow you could switch it to Elasticsearch or Neo4j with relatively small effort).

On the other hand, separation by modules (eg: checkout, cart) is based on business functionality. That separation also relies on the Single Responsibility principle and the High Cohesion & Coupling principle. Cohesion is the degree of how components of a certain module belong together. Coupling is the degree on how much components know about the internal workings of one another.

When you separate your modules into different packages based on business functionality, you make it easier for the future to refactor these modules into their own microservices (web applications). That way each of them can have their own deployment lifecycle and can be scaled independently.

application Architecture Spring Framework

Published at DZone with permission of David Kiss, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Container Security: Don't Let Your Guard Down
  • Practical Example of Using CSS Layer
  • How To Build an Effective CI/CD Pipeline
  • Build an Automated Testing Pipeline With GitLab CI/CD and Selenium Grid

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: