SlideShare una empresa de Scribd logo
1 de 19
Descargar para leer sin conexión
03/12/2001 1
Chap. 4
What Is Object-Orientation?
Object Oriented Systems Analysis and Design
Using UML, (3rd Edition), McGraw Hill
2
In This Lecture You Will Learn:In This Lecture You Will Learn:
The fundamental concepts of object-
orientation
The justifications for an object-oriented
approach
3
Basic ConceptsBasic Concepts
The main concepts introduced here are:
– Objects, Classes and Instances
– Object State
– Generalization and Specialization
– Message-passing and Encapsulation
– Polymorphism
4
ObjectsObjects
An object is:
“an abstraction of something in a
problem domain, reflecting the
capabilities of the system to
– keep information about it,
– interact with it,
– or both.”
Coad and Yourdon (1990)
5
AbstractionAbstraction
A form of representation that includes
only what is important or interesting
from a particular viewpoint
– Map : never shows detail of the territory
Road maps : showing roads and places
Geological maps : showing rocks and surfaces
6
ObjectsObjects
“Objects have state, behaviour and
identity.”
Booch (1994)
State: the condition of an object at any
moment, affecting how it can behave
Behaviour: what an object can do, how
it can respond to events and stimuli
Identity: each object is unique
7
Examples of ObjectsExamples of Objects
Object
A person. ‘Hussain Pervez.’ Speak, walk, read.
Studying, resting,
qualified.
A shirt.
My favourite button
white denim shirt.
Shrink, stain, rip. Pressed, dirty,
worn.
A sale. Sale no #0015,
18/05/05.
Earn loyalty points. Invoiced,
cancelled.
Identity Behaviour State
A bottle of
ketchup.
This bottle of
ketchup.
Spill in transit. Unsold, opened,
empty.
8
Class and InstanceClass and Instance
All objects are instances of some class
Class:
A description of a set of objects with
similar
– features (attributes, operations, links);
– semantics;
– constraints (e.g. when and whether an object can
be instantiated).
An abstract description for the specified
logical similarities between those objects
OMG (2004)
9
Class and InstanceClass and Instance
An object is an instance of some class
So, instance = object
– but also carries connotations of the class to
which the object belongs
Instances of a class are similar in their:
– Structure: what it knows, what information
it holds, what links it has to other objects
– Behaviour: what an object can do
10
Information structuresInformation structures
for two classesfor two classes
Class Characteristics Class Characteristics
Staff Name
Staff number
Start date
Client Name
Address
Phone number
Fax number
Email address
11
Generalization andGeneralization and
SpecializationSpecialization
Classification is hierarchic in nature
For example, a person may be an
employee, a customer, a supplier of a
service
An employee may be paid monthly,
weekly or hourly
An hourly paid employee may be a
driver, a cleaner, a sales assistant
12
Specialization HierarchySpecialization Hierarchy
Person
Employee Customer Supplier
monthly
paid
weekly
paid
hourly
paid
Driver Cleaner Sales
assistant
More general
(superclasses)
More specialized
(subclasses)
13
Generalization andGeneralization and
SpecializationSpecialization
Specialization adds additional
information:
Person
name
date of birth
gender
title
HourlyPaidDriver
startDate
standardRate
overtimeRate
licenceType
General (superclass) Specialized (subclass)
14
InheritanceInheritance
The whole description of a superclass applies
to all its subclasses, including:
– Information structure (including associations)
– Behaviour
Often known loosely as inheritance
Inheritance is how an O-O programming
language implements generalization /
specialization
15
MessageMessage--passingpassing
Several objects may collaborate to fulfil
each system action
These objects communicate by sending
each other messages
A way of insulating each object from
the need to ‘know’ any of the internal
details of other objects.
16
MessageMessage--passing andpassing and
EncapsulationEncapsulation
Message from another object
requests a service.
Operation called only via valid
operation signature.
Data accessed only by
object’s own operations.
An object’s data
is hidden
(encapsulated).
An outer layer of
operation signatures…
…gives access to middle
layer of operations…
…which can access
inner core of data
‘Layers of an onion’
model of an object:
17
PolymorphismPolymorphism
An ability to appear as many forms
Polymorphism allows one message to be sent to
objects of different classes
– Each object responds to the message in a different way
Sending object need not know what kind of object
will receive the message
Each receiving object knows how to respond
appropriately
For example, a ‘Calculate Pay’ operation
18
An Example of PolymorphismAn Example of Polymorphism
(Overriding)(Overriding)
:MonthlyPayPrint
:FullTimeEmployee
:PartTimeEmployee
:TempEmployee
Fixed monthly
amount depends only
on employee grade
Variable monthly
amount depends on
grade and hours
Fixed monthly amount
depends on grade, but
no pension deductions
Pay Clerk
1: getTotalPay()
2a: calculatePay()
2b: calculatePay()
2c: calculatePay()
19
Advantages of OAdvantages of O--OO
Can save effort
– Reuse of generalized components cuts
work, cost and time
Can improve software quality
– Encapsulation increases modularity
– Sub-systems less coupled to each other
– Better translations between analysis and
design models and working code

