Final Flashcards

1
Q

What are advantages of modularity?

A

Advantages of Modularity: - Minimizes Complexity - Reusability - Extensibility - Portability - Maintanability

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

What does SOLID stand for?

A

SOLID is a combination of principles: S - Solid Responsibility Principle O - Open/Closed Principle L - Liskov Substitution Principle I - Interface Segregation Principle D - Dependency Inversion Principle

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

State the single responsibility principle.

A

Single responsibility principle: a class should have only a single responsibility.

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

What is cohesion?

A

Cohesion refers to how closely the functions in a module are related.

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

What is cohesion?

A

Cohesion refers to how closely the functions in a module are related.

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

The Or-check.

A

A class description that describes a class in terms of alternatives is probably not a class but a set of classes.

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

Name 7 types of cohesion.

A

1) Coincidental cohesion (bad)
2) Logical cohesion (bad)
3) Temporal cohesion
4) Procedural cohesion
5) Communicational cohesion
6) Sequential cohesion (very good)
7) Functional cohesion (best)

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

What is the advantage and disadvantage of functional cohesion?

A

Functional cohesion.

Advantage: Cohesive objects are easy to reuse and understand.

Disadvantage: Functionally cohesive objects can proliferate and get very tiny.

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

What does coupling do?

A

Coupling assesses how tightly a module is related to other modules. Goal is loose coupling - modules should depend on as few other modules as possible.

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

Name 9 types of coupling.

A

Types of Coupling:

  1. Content Coupling (high)
  2. Stamp Coupling (Data-structured coupling)
  3. Common Coupling
  4. Data Coupling
  5. External Coupling
  6. Message Coupling (low)
  7. Control Coupling
  8. No Coupling
  9. Semantic Coupling
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Desine semantic coupling.

A

Semantic coumpling is the most insidious kind of coupling, occurs when one module makes use not of some syntactic element of another module but of some semantic knowledge of another module’s inner workings.

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

Why is semantic coupling dangerous?

A

Semantic coupling is dangerous because changing code in the used module can break code in the using module in ways that are completely undetectable by the compiler. When code like this breaks, it breaks in subtle ways that seem unrelated to the change made in the used module, which turns debugging into a Sisyphean task.

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

State the open/closed principle.

A

A class must be closed for internal change, but must be open for extensions.

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

State the Liskov Substitution Principle.

A

Liskov Substitution Principle:

If S is a subtype of T, then objects of type T in a program may be replaced with objects of type S without altering any of the desirable properties of that program.

  • Subclass has same or weaker preconditions
  • Subclass has same or stronger postconditions
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

State the Interface Segregation Principle.

A

Interface Segregation Principle:

No client should be forced to depend on methods it does not use. Clients need only know about the methods that are of interest to them

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

State the Dependency Inversion Principle.

A

Dependency Inversion Principle:

  1. High-level modules should not depend on lowlevel modules. Both should depend on abstractions.
  2. Abstractions should not depend on details. Details should depend on abstractions.