Thoughts on “if you can’t build a well-structured monolith, what makes you think microservices is the answer?”

A couple of weeks ago at the DevNexus conference Simon Brown gave a keynote (slides) titled the “Modular Monolith”.  It was an interesting presentation and he made a number of good points. His final slide asked this excellent question:

If you can’t build a well-structured monolith, what makes you think microservices is the answer?

He had made a similar point on Twitter:

As had other tweets:

 

 

I don’t disagree with the sentiment of Simon’s question. But I think it misses a critical point.

Most teams know how to build a modular system. They want to build a modular system. Most teams usually do. The challenge is maintaining the modularity. A large and/or complex application will often degenerate into a big ball of mud.

The challenge is maintaining modularity

There are several factors that make it difficult to maintain modularity:

  • Current programming languages lack genuinely useful modularity mechanisms. Java visibility rules are insufficient. Perhaps Java 9 modules will finally solve this problem.
  • Monoliths often become too complex for a developer understand. This increases the chance that changes will violate implicit modular boundaries causing the design to degrade.
  • Time pressure. There are no depths to which a developer will not sink (especially under pressure from management) in order to meet a deadline. Who cares about modularity when you need to ship software?!

Microservices can help with modularity

Microservices are certainly not a silver bullet. But one benefit they offer is that your application is functionality decomposed into smaller (not necessarily tiny) services. Each service is much easier to understand. In theory, it is easier to preserve its architecture and modularity.

More importantly, the service API is an impermeable barrier that encapsulates the service implementation. It takes real effort and determination to breach that barrier.  A developer is less likely to make a quick hack to solve a problem the night before a deadline. As a result, it is likely that it will be easier to maintain the modularity of the system.

This entry was posted in microservices, Uncategorized and tagged , , , . Bookmark the permalink.

One Response to Thoughts on “if you can’t build a well-structured monolith, what makes you think microservices is the answer?”

  1. Dmitriy Volk says:

    One of the biggest challenges to keep a monolith truly modular is the shared state store (a.k.a. database 🙂 ). You can modularize the hell out of your code and use the best language there is, but if all your modules access shared data, you still have a big ball of mud. And the only way to solve it is (as you pointed out) making the service API the _only_ way to communicate between modules.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s