Object Design Flashcards

1
Q

What is the purpose of Object Design?

A
  • prepare for implementation of the system model based on design decisions
  • optimize system model
  • investigate alternative ways to implement system models following design goals
  • Serves as basis of implementation
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are the 4 main activities in object design?

A

• Reuse: identification of existing solutions, use of inheritance, off-the shelf components & additional solution objects, design patterns, open source
• Interface specification: describes precisely each class interface
• Object model restructuring: transforms object design model to improve its
understandability & extensibility
• Object model optimization: transforms object design model to address performance criteria
such as response time or memory utilization

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

What is the difference between Generalisation and Specialisation? Shortly describe each.

A
• Generalisation: discovery of inheritance association btw. two classes, where the sub class is discovered first, often occurs in
    o Biology: first we find individual animals (e.g. elephant, lion, tiger), then we discover common properties among those animals and give them a name (e.g. mammal)
o Engineering: inventory on the machines produced by two companies that were recently merged, then define common interface to be shared by all machines

• Specialisation: discovery of inheritance association btw. two classes, where the super class is discovered first

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

What is a Design Pattern?

A

Pattern: describes a problem which occurs over and over again in our environment & then describes the core of the solution to solve the problem in a way that you can use this solution a million times over, without ever doing it the same way twice.

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

Name and shortly describe the 3 types of Design patterns.

A
Structural patterns:
• reduce coupling btw. one or more classes
• introduce an abstract class to enable extensions
• Encapsulate complex structures

Behavioral patterns:
• Allow choices btw. algorithms
• Allow assignment of responsibilities to objects
• Model complex control flows

Creational patterns:
• Allow to abstract from complex instantiation processes
• Make the system independent from the way its objects are created, composed &
represented

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

Composite Pattern: What problem does it solve and how does it do so?

A

Problem: There are hierarchies with arbitrary depth and width (e.g. folders and files)

Solution: Individual Classes called Leafs and Composite inherit from a Component Class. Composite class can have multiple Components as children

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

Bridge Pattern: What problem does it solve and how does it do so?

A

Problem: Many design decisions are made final at design time or at compile time

Solution: The bridge pattern allows to delay the binding between an interface and its subclass to the startup time of the system

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

Proxy Pattern: What problems does it solve and how does it do so? Name at least 1 problem (out of 2)

A
  • Problem #1: The object is complex, its instantiation is expensive
  • Solution: Delay the instantiation until the object is actually used & If the object is never used, then the costs for its instantiation do not occur
  • Problem #2: The object is located on another node (i.e on a web server), accessing the object is expensive
  • Solution: Instantiate and initialize a “smaller” local object, which acts as a representative (“proxy”) for the remote object & Instantiate and initialize a “smaller” local object, which acts as a representative (“proxy”) for the remote object & Access the remote object only if really necessary
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Adapter Pattern: What problem does it solve and how does it do so?

A

Problem: An old “outdated” legacy system is being used but is irreplaceable

Solution: The adapter pattern connects incompatible components and allows the reuse of the system

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

Observer Pattern: What problem does it solve and how does it do so?

A

Problem: An object that changes its state often and/or Multiple views of the current state

Solution:

  • model a 1-to-many dependency between objects
  • Connect the state of an observed object, the subject with many observing objects, the observers
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Strategy Pattern: What problem does it solve and how does it do so?

A

Problem: Different algorithms exist for a specific task

Solution: The strategy pattern allows to switch between different algorithms at run time based on the context and a policy

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