I try to understand what cohesion means when designing modules. Myers states in his book "Composite structured design":

An informational-strength module has the following definition:

  • It contains multiple entry points.
  • Each entry point performs a single specific function.
  • All of the functions are related by a concept, data structure, or resource that is hidden within the module.

I am not sure to fully understand this definition:

  1. what is an entry points of the module?
  2. what is multiple entry points for a module?
  3. has a SQL class containing 4 methods: add(), delete(), update(), retentive() informational cohesion or functional cohesion?
  4. what would be a practical example for a class having informational cohesion?
有帮助吗?

解决方案

1) an entry point in something that you can call from outside the module. Because there you enter into the module’s functionality. A typical example is main().

2) The term “entry point” is more general than a function. For example creating an object, performing some method/operation, or setting a property, are all ways to enter the module, even if it’s less apparent than calling a public function. By the way, you have here an example of several entry points.

3) SQL is not object oriented. So there is no such thing like a “an SQL class”.

3 bis) supposing you mean a class that expose CRUD functionality for an SQL table or an entity:

  • this is informational cohesion, because all these operations are related to the same data structure / entity
  • it is not possible to say if it’s functional cohesion, because we don’t know what the objective (i.e. function in the engineering sens) of this module is and what other functions are exposed. For example, If it’s all about employees and assigning employees to jobs it would be functional cohesion (the function being “managing employee”).

4) See above

许可以下: CC-BY-SA归因
scroll top