evaluating design complexity Flashcards

1
Q

What are modules?

A

Modules refer to program units containing classes and the methods within them. (like a package)

A system is a combination of various modules.

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

What metrics are often used to evaluate design complexity? What are the differences between them?

A

Coupling focuses on complexity between a module and other modules.

Cohesion focuses on complexity within a module and represents the clarity of the responsibilities of a module.

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

What are metrics to evaluate the coupling of a module?

A
  1. degree: the number of connections between the module and others. A module should connect to others through a few parameters or narrow interfaces.
  2. ease: connections should be easy to make without needing to understand the implementations of other modules for coupling purposes.
  3. flexibility: Other modules should be easily replaceable for something better in the future.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are signs of a tightly coupled bad design?

A
  1. a module connects to other modules through a great number of parameters or interfaces
  2. corresponding modules to a module are difficult to find
  3. module can only be connected to specific other modules and cannot be interchanged
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Give examples of tight and loose coupling.

A

– tight coupling: a module is too reliant on other modules
– loose coupling: a module finds it easy to connect to other modules through well-defined interfaces

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

Give examples of high and low cohesion.

A

– high cohesion:
– low cohesion:
1. a module encapsulate more than one purpose or responsibility
2. if an encapsulation has to be broken to understand a method
3. if the module has an unclear purpose

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

Give examples of how complexity can be distributed between the modules or within the modules designing complex systems

A
  1. If each module is simplified to achieve high cohesion, they may need to depend more on other modules, thus increasing coupling.
  2. If connections between modules are simplified to achieve low coupling, each module may need to take on more responsibilities and thus lowering cohesion.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What are four design principles?

A

AEDG
1. Abstraction
2. Encapsulation
3. Decomposition
4. Generalization

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

What is abstraction?

A

Abstraction occurs as each concept in the problem space is separated with its own relevant attributes and behaviors.

It suggests that a concept in the problem domain should be simplified down to its essentials within some context.

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

What is encapsulation?

A

Encapsulation occurs as the attributes and behaviors are gathered together into their own section of code called a class.

Access to the class from the rest of the system and its implementation are separated, so the details of implementation can change while the view through an interface can stay the same.

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

What is decomposition?

A

Decomposition occurs as a whole class can be separated into multiple classes.

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

What is generalization?

A

Generalization occurs as commonalities are recognized into a superclass.

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

What do four access modifiers in Java do? (public, protected, default, private)

A
  1. public: everywhere in the program
  2. protected: subclasses and within package
  3. default: within package
  4. private: within class
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is a namespace

A

A namespace is a package that classes can be organized and represented by.

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

What is override?

A

Override occurs when a subclass can provide its own implementation for an inherited superclass’s method.

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