Skip to content

Commit

Permalink
draft of rule
Browse files Browse the repository at this point in the history
  • Loading branch information
danielmackay committed Jun 13, 2024
1 parent e5b34e5 commit b14cd00
Showing 1 changed file with 86 additions and 33 deletions.
119 changes: 86 additions & 33 deletions rules/software-architecture-cheat-sheet/rule.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
seoDescription: TODO
type: rule
title: Do you know to choose the best software architecture?
title: Do you know to choose the best software architecture for your system?
uri: software-architecture-decision-tree
authors:
- title: Daniel Mackay
Expand All @@ -11,50 +11,103 @@ authors:
- title: Luke Parker
url: https://www.ssw.com.au/people/luke-parker
created: 2024-06-13
guid: TODO
guid: 1CD0006D-24A7-4FBD-B59E-92C25D0D10BC
---

A Modular Monolith is a software architecture pattern that combines elements of both monolithic and modular architectures. In this approach, the application is built as a single, unified codebase like a traditional monolith, but it is designed and organized in a modular manner, allowing for logical separation of different components or modules within the codebase.
---
type: rule
title: Do you choose the best software architecture for your system?
uri: choose-best-software-architecture
authors:
- title: Ulysses Maclaren
url: https://www.ssw.com.au/people/uly
created: 2024-06-13T14:25:30.000Z
guid: d3b1e3a5-9e3e-4532-b2f6-3c17d833f6a5
---

Choosing the right software architecture for your system is crucial for its success and maintainability. Making the wrong choice can lead to increased complexity, difficulty in scaling, and higher costs. Here are some of the popular architectures and factors to consider when deciding the best fit for your project.

<!--endintro-->

> The Modular Monolith architecture is the “goldilocks” approach that combines the modularity of microservices with the simplicity of traditional Monoliths
>
> - Steve “Ardalis” Smith
### Popular Architectures

#### Clean Architecture
Clean Architecture emphasizes separation of concerns, making your system easier to maintain and scale. This architecture is designed to keep the business logic independent of the frameworks and tools, which helps in achieving a decoupled and testable codebase.

#### Vertical Slice Architecture
Vertical Slice Architecture structures your system around features rather than technical layers. Each feature is implemented end-to-end, including UI, business logic, and data access. This approach improves maintainability and reduces the risk of breaking changes.

#### Modular Monolith
A Modular Monolith organizes the system into modules that encapsulate specific functionalities. While it runs as a single application, it retains some benefits of microservices, such as independent module development and testing. It’s a good middle-ground between a monolith and microservices.

#### Microservices
Microservices architecture involves splitting the application into small, independently deployable services. Each service focuses on a specific business capability and can be developed, deployed, and scaled independently. This approach is beneficial for complex and large-scale applications with multiple teams working on different parts.

### Factors to Consider

1. **Are your requirements certain?**
- If requirements are likely to change, Clean Architecture or Vertical Slice Architecture can offer more flexibility.

2. **Do you have multiple domains?**
- For applications with multiple domains, Microservices can provide better separation and modularity.

3. **Do you have many teams?**
- If you have many teams, Microservices or Modular Monolith can help in reducing inter-team dependencies and allow parallel development.

4. **Do you need independent deployments?**
- If independent deployments are necessary, Microservices is the best choice due to its isolated nature.

5. **Do you need independent scalability?**
- Microservices allow each service to be scaled independently based on its specific needs, which can be more efficient and cost-effective.

6. **Do you have DevOps maturity?**
- Microservices require a mature DevOps culture to manage deployments, monitoring, and scaling effectively. Without this, the overhead can be overwhelming.

7. **Is the team experienced?**
- The complexity of Microservices can be challenging for less experienced teams. Clean Architecture or a Modular Monolith might be more suitable in such cases.

### Choosing the Right Architecture

Here are some practical scenarios to illustrate the decision-making process:

::: greybox
**Scenario 1: Startup with Uncertain Requirements**

You are building an MVP with a small team and expect the requirements to evolve rapidly.

## Modular Monolith characteristics
**Choice:** Clean Architecture or Vertical Slice Architecture.
:::
::: good
Figure: Good Example - These architectures offer flexibility and are easier to refactor as requirements change.
:::

![Figure: Modular Monolith architecture](modular-monolith.jpg)
::: greybox
**Scenario 2: Large Enterprise with Multiple Domains and Teams**

- Single Host/Process
- Single Deployment
- Loosely coupled modules that each have their own
- Domain
- Application
- Infrastructure
- Presentation (API or UI)
- Each module represents a business capability or domain
- Each module should be as highly cohesive and loosely coupled with other modules
- Each module manages it's own data and persistence
You are developing a large-scale application with multiple business domains and have several teams working in parallel.

### ✅ Advantages
**Choice:** Microservices.
:::
::: good
Figure: Good Example - Microservices allow independent development, deployment, and scaling, which suits large and complex applications.
:::

- **Simplicity in Deployment** - Since it's a monolith, the deployment is typically simpler than distributed systems like microservices
- **Ease of Development** - Developers can work on separate modules without significantly affecting other parts of the application
- **Performance** - Inter-module communication is often faster and more reliable than inter-service communication in distributed architectures
::: greybox
**Scenario 3: Medium-sized Business with Limited DevOps Maturity**

### ❌ Challenges
You have a mid-sized team, and your organization is still developing its DevOps practices.

- **Scalability** - While more scalable than a traditional monolith, it may not scale as effectively as microservices
- **Modular Discipline** - Maintaining strict modularity can be challenging as the application grows and evolves
**Choice:** Modular Monolith.
:::
::: good
Figure: Good Example - A Modular Monolith provides some modularity benefits without the full complexity of Microservices, making it easier to manage with limited DevOps capabilities.
:::

A Modular Monolith offers a balance between the simplicity and coherence of a monolith and the modularity and maintainability of more distributed architectures. It is particularly useful for certain kinds of applications and organizational contexts.
By carefully considering these factors and understanding the strengths and limitations of each architectural style, you can choose the best architecture for your system, ensuring a balance between flexibility, scalability, and maintainability.

### Modular Monolith compared to other architectures
### Further Reading

| Trade-Offs | Layered / CA | Microservices | Modular Monolith |
| ----------- | ------------ | ------------- | ---------------- |
| Modularity ||||
| Cost | $ | $$$ | $ |
| Scalability ||||
| Simplicity ||||
- [Clean Architecture](https://8thlight.com/blog/uncle-bob/2012/08/13/the-clean-architecture.html)
- [Vertical Slice Architecture](https://jimmybogard.com/vertical-slice-architecture/)
- [Modular Monolith](https://martinfowler.com/bliki/MonolithFirst.html)
- [Microservices](https://martinfowler.com/articles/microservices.html)

0 comments on commit b14cd00

Please sign in to comment.