OO Relationships (PPT 11 - 13) Flashcards Preview

Object Oriented Analysis and Design > OO Relationships (PPT 11 - 13) > Flashcards

Flashcards in OO Relationships (PPT 11 - 13) Deck (23):
1

What is a relationship?

Collaboration between objects

2

What is an association relationship?

Association represents a link/memory between objects. Messages may flow in either direction across the association

3

How do we name an association?

It is stated in terms of the objects being associated. The combination of objects and association name should read like a sentence

4

How many associations can an object have?

It can have as many as it wants and can also have as many associations between objects as you want

5

What is a reflexive association?

Associations which involve only one class of object

6

What are role names?

Used to indicate the role performed by each end of the association

7

What is multiplicity?

The number of instances of objects which may be involved at either end of the association

8

What is a composition relationship?

It is a stronger form of association, relates a whole object to its parts. Represented by a line with a filled in diamond on the end. Idea is one object is either physically part of another or is exclusively owned by another one

9

What is a aggregation relationship?

It is a slightly weaker form of composition. Means a part may outlive the whole it is part of. The owner only has temporary ownership, not exclusive ownership

10

What is a dependency?

Where objects come into temporary contact with each other during the running of the program

11

How do we know if we need a relationship?

-If one class creates an instance of another one
-If one class received an instance of another on as input to a method/function
-If one class has an instance of another one as one of its fields/attributes

12

What is a uni-directional association?

Messages only travel in one direction. Helps protect coupling and reuse

13

What is a generalisation?

Relationship between a general concept and its more specific forms. Allows parent child hierarchies

14

What is a superclass?

It is a class which represents a general concept. Defines characteristics and behaviours expected of any type of this class, e.g. shape

15

What does a subclass inherit?

It automatically inherits all characteristics and behaviour from it parent

16

What is the difference between Generalisation and Specialisation?

Generalisation
-From the bottom up
-Uses superclass

Specialisation
-Top down
-Usually apparent in the application domain

17

What are the golden rules of inheritance?

-Must model as a is-a relationship
-Child concept remains the same for its lifetime

18

What is polymorphism?

Any instance of a child class can be used anywhere an instance of the parent is expected

19

What is overriding?

A child class may refine or replace a feature inherited from a parent class by defining a feature with the same name

20

What is an abstract class?

It is a class which is an abstract concept, such as a shape

21

What is an interface?

A construct to specify a common piece of behaviour required by a system. No implementation is provided, another class has to implement the operations

22

What are the differences between abstract and interface classes?

Abstract class are what an object is while interface is what an object does
Identifying
-Abstract: usual inheritance rules apply
-Interface: when disparate concepts wish to provide the same behaviour

Structure
-Abstract:define attributes, operations, relationships
-Interface: define operations only

23

What are some dangers with Inheritance?

-Inheritance may create fragile hierarchies (changes to a parent can ripple throughout the code)
-Inheritance is said to provide weak encapsulation (parent class has direct access to innards of child class)