Más contenido relacionado

La actualidad más candente

Object database standards, languages and design
Object database standards, languages and designObject database standards, languages and design
Object database standards, languages and designDabbal Singh Mahara
 
Object Oriented Principles
Object Oriented PrinciplesObject Oriented Principles
Object Oriented PrinciplesEmprovise
 
[OOP - Lec 08] Encapsulation (Information Hiding)
[OOP - Lec 08] Encapsulation (Information Hiding)[OOP - Lec 08] Encapsulation (Information Hiding)
[OOP - Lec 08] Encapsulation (Information Hiding)Muhammad Hammad Waseem
 
Oo ps concepts in c++
Oo ps concepts in c++Oo ps concepts in c++
Oo ps concepts in c++Hemant Saini
 
Modeling a Probabilistic Ontology for Maritime Domain Awareness
Modeling a Probabilistic Ontology for Maritime Domain AwarenessModeling a Probabilistic Ontology for Maritime Domain Awareness
Modeling a Probabilistic Ontology for Maritime Domain AwarenessRommel Carvalho
 

La actualidad más candente (7)

Object database standards, languages and design
Object database standards, languages and designObject database standards, languages and design
Object database standards, languages and design
 
Basic concept of Object Oriented Programming
Basic concept of Object Oriented Programming Basic concept of Object Oriented Programming
Basic concept of Object Oriented Programming
 
Abstraction file
Abstraction fileAbstraction file
Abstraction file
 
Object Oriented Principles
Object Oriented PrinciplesObject Oriented Principles
Object Oriented Principles
 
[OOP - Lec 08] Encapsulation (Information Hiding)
[OOP - Lec 08] Encapsulation (Information Hiding)[OOP - Lec 08] Encapsulation (Information Hiding)
[OOP - Lec 08] Encapsulation (Information Hiding)
 
Oo ps concepts in c++
Oo ps concepts in c++Oo ps concepts in c++
Oo ps concepts in c++
 
Modeling a Probabilistic Ontology for Maritime Domain Awareness
Modeling a Probabilistic Ontology for Maritime Domain AwarenessModeling a Probabilistic Ontology for Maritime Domain Awareness
Modeling a Probabilistic Ontology for Maritime Domain Awareness
 

Destacado

Ciampolillo giuseppe anza' salvatore procedimento 9916 2011 memoria udienza 2...
Ciampolillo giuseppe anza' salvatore procedimento 9916 2011 memoria udienza 2...Ciampolillo giuseppe anza' salvatore procedimento 9916 2011 memoria udienza 2...
Ciampolillo giuseppe anza' salvatore procedimento 9916 2011 memoria udienza 2...Pino Ciampolillo
 
Power pointmarch2013
Power pointmarch2013Power pointmarch2013
Power pointmarch2013Van Ly
 
