V
V
Vitaly2016-11-17 22:39:29
Node.js
Vitaly, 2016-11-17 22:39:29

How to organize the structure of modular projects?

So many noisy articles about the illiterate use of the module system ... For example, there are functions in the class, classes in local modules, which in turn are combined into published modules. Where are the boundaries of these scales? Those. how to understand where to leave the module local, where to take it out globally, and where to make the class as part of another module? In addition, I would like to somehow organize these modules. Of course, they allow you to organize the namespace for internal functions and variables, but they themselves clutter up the package space.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Marat Amerov, 2016-11-17
@amerov

To get started, learn SOLID principles
https://scotch.io/bar-talk/solid-the-first-fiv...

S
Sergey, 2016-11-17
Protko @Fesor

Find a balance between Coupling and Coheasion .
Forget about classes and it will be easier. Then everything is modules. Application - module. It consists of other modules. Those use other modules and so on we organize the hierarchy of modules. Classes are just a way to create new data types, for organizing code it is used only in languages ​​where there are no modules (not OOP, but just a structural unit of code, as in C ++ for example).
Namespaces are needed when everything is in the global scope. When everything exists in the context of modules it is not needed. You already have the insulation you need.
The whole task comes down to cutting the system as much as possible in such a way as to fully control who has access to what and who uses what. Decomposition in its purest form, well, and encapsulation.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question