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):

What is a relationship?

Collaboration between objects


What is an association relationship?

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


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


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


What is a reflexive association?

Associations which involve only one class of object


What are role names?

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


What is multiplicity?

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


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


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


What is a dependency?

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


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


What is a uni-directional association?

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


What is a generalisation?

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


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


What does a subclass inherit?

It automatically inherits all characteristics and behaviour from it parent


What is the difference between Generalisation and Specialisation?

-From the bottom up
-Uses superclass

-Top down
-Usually apparent in the application domain


What are the golden rules of inheritance?

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


What is polymorphism?

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


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


What is an abstract class?

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


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


What are the differences between abstract and interface classes?

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

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


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)