Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

How to Split a Monolith Solution (Part 2): Find the Seams

DZone's Guide to

How to Split a Monolith Solution (Part 2): Find the Seams

When splitting up your monolithic solutions, you need to know where to look. This post guides you through finding the cracks in your solution, which you can use to split it.

· Integration Zone ·
Free Resource

SnapLogic is the leading self-service enterprise-grade integration platform. Download the 2018 GartnerMagic Quadrant for Enterprise iPaaS or play around on the platform, risk free, for 30 days.

In the first part of this series, I wrote about common myths of splitting monolith solutions. In this post, I will try to find "lines" to cut using the Visual Studio and ReSharper. Let's go!

Assumptions

  1. Big solution.
  2. Time.
  3. Will for change.

I will use .NET solution and tools because I know them the best.

My solution

Overview:

  1. 67 projects.
  2. 36 projects on root.
  3. 2 sub-folders with projects.
  4. 19 projects with tests.

In the Visual Studio, it looks like below:

overview


To start working, we need to visualize dependencies. And in this part, ReSharper saved my day.

With ReSharper, you can explore project dependencies in your solution using a visual representation of the solution architecture. At any time, you can open the Architecture View (ReSharper | Architecture | Show Project Dependency Diagram) and explore project dependencies without compiling anything.

If you know other tools that can do the above, please let me know in comments.

Anyway. Click on ReSharper->Architecture->Show Project Dependency Diagram below image showed. (Yellow and green rectangle I added myself using paint):
overview graph

What did I notice?

  1. There are three projects without a reference to anything else. One is a yellow group on the left. There are more groups like this, but in the overview, I don't see them clearly.
  2. My solution folders are marked with black background rectangles. The left-hand side is tests.
  3. The green rectangle marks a big separated part. There isn't anything with reference to this part.

The good thing is that I have a folder where I can use collapse graphs into smaller groups. Just click:
collapse graph icon


In my case it looks, like the following:

overview graph collapsed


After the collapse, I noticed more:
1. I have only one arrow down — arrows show dependency between projects.
2. I have more project without a reference.
3. I can easily create compilation tiers. There are seven layers in the above picture.

The most interesting point is number 2. Why do I have unrelated projects? I see following possibilities:

  • IoC.
  • Tools without direct dependency, like MSBuild tasks, file converter, UI test stuff, DB helpers, etc.
  • More complex infrastructure: The above solution is not the only one in the project.
  • Something more? Let me know if there is.

As you think about the first two groups, we can easily move on. In my case, it's nine projects from 67. That's ~13% of all projects in the solution. If I exclude tests projects, it is ~18%. So I just make my solution a bit smaller.

After the quite simple above steps I noticed that:

  1. I have parts that can be easily separated.
  2. Most my references are one-way. From bottom to up. I can easily create compilation tiers.
  3. Folders in big solution are good in the overview.

What's coming next?

  1. Dependency management for compilation tiers.
  2. Split or remove circular dependencies in grouped projects.

With SnapLogic’s integration platform you can save millions of dollars, increase integrator productivity by 5X, and reduce integration time to value by 90%. Sign up for our risk-free 30-day trial!

Topics:
monolith ,visual studio

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}