object_oriented_concepts_(1).pptx

20
Binu B Nair

Upload: hkgrao

Post on 14-Apr-2018

238 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Object_Oriented_Concepts_(1).pptx

7/30/2019 Object_Oriented_Concepts_(1).pptx

http://slidepdf.com/reader/full/objectorientedconcepts1pptx 1/20

Binu B Nair

Page 2: Object_Oriented_Concepts_(1).pptx

7/30/2019 Object_Oriented_Concepts_(1).pptx

http://slidepdf.com/reader/full/objectorientedconcepts1pptx 2/20

Review of Object oriented Concepts

Generalization

Inheritance

Dependency Association

Abstraction

Aggregation

Composition

Page 3: Object_Oriented_Concepts_(1).pptx

7/30/2019 Object_Oriented_Concepts_(1).pptx

http://slidepdf.com/reader/full/objectorientedconcepts1pptx 3/20

object Data + Methods

object   State + Behavior

Page 4: Object_Oriented_Concepts_(1).pptx

7/30/2019 Object_Oriented_Concepts_(1).pptx

http://slidepdf.com/reader/full/objectorientedconcepts1pptx 4/20

It would have data:

How hungry it is

How frightened it is

Where it is

And methods:

eat, hide, run

Page 5: Object_Oriented_Concepts_(1).pptx

7/30/2019 Object_Oriented_Concepts_(1).pptx

http://slidepdf.com/reader/full/objectorientedconcepts1pptx 5/20

A dependency is a semantic relationship

where a change to the influent or

independent modeling element may affect

the semantics of the dependent modelingelement.

The most general relationship between two

packages

Page 6: Object_Oriented_Concepts_(1).pptx

7/30/2019 Object_Oriented_Concepts_(1).pptx

http://slidepdf.com/reader/full/objectorientedconcepts1pptx 6/20

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.

Page 7: Object_Oriented_Concepts_(1).pptx

7/30/2019 Object_Oriented_Concepts_(1).pptx

http://slidepdf.com/reader/full/objectorientedconcepts1pptx 7/20

Page 8: Object_Oriented_Concepts_(1).pptx

7/30/2019 Object_Oriented_Concepts_(1).pptx

http://slidepdf.com/reader/full/objectorientedconcepts1pptx 8/20

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 

Page 9: Object_Oriented_Concepts_(1).pptx

7/30/2019 Object_Oriented_Concepts_(1).pptx

http://slidepdf.com/reader/full/objectorientedconcepts1pptx 9/20

  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;

Page 10: Object_Oriented_Concepts_(1).pptx

7/30/2019 Object_Oriented_Concepts_(1).pptx

http://slidepdf.com/reader/full/objectorientedconcepts1pptx 10/20

They can exist without each other

Is a relationship where all object have their

own lifecycle and there is no owner

Page 11: Object_Oriented_Concepts_(1).pptx

7/30/2019 Object_Oriented_Concepts_(1).pptx

http://slidepdf.com/reader/full/objectorientedconcepts1pptx 11/20

 

Page 12: Object_Oriented_Concepts_(1).pptx

7/30/2019 Object_Oriented_Concepts_(1).pptx

http://slidepdf.com/reader/full/objectorientedconcepts1pptx 12/20

An abstraction relationship is a dependency

between model elements that represents the

same concept at different levels of 

abstraction or from different viewpointsOne model element, the client, is more

refined or detailed than the other, the

supplier.

Abstraction relationships do not usually havenames and appear as a dashed line with an

open arrow pointing from the detailed model

element to the general model element.

Page 13: Object_Oriented_Concepts_(1).pptx

7/30/2019 Object_Oriented_Concepts_(1).pptx

http://slidepdf.com/reader/full/objectorientedconcepts1pptx 13/20

Derivation

Realization

Page 14: Object_Oriented_Concepts_(1).pptx

7/30/2019 Object_Oriented_Concepts_(1).pptx

http://slidepdf.com/reader/full/objectorientedconcepts1pptx 14/20

Realization is a relationship between the

blueprint class and the object containing its

respective implementation level details

The relationship between the interface andthe implementing class

Page 15: Object_Oriented_Concepts_(1).pptx

7/30/2019 Object_Oriented_Concepts_(1).pptx

http://slidepdf.com/reader/full/objectorientedconcepts1pptx 15/20

“Has-a” relationship 

is a specialize form of Association

All object have their own lifecycle

Child object can not belongs to anotherparent 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 

Page 16: Object_Oriented_Concepts_(1).pptx

7/30/2019 Object_Oriented_Concepts_(1).pptx

http://slidepdf.com/reader/full/objectorientedconcepts1pptx 16/20

Page 17: Object_Oriented_Concepts_(1).pptx

7/30/2019 Object_Oriented_Concepts_(1).pptx

http://slidepdf.com/reader/full/objectorientedconcepts1pptx 17/20

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

Page 18: Object_Oriented_Concepts_(1).pptx

7/30/2019 Object_Oriented_Concepts_(1).pptx

http://slidepdf.com/reader/full/objectorientedconcepts1pptx 18/20

Page 19: Object_Oriented_Concepts_(1).pptx

7/30/2019 Object_Oriented_Concepts_(1).pptx

http://slidepdf.com/reader/full/objectorientedconcepts1pptx 19/20

 

??

Page 20: Object_Oriented_Concepts_(1).pptx

7/30/2019 Object_Oriented_Concepts_(1).pptx

http://slidepdf.com/reader/full/objectorientedconcepts1pptx 20/20

 

Thanks ….!!!