Week 8 - Coupling & Cohesion Flashcards

1
Q

Cohesion

A
How linked together elements in a module are.
Eg: classes, structs, objects etc.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
1
Q

Which is better, high or low cohesion?

A

Low cohesion means that elements in a module aren’t strongly related to one another and therefore are independent of each other.

High cohesion means that elements in a module are strongly related together which allows for reuse of code because it’s more simple.

This is one of the 4 main principles of programming, modularisation.

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

Coupling

A
The dependence that a module has on other modules. 
Eg: read_track(music_file) & print_track(music_file)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Which is better, high or low coupling?

A

Tight coupling means that modules are closely related to one another.

Loose coupling means that modules have fewer relationships with other modules. 
With high cohesion comes low coupling. This is better because an issue with one module shouldn't affect another.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly