Architecture should SCREAM! This is what we talk about in this post.
In the book, Clean Architecture, the author talks about screaming architecture.
When you hear it first, it may sound weird. Architecture and screaming do not sound related at all, right? Let’s see what the author tries to mean by the word, screaming.
Let’s think about a building’s blueprint, like below:
What such a building do you think this blueprint belongs to? A hospital, right? Because we see related terms and drawings to medical stuff, so this is a hospital.
Screaming Architecture is asking us (software engineers) to build something similar in our software systems. We should build the architecture so that it should scream what is the system for.
When a new developer reads the root directory of the system, s/he should understand what is the use case of that repository.
To exemplify:
├── authentication/
│ ├── login
│ ├── register
│ ├── reset_password
│ └── ...
├── cart/
│ ├── add_to_cart
│ ├── remove_from_cart
│ ├── view_cart
│ └── ...
├── checkout/
│ ├── process_payment
│ ├── shipping
│ └── ...
├── product/
│ ├── product_list
│ ├── product_detail
│ ├── product_search
│ └── ...
├── order/
│ ├── order_list
│ ├── order_detail
│ └── ...
├── customer/
│ ├── profile
│ ├── address
│ └── ...
├── system/
│ ├── settings
│ ├── urls
│ ├── database
│ └── ...
└── ...
When you look at the above repository structure, is it possible for you to talk about the whole system’s purpose? 🤔 The answer is supposed to be yes!
The repository, as you see above, looks like an e-commerce app, right? Even if it is not, we could at least say: “it is very similar to e-commerce apps”.
In the repository, there is the Order directory for example. The order directory should include code related to order-related logic and the same for other directories. This is Screaming! The repository screams its purpose.
To Conclude
The Clean Architecture book recommends us to have repositories which are screaming so that we can have clean architectures! So simple, right? 😉
See you in the next posts… 🤓
Opmerkingen