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
The Latest "Software Integration: The Intersection of APIs, Microservices, and Cloud-Based Systems" Trend Report
Get the report
  1. DZone
  2. Software Design and Architecture
  3. Security
  4. Monolith to Modular — Part 3: Managing Violations

Monolith to Modular — Part 3: Managing Violations

Learn how to manage dependencies that cause violations when extracting your monolithic codebase to microservices architecture.

Mike Swainston-Rainford user avatar by
Mike Swainston-Rainford
·
Oct. 18, 18 · Tutorial
Like (3)
Save
Tweet
Share
7.81K Views

Join the DZone community and get the full member experience.

Join For Free

Dependencies that violate your target module structure need to be resolved before code can be extracted from the monolith into the new module.

This is the third post in a series that will explore the challenges of migrating a monolithic code base to a modular architecture

Series links:

  • Post 1 – Migrating from Monolith to Modular

  • Post 2 – Monolith to Modular – The Extract Module Use Case

  • Post 3 – Monolith to Modular – Managing Violations  – (this post)

  • Post 4 – Monolith to Modular – Sizing and Estimating Scope

In our previous post, we described the simplest “Extract Module” scenario, in which the new module has no dependencies on the remaining monolith. This post describes the scenario where the proposed new module and remaining monolith are mutually dependent. The Levelized Structure Diagram below illustrates this. 

Image title

There is a circular dependency between the monolith and the new module that has to be resolved before code can be moved into the new module (build systems don’t like module cycles). 

Resolving the cycle requires identification of the dependencies that violate the target architecture. More specifically identifying the code that causes the violations and then refactoring to remove it.

Identifying the violating dependencies requires

  1. An Action List that captures the steps to create the new module and move its content.

  2. A Structure Specification that shows the new module in the target architecture.

  3. A Dependency Breakout that lists the code causing the violations.

The Action List identifies the classes that are being extracted. In this example, there are just four actions in the list:

Image title

The violations will either be dependencies from the monolith into the code being moved or the other way around. It depends on how the target architecture positions the new module.

Which is why we need the Structure Specification. It specifies the relationship between the monolith and the new module. We can't use the Levelized Structure Diagram because it layers the modules based on the current dependencies and that might not be what we want as a target architecture.

If the monolith is dependent on the new module then any dependencies on the monolith from the code being extracted are the violations. These are shown as a dotted arrow in the Structure Specification diagrams below.

Image title

If the new module is to be dependent on the monolith, the violations are reversed.

Image title

The Dependency Breakout is a detailed list of all the contributing code constructs that cause the violations. The breakout for the new-module dependency on the monolith is shown below.

Image title

This breakout is a list of the code that needs refactoring to resolve the violations. Unlike the class moves in the Action List, the violating dependencies can be resolved incrementally.

When all the violations have been removed, the last task is to create the module and move the code into it from the monolith. The developer making these final changes can follow the Action List step by step to implement the module creation and class moves.

In the next post, we will describe how the violating dependencies can be used to build a backlog of work for planning and estimation.

You can see a worked example of Extract Module in this blog post. If you are interested in seeing how your software project looks in Structure101 Studio or Workspace, download a free trial.

Dependency POST (HTTP)

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Cloud Performance Engineering
  • Building a Real-Time App With Spring Boot, Cassandra, Pulsar, React, and Hilla
  • gRPC on the Client Side
  • Spring Boot, Quarkus, or Micronaut?

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: