Dark energy force: simple components

microservice architecture   architecting   dark energy and dark matter  

a dark energy, dark matter force

An application consists of one or more components (ie. executable or deployable units). Each component implements one or more subdomains.

Each component should be easy to understand and maintain. A component should have an easily understood structure and code base. It should also have easily understood runtime behavior. In particular, the requests that a component handles should be similar in nature, e.g. have similar resource requirements.

There are two ways to achieve this goal:

  • Design modular components
  • Design smaller components

Let’s look at each approach.

Design modular components

One way to achieve simplicity - or at least reduce unnecessary complexity - is modularity. Modularity is a fundamental software design principle. Software should consist of loosely (design-time) coupled elements each of which has a stable, well-defined interface.

A component should consist of loosely coupled subdomains rather than being organized around technical layers. A code base that is organized around subdomains is easier to understand and maintain. This is the approach taken by the Modular Monolith pattern.

One limitation, however, of modularity is that the component might still have a large number of dependencies. It might also handle a mixture of short-running requests and long-running batch jobs. Consequently, its runtime behavior might be difficult to understand and troubleshoot.

Design smaller components

When modularity fails to tame the complexity of a large component (e.g. monolith), the solution is to partition that component’s subdomains into multiple components, i.e. microservices. This ensures that each component is smaller, has fewer dependencies, and has simpler runtime behavior. It is, therefore, much easier to understand and maintain. You could consider this approach to be an application of the Single Responsibility Principle although the term ‘responsibility’ is somewhat imprecise.

Simple components acts as a repulsive force

The desire for simple components acts as a repulsive force that encourages you to package subdomains as separate components. It’s an anti-gravity between subdomains whose strength is proportional to the complexity of the two subdomains.


microservice architecture   architecting   dark energy and dark matter  


Copyright © 2024 Chris Richardson • All rights reserved • Supported by Kong.

About Microservices.io

Microservices.io is brought to you by Chris Richardson. Experienced software architect, author of POJOs in Action, the creator of the original CloudFoundry.com, and the author of Microservices patterns.

ASK CHRIS

?

Got a question about microservices?

Fill in this form. If I can, I'll write a blog post that answers your question.

NEED HELP?

I help organizations improve agility and competitiveness through better software architecture.

Learn more about my consulting engagements, and training workshops.

LEARN about microservices

Chris offers numerous other resources for learning the microservice architecture.

Get the book: Microservices Patterns

Read Chris Richardson's book:

Example microservices applications

Want to see an example? Check out Chris Richardson's example applications. See code

Virtual bootcamp: Distributed data patterns in a microservice architecture

My virtual bootcamp, distributed data patterns in a microservice architecture, is now open for enrollment!

It covers the key distributed data management patterns including Saga, API Composition, and CQRS.

It consists of video lectures, code labs, and a weekly ask-me-anything video conference repeated in multiple timezones.

The regular price is $395/person but use coupon NPXJKULI to sign up for $95 (valid until December 25th, 2024). There are deeper discounts for buying multiple seats.

Learn more

Learn how to create a service template and microservice chassis

Take a look at my Manning LiveProject that teaches you how to develop a service template and microservice chassis.

Signup for the newsletter


BUILD microservices

Ready to start using the microservice architecture?

Consulting services

Engage Chris to create a microservices adoption roadmap and help you define your microservice architecture,


The Eventuate platform

Use the Eventuate.io platform to tackle distributed data management challenges in your microservices architecture.

Eventuate is Chris's latest startup. It makes it easy to use the Saga pattern to manage transactions and the CQRS pattern to implement queries.


Join the microservices google group