1

Overall cost and simplicity are the primary strengths of the layered architecture style. Being monolithic in nature, layered architectures don’t have the complexities associated with distributed architecture styles, are simple and easy to understand, and are relatively low cost to build and maintain. However, as a cautionary note, these ratings start to quickly diminish as monolithic layered architectures get bigger and consequently more complex.

- Fundamentals of Software Architecture,\ Mark Richards, Neal Ford, chapter 10. "Layered Architecture Style".

In "Fundamentals of Software Architecture" they imply that layered architecture style is inherently monolithic.

Which to me seems like a questionable statement:

  1. When you use microservice-based architecture it's still useful to split each microservice's code into layers and have business logic, storage and communication as separate layers. Simply because it encourages separation on responsibilities, modularity.
  2. Ultimately - even if you write a layered monolithic application - nothing prevents you from deploying it as many different separate microservices.

I'm looking for answers supported by references to authoritative sources.

2
  • 1
    There are no "authoritative" sources regarding software design/architecture. If you think that, you have a problem. Everything is just some guy's or gal's opinion at this point. There are some studies, but a lot of what I've seen are inconclusive about these generalized themes, to say the least. Point being: don't trust the books. Really. I mean read, but do not trust. Think, and always think about your case specifically. There's is almost no generalized ideas that work all the time or even most of the time. Mar 25 at 13:11
  • Looks like by "monolithic" the authors mean non-distributed, and they also seem to use "layered architecture" in a very narrow sense (think traditional business applications with 3 or 4 "standard" layers). But layering as a design tool is really an orthogonal concept to the deployment strategy, and can be done in different ways. After all, The Internet is a layered architecture, and that's as distributed as things get. Plus, there is also such a thing as a "distributed monolith" (distributed in appearance, but horribly coupled so that any benefit of having a distributed system is negated). Mar 25 at 14:56

3 Answers 3

2

The purpose of creating layers in an application is to separate technical responsibilities from each other. An application with a layered architecture typically has a presentation layer, a service layer and a data access layer, but there could be more.

When systems grow bigger they become harder to maintain. A change in one part could have unintended consequences in another. To solve this, modules can be incorporated into the system architecture. Each module in the system is responsible for a particular piece of functionality. Within a module, we often still need the same technical capabilities, so we can again apply layering to separate these technical concerns.

When teams grow bigger, it becomes harder to work on the same application. In order to deploy a new version, all modules have to be in a stable state. This slows down the release cycle. In order to solve this, microservices were invented, so that teams could be split into several smaller teams.

To summarize the above: layers, modules and microservices solve different problems.

The author quoted in the question compares layers with ‘distributed architecture’. This implies that the technical concerns are distributed to separate services.

Building systems like that is not a good idea. Several services, possibly maintained by different teams, have to cooperate to get new versions out for a single piece of new functionality.

Teams and microservices are better formed around separate functionalities. This enables teams to have their own release cycle and make their own technical decisions. And surely separating technical concerns into layers is one of those decisions.

To answer the question: ‘Is layered architecture style inherently monolithic’. I would say: yes, any (part of/microservice) application that uses layers should be deployed as a single (monolithic) unit.

2

I don't have the book you cited from at hand, but from the excerpts I could find by googling, I am sure the authors were talking about the specific horizontal layering

Presentation Layer / Business Layer / Persistence Layer / Database Layer

and about software architectures which use this as its primary-and-only architectural style. The cite seems to be ripped out of context.

So when we add the missing context and ask instead "Is an exclusively horizontally layered architecture inherently monolithic", then the answer is clearly "yes" - when we find the above layers in one application system, none of them maps to a "use case" on its own, they will usually have to work together to create something useful for a user. But the real point is the attribute "exclusively", which excludes "vertical layers" like micro services.

As soon as you introduce additional structure elements into your architecture, you are most probably leaving the ground of what Richards and Ford were describing - which I guess should answer your question:

  • sure micro services can have horizontal layers inside (which may pay off at a certain size)

  • using horizontal layers in a micro service does not make the system a monolith.

1

No.

How do I know?

  • People wrote monoliths before layers were a thing
  • A layer is a collection of modules/classes with similar responsibilities
  • Plenty microservices have layers

Now all that said, layers give you the ability to easily grow your codebase. Once it gets so big that it's hard for one person to maintain then it's hard to call it a microservice. But that's not inherently monolithic. That's just letting it grow.

3
  • Does it come from your own practical experience or from some author?
    – Gill Bates
    Mar 25 at 7:22
  • 1
    re bullet point 1: the question doesn't say "are monolithic architectures inherently layered?"
    – user253751
    Mar 25 at 7:35
  • I also don't like this definition of a layer.
    – user253751
    Mar 25 at 7:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.