The history of computers in education
The history of computers in educationThe history of computers in education
The history of computers in educationMarianang
 
SourceLair Open Coffee Patras 24-10-2014
SourceLair   Open Coffee Patras 24-10-2014SourceLair   Open Coffee Patras 24-10-2014
SourceLair Open Coffee Patras 24-10-2014Christos Konstandinidis
 
La Cosa Più terribile e La mafioso dell'antimafia
La Cosa Più terribile e La mafioso dell'antimafiaLa Cosa Più terribile e La mafioso dell'antimafia
La Cosa Più terribile e La mafioso dell'antimafiaPino Ciampolillo
 
Piano aria sicilia glossario da pag 237 a pag 239 piano veneto da pag 233 a ...
Piano aria sicilia glossario da pag 237 a pag 239  piano veneto da pag 233 a ...Piano aria sicilia glossario da pag 237 a pag 239  piano veneto da pag 233 a ...
Piano aria sicilia glossario da pag 237 a pag 239 piano veneto da pag 233 a ...Pino Ciampolillo
 

Destacado (9)

Ciampolillo giuseppe anza' salvatore procedimento 9916 2011 memoria udienza 2...
Ciampolillo giuseppe anza' salvatore procedimento 9916 2011 memoria udienza 2...Ciampolillo giuseppe anza' salvatore procedimento 9916 2011 memoria udienza 2...
Ciampolillo giuseppe anza' salvatore procedimento 9916 2011 memoria udienza 2...
 
Power pointmarch2013
Power pointmarch2013Power pointmarch2013
Power pointmarch2013
 
算数1
算数1算数1
算数1
 
The history of computers in education
The history of computers in educationThe history of computers in education
The history of computers in education
 
Anza' salvatore pdf
Anza' salvatore pdfAnza' salvatore pdf
Anza' salvatore pdf
 
SourceLair Open Coffee Patras 24-10-2014
SourceLair   Open Coffee Patras 24-10-2014SourceLair   Open Coffee Patras 24-10-2014
SourceLair Open Coffee Patras 24-10-2014
 
La Cosa Più terribile e La mafioso dell'antimafia
La Cosa Più terribile e La mafioso dell'antimafiaLa Cosa Più terribile e La mafioso dell'antimafia
La Cosa Più terribile e La mafioso dell'antimafia
 
ITALCEMENTI
 ITALCEMENTI  ITALCEMENTI
ITALCEMENTI
 
Piano aria sicilia glossario da pag 237 a pag 239 piano veneto da pag 233 a ...
Piano aria sicilia glossario da pag 237 a pag 239  piano veneto da pag 233 a ...Piano aria sicilia glossario da pag 237 a pag 239  piano veneto da pag 233 a ...
Piano aria sicilia glossario da pag 237 a pag 239 piano veneto da pag 233 a ...
 

Similar a Bennett chap 4

Ooad notes
Ooad notesOoad notes
Ooad notesNancyJP
 
Object oriented programming concept
Object oriented programming conceptObject oriented programming concept
Object oriented programming conceptPina Parmar
 
SE_Lec 06_Object Oriented Analysis and Design
SE_Lec 06_Object Oriented Analysis and DesignSE_Lec 06_Object Oriented Analysis and Design
SE_Lec 06_Object Oriented Analysis and DesignAmr E. Mohamed
 
SE18_Lec 06_Object Oriented Analysis and Design
SE18_Lec 06_Object Oriented Analysis and DesignSE18_Lec 06_Object Oriented Analysis and Design
SE18_Lec 06_Object Oriented Analysis and DesignAmr E. Mohamed
 
L1-Introduction to OOPs concepts.pdf
L1-Introduction to OOPs concepts.pdfL1-Introduction to OOPs concepts.pdf
L1-Introduction to OOPs concepts.pdfBhanuJatinSingh
 
Object Oriented Programming
Object Oriented ProgrammingObject Oriented Programming
Object Oriented ProgrammingAyushiDubey19
 
OO Development 4 - Object Concepts
OO Development 4 - Object ConceptsOO Development 4 - Object Concepts
OO Development 4 - Object ConceptsRandy Connolly
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programmingAmit Soni (CTFL)
 
Bt8901 objective oriented systems1
Bt8901 objective oriented systems1Bt8901 objective oriented systems1
Bt8901 objective oriented systems1Techglyphs
 
M01_OO_Intro.ppt
M01_OO_Intro.pptM01_OO_Intro.ppt
M01_OO_Intro.pptRojaPogul1
 
Classes and Objects
Classes and Objects  Classes and Objects
Classes and Objects yndaravind
 

Similar a Bennett chap 4 (20)

Ooad notes
Ooad notesOoad notes
Ooad notes
 
Object oriented programming concept
Object oriented programming conceptObject oriented programming concept
Object oriented programming concept
 
Ashish oot
Ashish ootAshish oot
Ashish oot
 
SE_Lec 06_Object Oriented Analysis and Design
SE_Lec 06_Object Oriented Analysis and DesignSE_Lec 06_Object Oriented Analysis and Design
SE_Lec 06_Object Oriented Analysis and Design
 
SE18_Lec 06_Object Oriented Analysis and Design
SE18_Lec 06_Object Oriented Analysis and DesignSE18_Lec 06_Object Oriented Analysis and Design
SE18_Lec 06_Object Oriented Analysis and Design
 
Oops slide
Oops slide Oops slide
Oops slide
 
L1-Introduction to OOPs concepts.pdf
L1-Introduction to OOPs concepts.pdfL1-Introduction to OOPs concepts.pdf
L1-Introduction to OOPs concepts.pdf
 
OOPS in Java
OOPS in JavaOOPS in Java
OOPS in Java
 
07 intro2 oop
07 intro2 oop07 intro2 oop
07 intro2 oop
 
Week1
Week1Week1
Week1
 
Object Oriented Programming
Object Oriented ProgrammingObject Oriented Programming
Object Oriented Programming
 
OO Development 4 - Object Concepts
OO Development 4 - Object ConceptsOO Development 4 - Object Concepts
OO Development 4 - Object Concepts
 
OOSD1-unit1_1_16_09.pptx
OOSD1-unit1_1_16_09.pptxOOSD1-unit1_1_16_09.pptx
OOSD1-unit1_1_16_09.pptx
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
 
Introduction of OOPs
Introduction of OOPsIntroduction of OOPs
Introduction of OOPs
 
Bt8901 objective oriented systems1
Bt8901 objective oriented systems1Bt8901 objective oriented systems1
Bt8901 objective oriented systems1
 
M01_OO_Intro.ppt
M01_OO_Intro.pptM01_OO_Intro.ppt
M01_OO_Intro.ppt
 
Ooad ch 1_2
Ooad ch 1_2Ooad ch 1_2
Ooad ch 1_2
 
Classes and Objects
Classes and Objects  Classes and Objects
Classes and Objects
 
2.oop concept
2.oop concept2.oop concept
2.oop concept
 

Último

Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 

Último (20)

Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 

