Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Group code by Use Case (Modules) #279

Open
Nex-Otaku opened this issue Apr 7, 2021 · 1 comment
Open

Group code by Use Case (Modules) #279

Nex-Otaku opened this issue Apr 7, 2021 · 1 comment
Labels
status:ready for adoption Feel free to implement this issue. type:enhancement Enhancement

Comments

@Nex-Otaku
Copy link
Contributor

Instead of grouping project files by type, we should group them by "use cases" or "modules".

Old structure (typical for Yii2), grouping by type:

/src/Controllers/Module1/Module1Controller
/src/Controllers/Module2/Module2Controller
/src/Components/Module1/Component1
/src/Components/Module2/Component2
/views/module1/index
/views/module2/index
/tests/module1/Testcase
/tests/module2/Testcase

New refined modern structure with grouping by module:

/src/Module1/
             Controllers/Module1Controller
             Components/Component1
             Views/index
             Tests/Testcase
/src/Module2/
             Controllers/Module2Controller
             Components/Component2
             Views/index
             Tests/Testcase

1 module = 1 folder

Not only classes should be grouped by modules, but views and tests too.

Benefits:

  1. Store in one place all that is used in one business feature. For example, code with tests that testing it. Easy to find, easy to manage.

  2. Reuse module between projects with copy-paste module folder. Easy!

  3. Fork modules to reuse in same project. Just copy that folder, and replace some logic.

  4. Work in single folder at one time, tinkering some feature. No need to open 3-4 folders in project tree (code, tests, views, etc).

@samdark samdark added the type:enhancement Enhancement label Apr 7, 2021
@samdark
Copy link
Member

samdark commented Apr 10, 2021

We should try it to check how it would look like.

@samdark samdark added the status:ready for adoption Feel free to implement this issue. label Apr 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:ready for adoption Feel free to implement this issue. type:enhancement Enhancement
Projects
None yet
Development

No branches or pull requests

2 participants