Techniques for good Design Flashcards

1
Q

What are basic symptoms of Degenerative design?

A

Fragility - Changes lead to unforeseen errors
Rigidity - changes often bring with them lots of additional changes
Low reusablity - parts are not or cannot be reused

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

What are techniques for good design? (SOLID…)

A
  • Single Responsiblity Principle
  • Open-Closed Principle
  • Liskov’s substitution principle
  • Interface seggregation principle
  • Dependency Inversion
  • Low Coupling
  • High cohesion
  • Resolvation of cyclic dependencies
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Describe the Single Responsibility Principle (SRP)

A
  • classes should only have one reason to change
  • functional unit should only be responsible for a single aspect of a system’s requierement
  • an apsect of a requierement is a trait/property of requierements which can change seperately from other aspects
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Describe the open-closed principle

A

Sofware Modules should be
- open for extension (through polymorphism/inheritance)
- closed for modification (given logic remains reliable and unchanged)

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

Describe Liskov’s Substitution principle

A

A basic class should always be replaceable by its derived classes (subclasses)

Subclasses should behave in a expected and similiar way as the parent class.

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

Describe the Interface Seggregation Principle (ISP)

A

Extensive and complex interfaces should be subdevided, based on
- semantic context
- area of responsibility
- user groups

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

Describe the Dependency Inversion Principle

A
  • Dependencies should always be to abstract descriptions instead of concrete implementations
  • making the implementations interchangeable without necessary changes to the using class
  • no direct dependencies, instead only dependencies to abstractions
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Describe the loose coupling principle

A
  • coupling refers to the relationship between building blocks and how strong the resulting dependency is
  • loose coupling aims to reduce the complexity of structures
  • the looser the coupling the easier an individual building block is to understand
  • and the easier it is to modify
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Name a few types of coupling

A
  • Call: when a class uses directly another class my calling a method of that class
  • Generation: when a building block generates another building block
  • Data: when classes communicate via global data structures or method parameters
  • Execution location: hardware-based coupling, when building blocks have to run on same VM
  • Time: when chronological sequence of building block call impacts end results
  • Inheritance: subclass is coupled to parent class, level of coupling dependen on amount of inherited attributes
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Describe the high cohesion principle

A
  • cohesion describes how parts of a building block deal with the same theme
  • a cohesive class solves a single problem
  • influences how easily building blocks can be modified
  • low cohesion leads to one change needing additional changes in different building blocks or classes
  • classes should not be grouped by packages but instead by systems and subsystems
How well did you know this?
1
Not at all
2
3
4
5
Perfectly