Desegemented
WIP
The article is in the process of writing
To bring the release of the article closer, you can:
- ๐ข Share your feedback at article (comment/emoji-reaction)
- ๐ฌ Collect the relevant material on the topic from chat
- โ๏ธ Contribute in any other way
๐ฐ Stay tuned!
Situation
Very often, there is a situation on projects when modules related to a specific domain from the subject area are unnecessarily desegmented and scattered around the project
โโโ components/
| โโโ DeliveryCard
| โโโ DeliveryChoice
| โโโ RegionSelect
| โโโ UserAvatar
โโโ actions/
| โโโ delivery.js
| โโโ region.js
| โโโ user.js
โโโ epics/
| โโโ delivery.js
| โโโ region.js
| โโโ user.js
โโโ constants/
| โโโ delivery.js
| โโโ region.js
| โโโ user.js
โโโ helpers/
| โโโ delivery.js
| โโโ region.js
| โโโ user.js
โโโ entities/
| โโโ delivery/
| | โโโ getters.js
| | โโโ selectors.js
| โโโ region/
| โโโ user/
Problem
The problem manifests itself at least in violation of the principle of * High Cohesion** and excessive stretching * of the axis of changes**
If you ignore it
- If necessary, touch on the logic, for example, delivery - we will have to keep in mind that it lies in several places and touch on several places in the code-which unnecessarily stretches our * * Axis of changes**
- If we need to study the logic of the user, we will have to go through the whole project to study in detail * * actions, epics, constants, entities, components** - instead of it lying in one place
- Implicit connections and the uncontrollability of a growing subject area
- With this approach, the eye is very often blurred and you may not notice how we "create constants for the sake of constants", creating a dump in the corresponding project directory
Solution
Place all modules related to a specific domain/user case - directly next to each other
So that when studying a particular module, all its components lie side by side, and are not scattered around the project
It also increases the discoverability and clarity of the code base and the relationships between modules
- โโโ components/
- | โโโ DeliveryCard
- | โโโ DeliveryChoice
- | โโโ RegionSelect
- | โโโ UserAvatar
- โโโ actions/
- | โโโ delivery.js
- | โโโ region.js
- | โโโ user.js
- โโโ epics/{...}
- โโโ constants/{...}
- โโโ helpers/{...}
โโโ entities/
| โโโ delivery/
+ | | โโโ ui/ # ~ components/
+ | | | โโโ card.js
+ | | | โโโ choice.js
+ | | โโโ model/
+ | | | โโโ actions.js
+ | | | โโโ constants.js
+ | | | โโโ epics.js
+ | | | โโโ getters.js
+ | | | โโโ selectors.js
+ | | โโโ lib/ # ~ helpers
| โโโ region/
| โโโ user/
See also
Was this page helpful?
Your feedback helps us improve the docs