Desegemented
Maqola yozilish jarayonida
Uning yaratilishini tezlashtirish uchun siz:
- ๐ข Fikr-mulohaza ulashing chiptada (sharhlar/reaksiya emoji)
- ๐ฌ Mavzu boyicha to'plamlarni chiptaga yig'ish suhbatdan olingan material
- โ๏ธ Hissa qoโshish har qanday boshqa yo'l bilan
๐ฐ 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
Sahifa foydali boldimi?
Sizning fikr-mulohazalaringiz hujjatlarni yaxshilashga yordam beradi