How to decompose a system into modules?

2020-06-06 06:07发布

问题:

The effectiveness of a "modularization" is dependent upon the criteria used in dividing the system into modules.

What I want is, suggest some criteria which can be used in decomposing a system into modules.

回答1:

Cohesion: the functionality in a module is related.

Low coupling: you have minimum dependencies between modules.

Coordinated lifecycle: changes to functionality within a module tends to occur at the same time. Usually a consequence of high cohesion.



回答2:

I think the Single Responsibility Principle would be a good guide. Try to define responsibilities for each modules, and make each module be responsible for its own thing.

See http://butunclebob.com/ArticleS.UncleBob.PrinciplesOfOod



回答3:

Interesting reading too: http://www.cs.umd.edu/class/spring2003/cmsc838p/Design/criteria.pdf



回答4:

It is very old question.

  • Module is work assignment to a programmer or group of programmers. This also is the unit of change.
  • Low coupling and cohesion are metrics for estimation quality of relationships between modules but they are not useful for decomposition.
  • The decomposition should be made using "information hiding" as a criterion.
  • Introduction with examples and description of process based on "information hiding" principle: http://www.sqrl.ul.ie/Downloads/Lecture2.pdf.
  • State of art of this question is software product line topic.


标签: modularity