Download as odp, pdf, or txt
Download as odp, pdf, or txt
You are on page 1of 26

Module

Object Oriented Concepts and Unified Modelling Language (UML)


Instructor: Fred. Yeboah Email:fredericky@aiti-kace.com.gh

concept

OOP

Literature
ObjectOrientedAnalysisandDesign AuthorsMcLaughlin,PolliceandWest O'Reilly (AvailableinLibrary)

ObjectOrientedTechnologyfromDiagramtocodewith VisualParadigmforUML. AuthorsC.H.K.Tsang,ClarenceSWLau,YingK.Leung PublisherMcGrawHill ISBN:0071240462

ObjectOrientedSystemAnalysisandDesignusingUML AuthorsSimonBennett,SteveMcRobbandRayFarmer PublisherMcGrawHill ISBN:0077098641

concept

OOP

CourseObjectives
Introducebasicconceptsandprinciplesof

ObjectOrientedparadigm

IntroducebasicUMLnotationsassociated

withObjectOrientedconcepts
PresentsomeofthebasicUMLmodelling

approachesandexamples
LearnhowtodrawandinterpretUseCase

andClassdiagram(s)

concept

OOP

Objectives:
HistoryofObjectOrientation(OO) DefinitionofOOP? Basic(OO)Concepts Basic(OO)DesignElements

concept

OOP

HistoricalDevelopment
ObjectOriented(OO)firstmentionedin1960
Objectasentitywasintroducedby OleJohanDahl(programmer)&KristenNygaard atNorwegianComputingCentreinOslo

ThenameoftheirlanguagewasSIMULA1
aspecializedprogramminglanguageforsimulation

Note!Simula1wasnotacompleteOOPlanguage

concept

OOP

TheSimulaStory
"The status on the Simulation Language (Monte Carlo Compiler) is that I have rather clear ideas on how to describe queuing systems, and have developed concepts which I feel allow a reasonably easy description of large classes of situations. [...] The work on the compiler could not start before the language was fairly well developed, but this stage seems now to have been reached. The expert programmer who is interested in this part of the job will meet me tomorrow. He has been rather optimistic during our previous meetings."

The picture shows K. Nygaard describing and classes he designed.


OOP

concept

HistoricalDevelopment2
In1970SmalltalkwasinventedatXeroxPARC AlanKay

Smalltalkwasfirsttoimplementmessage passing

In1985Eiffelwasbornby BertrandMeyerandsupports:


concept

useforlargeprojects multipleinheritance garbagecollectioncapabilities staticallytyped

OOP

HistoricalDevelopment3
In1979developmentofC++wasstartedby
BjarneStroustoup

supportsmultipleinheritance abstraction staticallyweaktype


In1990Javawasbornby JamesGoslingandcolleages:

supportssingleiheritance compiletobytecode,NOT!nativecode platformindependence


concept

OOP

Resultsofdevelopment
Newwayofthinkinginsoftwaredevelopment
intermsofrealworldobjects

Newmethodsofsoftwaredevelopment
Evolutionmodel,Iterationmodel(RUP),etc...

Newwayofanalysingproblemstatement
Basedonclassesandobjects

Awayofimplementingconcepts
abstraction,inheritance,etc...
concept

OOP

WhatisOOP?
Object-oriented programming is a method of implementation in which programs are organized as cooperative collections of objects, each of which represents an instance of some class, and whose classes are all members of a hierarchy of classes united via inheritance relationships.

concept

OOP

10

BasicConcepts
ObjectOrientedParadigm/Concept Abstraction Encapsulation Modularity Hierarchy Polymorphism*

concept

OOP

11

Abstraction
Isaboutgroupingofgeneralcharacteristicsofan objectidentifiedinproblemdomainthatdistinguishit fromallotherkindsofobjects.
AbstractionistheRepresentationofessential

featuresofanobject.
OOusesabstractiontodepictclasses Abstractionallowmanagementofcomplexity

byconcentratingonessentialcharacteristicsthat makesanentitydifferentfromothers.
12

concept

OOP

AbstractionExample

Customer Mechanic Not saying Which Mechanic just a mechanic in general!!!


concept

Products 13

OOP

Encapsulation

Encapsulation is an OO design concept, which provides the ability to hold all features of an object in virtual container while allowing changes in requirements to be effected on the object.
changes changes

in requirements in problem scope

It separates implementation of objects behaviour from its public interface It is sometimes called information hiding. It allows object behaviour to be used without knowing its implementation
Offers

two kinds of security:


14

concept

OOP

Protects objects internal state Make changes without affecting other objects

EncapsulationExample
Considerproductorderapplication.

concept

OOP

15

Modularity
Modularity

can be defined as the process of breaking up of a complex system into small, self contained pieces that can be managed easily. and subsystems support the definition of the modularity. are independent modules

Packages

Classes

concept

OOP

16

Modularity
Thebreakingupofsomethingcomplexinto

manageablepieces

Order Entry
Order Processing System

Order Fulfilment Billing


Manages Complexity

concept

OOP

17

Hierarchy
Any

ranking or ordering of abstractions into a tree-like structure. of hierarchy: Class Aggregation Containment Inheritance Partition Specialization
18

Type

concept

OOP

HierarchyExample
Increasing abstraction

Levelsofabstraction
Asset

Bank A/C Security

Real Estate

Savings Checking
Decreasing abstraction

Stock

Bond

concept

OOP

19

Polymorphism
abilitytodesignafunctionordatatypesuch

thatitcanreactdifferentlytodifferent situations

Youcandefineagenericobjecttotakedifferentform Defineafunctionwhichprovidesameservicebutdifferent

messagedependingandmemoryontheobject

Example:
CowaCow=newCow(jojo");

PersonaMan=newPerson(John"); aCow.cry(); aMan.cry();


concept

OOP

Thinkofshapesclassesandarea_function()

20

BasicElements
Object Class Attribute Operation Message Interface

(Polymorphism) Component Package Subsystem Relationships


concept

OOP

21

WhatisanObject?
A

concrete manifestation of an abstraction; an entity with a well-defined boundary and identity that encapsulates state and behaviour; an instance of a class.(Booch, 1999) object has:
State:

An

a condition in which an object may be at a time, implemented by a set of properties (attributes) with their values and the relationships with other objects) Behaviour: is about how the object act and react Identity: makes two objects different even in case they have the same state and behaviour
concept

OOP

22

Objectandproperties

concept

OOP

23

WhyObjects?
Objects

serve two purposes:


understanding of the real-world.

promote They

provide practical basis for computer implementation.

In

a problem domain nouns and noun phrases help in identifying the objects.

concept

OOP

24

ObjectType..
PhysicalObject:
objectswecantouchandfeel(books,abus,acomputer,etc..)

ConceptualObject:
intangibleobjectswhichplaysaroleinaDomain Example:

bankaccount>BankingDomain transaction>BankingDomain timeschedule>ProjectManagementDomain

DomainObject:
tendstobestableinthedevelopmentlifecycle donotchangeevenifthereisachangeinrequirements
concept

OOP

Example:(Customers,Teller,andbankinATMsystem)

25

..ObjectType
ImplementationObject:
Objectswhicharenotrelatedtorealworldentities Changewhenrequirementschange Example:

accountreports/accountslip

ActiveObject:
Objectsthatcanchangeitsownstate Itisreferredtoasanobjectswithlife Theyareusuallyimplementedasprocessesorthreads Example:

timerandclock

PassiveObject:
changestheirstateonlyuponreceivingexternalmessage
OOP

26

concept

You might also like