You are on page 1of 20

Binu B Nair

Review of Object oriented Concepts Generalization Inheritance Dependency Association Abstraction Aggregation Composition

object Data + Methods object State + Behavior

It would have data: How hungry it is How frightened it is Where it is And methods: eat, hide, run

dependency is a semantic relationship where a change to the influent or independent modeling element may affect the semantics of the dependent modeling element. The most general relationship between two packages

Generalization is the process of extracting shared characteristics from two or more classes, and combining them into a generalized superclass. Shared characteristics can be attributes, associations, or methods.
Is-a relationship Broader level inheritance

Eg: A student is a person.

If B is a subclass of A

A objects can be assigned to A variables B objects can be assigned to B variables B objects can be assigned to A variables, but A objects can not be assigned to B variables

Every B is also an A but not every A is a B

class Dog { ... }


class Pomeranian extends Dog { ... } Dog myDog; Dog rover = new Dog (); Pomeranian yourPomeranian;

Pomeranian myPomeranian = new Pomeranian ();


myDog = rover; yourPomeranian = myPomeranian ; myDog = myPomeranian ;

yourPomeranian = rover;
yourPomeranian = (Pomeranian ) rover;

They

can exist without each other Is a relationship where all object have their own lifecycle and there is no owner

An

abstraction relationship is a dependency between model elements that represents the same concept at different levels of abstraction or from different viewpoints One model element, the client, is more refined or detailed than the other, the supplier. Abstraction relationships do not usually have names and appear as a dashed line with an open arrow pointing from the detailed model element to the general model element.

Derivation
Realization

Realization

is a relationship between the blueprint class and the object containing its respective implementation level details The relationship between the interface and the implementing class

Has-a

relationship is a specialize form of Association All object have their own lifecycle Child object can not belongs to another parent object. Department and teacher. A single teacher can not belongs to multiple departments, but if we delete the department teacher object will not destroy. We can think about has-a relationship

It is a strong type of Aggregation The Death relationship The lifetimes of both the objects are the same. Manager and the project objects are dependent on each other. If one goes for garbage collection the other also has to be garbage collected

??

Thanks .!!!

You might also like