Topic 2 Flashcards

Module Cohesion

1
Q

What does cohesion measure in a module?

A

The degree to which the elements within a module are related to each other.

  • Highly cohesive = perform single task/grp of related task
  • Low cohesion = perform variety of unrelated task
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What characterizes a highly cohesive module?

A

It performs a single task or a group of related tasks.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What characterizes a module with low cohesion?

A

It performs a variety of unrelated tasks.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are the four aspects to consider in module cohesion?

A
  • Strength
  • Content
  • Interrelatedness
    (degree of tasks performed within a module related to each other)
  • Association
    (extent of things within a module associated w each other)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What does high cohesion indicate about a module’s focus?

A

A highly cohesive module is focused on a specific responsibility or functionality.

  • Low cohesion = Divergence
    High cohesion = Focus
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is an example of high module cohesion in an e-commerce system?

A

A user management module that handles only user-related operations.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is an example of low module cohesion?

A

A class that multiplies two numbers and also creates a pop-up window displaying the result.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What are the 12 factors to consider for cohesion maintenance?

A
  1. Single Responsibility
  2. Functional Consistency
  3. Data and Operation Grouping
  4. Interface Simplicity
  5. Internal Dependencies
  6. Ease of Understanding
  7. Code Reusability
  8. Encapsulation
  9. Change Impact
  10. Consistency
  11. Granularity
  12. Responsibility Clarity
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the benefit of single responsibility (1) in a module?

A

Ensure that changes to the module affect only 1 part of the system

  • Makes it easier to understand & maintain
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is the benefit of functional consistency (2) in a module?

A

Promotes logical grouping of related operations

*Enhances readability and usability

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What does data and operation grouping (3) facilitate?

A

Encapsulation and reduces the need for exposing internal details of the module.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is the benefit of interface simplicity (4) in module design?

A

Simplifies interaction with other parts of the system and reduces potential for misuse or errors.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What does high internal dependency (5) within a module suggest?

A

It often means that components are tightly coupled within the module but loosely coupled with others.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is the benefit of ease of understanding (6) for a module?

A

Facilitates easier debugging, modification, and enhancement.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is a key benefit of code reusability (7) in modules?

A

Encourages the creation of modular, adaptable components.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What does encapsulation (8) enhance in a module?

A

Maintainability and reduces the risk of unintended interactions with other modules.

17
Q

What is the impact of change (9) on modules with high cohesion?

A

Minimizes the ripple effect of changes, making modifications easier.

18
Q

What does consistency (10) in module design increase?

A

Readability and reduces the learning curve for developers.

19
Q

What is granularity (11) in module design?

A

The level of detail or size of the module.

  • Modules too granular
    = cumbersome
  • Modules too broad
    = complex
20
Q

What does responsibility clarity (12) in a module help with?

A

Easier management, extension, and debugging of the module.

21
Q

What are the levels of cohesion, from high to low?

  • Function
  • Communication
  • Coincidental
  • Logical
  • Sequence
  • Procedural
  • Temporal
A
  • Function (Highest)
  • Sequence
  • Communication
  • Procedural
  • Temporal
  • Logical
  • Coincidental (Lowest)
22
Q

What is functional cohesion?

A

When the module performs a single, well-defined task.

  • process is same, so same output every time regardless of input
23
Q

What is an example of sequential cohesion?

A

A module that processes data by reading input, transforming it, and writing the output.

  • Useful for processes where operations are closely related and need to be executed in specific order
24
Q

What characterizes communicational cohesion?

A

When the module performs a series of operations on the same data.

25
What is procedural cohesion?
When elements are grouped because they follow a particular sequence of execution.
26
What is temporal cohesion?
When elements are grouped because they are activated at the same time.
27
What is logical cohesion?
When elements are grouped based on a logical category but are different in nature.
28
What is coincidental cohesion?
When elements are grouped arbitrarily with no meaningful relationship.
29
What types of cohesion are considered good?
* Functional * Sequential * Communicational
30
What type of cohesion is neutral?
Procedural
31
What types of cohesion are considered bad?
* Temporal * Logical
32
What is the worst type of cohesion?
*Coincidental
33
What does high cohesion mean?
All tasks are related and contribute to a single responsibility.
34
What does low cohesion mean?
Tasks are unrelated or serve multiple, distinct purposes.