Bennett chap 4

  • 1. 03/12/2001 1 Chap. 4 What Is Object-Orientation? Object Oriented Systems Analysis and Design Using UML, (3rd Edition), McGraw Hill
  • 2. 2 In This Lecture You Will Learn:In This Lecture You Will Learn: The fundamental concepts of object- orientation The justifications for an object-oriented approach
  • 3. 3 Basic ConceptsBasic Concepts The main concepts introduced here are: – Objects, Classes and Instances – Object State – Generalization and Specialization – Message-passing and Encapsulation – Polymorphism
  • 4. 4 ObjectsObjects An object is: “an abstraction of something in a problem domain, reflecting the capabilities of the system to – keep information about it, – interact with it, – or both.” Coad and Yourdon (1990)
  • 5. 5 AbstractionAbstraction A form of representation that includes only what is important or interesting from a particular viewpoint – Map : never shows detail of the territory Road maps : showing roads and places Geological maps : showing rocks and surfaces
  • 6. 6 ObjectsObjects “Objects have state, behaviour and identity.” Booch (1994) State: the condition of an object at any moment, affecting how it can behave Behaviour: what an object can do, how it can respond to events and stimuli Identity: each object is unique
  • 7. 7 Examples of ObjectsExamples of Objects Object A person. ‘Hussain Pervez.’ Speak, walk, read. Studying, resting, qualified. A shirt. My favourite button white denim shirt. Shrink, stain, rip. Pressed, dirty, worn. A sale. Sale no #0015, 18/05/05. Earn loyalty points. Invoiced, cancelled. Identity Behaviour State A bottle of ketchup. This bottle of ketchup. Spill in transit. Unsold, opened, empty.
  • 8. 8 Class and InstanceClass and Instance All objects are instances of some class Class: A description of a set of objects with similar – features (attributes, operations, links); – semantics; – constraints (e.g. when and whether an object can be instantiated). An abstract description for the specified logical similarities between those objects OMG (2004)
  • 9. 9 Class and InstanceClass and Instance An object is an instance of some class So, instance = object – but also carries connotations of the class to which the object belongs Instances of a class are similar in their: – Structure: what it knows, what information it holds, what links it has to other objects – Behaviour: what an object can do
  • 10. 10 Information structuresInformation structures for two classesfor two classes Class Characteristics Class Characteristics Staff Name Staff number Start date Client Name Address Phone number Fax number Email address
  • 11. 11 Generalization andGeneralization and SpecializationSpecialization Classification is hierarchic in nature For example, a person may be an employee, a customer, a supplier of a service An employee may be paid monthly, weekly or hourly An hourly paid employee may be a driver, a cleaner, a sales assistant
  • 12. 12 Specialization HierarchySpecialization Hierarchy Person Employee Customer Supplier monthly paid weekly paid hourly paid Driver Cleaner Sales assistant More general (superclasses) More specialized (subclasses)
  • 13. 13 Generalization andGeneralization and SpecializationSpecialization Specialization adds additional information: Person name date of birth gender title HourlyPaidDriver startDate standardRate overtimeRate licenceType General (superclass) Specialized (subclass)
  • 14. 14 InheritanceInheritance The whole description of a superclass applies to all its subclasses, including: – Information structure (including associations) – Behaviour Often known loosely as inheritance Inheritance is how an O-O programming language implements generalization / specialization
  • 15. 15 MessageMessage--passingpassing Several objects may collaborate to fulfil each system action These objects communicate by sending each other messages A way of insulating each object from the need to ‘know’ any of the internal details of other objects.
  • 16. 16 MessageMessage--passing andpassing and EncapsulationEncapsulation Message from another object requests a service. Operation called only via valid operation signature. Data accessed only by object’s own operations. An object’s data is hidden (encapsulated). An outer layer of operation signatures… …gives access to middle layer of operations… …which can access inner core of data ‘Layers of an onion’ model of an object:
  • 17. 17 PolymorphismPolymorphism An ability to appear as many forms Polymorphism allows one message to be sent to objects of different classes – Each object responds to the message in a different way Sending object need not know what kind of object will receive the message Each receiving object knows how to respond appropriately For example, a ‘Calculate Pay’ operation
  • 18. 18 An Example of PolymorphismAn Example of Polymorphism (Overriding)(Overriding) :MonthlyPayPrint :FullTimeEmployee :PartTimeEmployee :TempEmployee Fixed monthly amount depends only on employee grade Variable monthly amount depends on grade and hours Fixed monthly amount depends on grade, but no pension deductions Pay Clerk 1: getTotalPay() 2a: calculatePay() 2b: calculatePay() 2c: calculatePay()
  • 19. 19 Advantages of OAdvantages of O--OO Can save effort – Reuse of generalized components cuts work, cost and time Can improve software quality – Encapsulation increases modularity – Sub-systems less coupled to each other – Better translations between analysis and design models and working code