SlideShare a Scribd company logo
1 of 16
1
 A class is an OO concept that encapsulates the data and
procedural abstractions required to describe the content and
behavior of
some real world entity
2
Taylor {TAY90] uses the notation shown on the right side
of Figure to describe a class (and objects derived from a
class)
An alternative
representation
of an object oriented class
 The data abstractions (attributes) that describe the class are
enclosed by a “wall” of procedural abstractions (called
operations, methods, or services) that are capable of
manipulating the data in some way.
 The only way to reach the attributes (and operate on them) is to
go through one of the methods that form the wall.
 Therefore, the class encapsulates data (inside the wall) and the
processing that manipulates the data (the methods that make up
the wall)
3
 This achieves information hiding and reduces the impact of side
effects associated with change
 Since the methods tend to manipulate a limited number of
attributes, they are cohesive; and because communication occurs
only through the methods that make up the “wall,” the class tends
to be decoupled from other elements of a system.
 All of these design characteristics lead to high quality software.
4
 Stated another way, a class is a generalized description (e.g., a
template, pattern, or blueprint) that describes a collection of
similar objects
 By definition, all objects that exist within a class inherit its
attributes and the operations that are available to manipulate the
attributes
 A superclass is a collection of classes, and a subclass is a
specialized instance of a class
5
 These definitions imply the existence of a class hierarchy in
which the attributes and operations of the superclass are
inherited by subclasses that may each add additional
“private” attributes and methods.
 A class hierarchy for the class furniture is illustrated in
Figure on next slide .
6
7
Real life entities are often described with words that
indicate stable features. Most physical objects have
features such as shape, weight, color, and type of
material. People have features including date of
birth, parents, name, and eye color. A feature may
be seen as a binary relation between a class and
a certain domain
Automobile: color{white, black, silver, gray, blue, red,
yellow, green}
 An object encapsulates data (represented as a collection of attributes)
and the algorithms that process the data. These algorithms are called
operations, methods, or services1 and can be viewed as modules in a
conventional sense.
 Each of the operations that is encapsulated by an object provides a
representation of one of the behaviors of the object
 For example, the operation GetColor for the object automobile will
extract the color stored in the color attribute
8
 The implication of the existence of this operation is that the class
automobile has been designed to receive a stimulus [JAC92]
(we call the stimulus a message) that requests the color of the
particular instance of a class
 Whenever an object receives a stimulus, it initiates some
behavior
 This can be as simple as retrieving the color of automobile or as
complex as the initiation of a chain of stimuli that are passed
among a variety of different objects
9
 In the latter case, consider an example in which the initial
stimulus received by object 1 results in the generation of two
other stimuli that are sent to object 2 and object 3
 Operations encapsulated by the second and third objects act on
the stimuli, returning necessary information to the first object
 Object 1 then uses the returned information to satisfy the
behavior demanded by the initial stimulus
10
 Messages are the means by which objects interact
 Using the terminology introduced in the preceding slides, a
message stimulates some behavior to occur in the receiving
object.
 The behavior is accomplished when an operation is executed
 Whenever an object is stimulated by a message, it initiates some
behavior by executing an operation.
11
12
 The interaction between messages is illustrated
schematically in the figure. An operation within a sender
object generates a message of the form
Message: [destination, operation, parameters]
 where destination defines the receiver object that is
stimulated by the message, operation refers to the operation
that is to receive the message, and parameters provides
information that is required for the operation to be successful.
13
 As an example of message passing within an OO system, consider
the objects shown in Figure on slide 16. Four objects, A, B, C, and D
communicate with one another by passing messages. For example, if
object B requires processing associated with operation op10 of object
D, it would send D a message of the form
message: [D, op10, {data}]
As part of the execution of op10, object D may send a message to object
C of the form
message: (C, op08, {data})
14
 Then C finds op08, performs it, and sends an appropriate
return value to D. Operation op10 completes and sends a
return value to B
 Cox {COX86] describes the interchange between objects in
the following manner:
An object is requested to perform one of its operations by sending it a message telling
the object what to do. The receiver [object] responds to the message by first choosing
the operation that implements the message name, executing this operation, and then
returning
control to the caller.
15
16
Messaging ties an object-oriented system together.
Messages provide insight into the behavior
of individual objects and the OO system as a whole

More Related Content

What's hot

Function Oriented Design
Function Oriented DesignFunction Oriented Design
Function Oriented DesignSharath g
 
Window to viewport transformation&matrix representation of homogeneous co...
Window to viewport transformation&matrix representation of homogeneous co...Window to viewport transformation&matrix representation of homogeneous co...
Window to viewport transformation&matrix representation of homogeneous co...Mani Kanth
 
Sequence diagram
Sequence diagramSequence diagram
Sequence diagramRahul Pola
 
Visible surface detection in computer graphic
Visible surface detection in computer graphicVisible surface detection in computer graphic
Visible surface detection in computer graphicanku2266
 
object oriented Programming ppt
object oriented Programming pptobject oriented Programming ppt
object oriented Programming pptNitesh Dubey
 
Dotnet framework difference faqs- 3
Dotnet framework difference faqs- 3Dotnet framework difference faqs- 3
Dotnet framework difference faqs- 3Umar Ali
 
Procedures functions structures in VB.Net
Procedures  functions  structures in VB.NetProcedures  functions  structures in VB.Net
Procedures functions structures in VB.Nettjunicornfx
 
Applications Of Computer Graphics
Applications Of Computer GraphicsApplications Of Computer Graphics
Applications Of Computer GraphicsMuhammad Amjad Rana
 
graphics programming in java
graphics programming in javagraphics programming in java
graphics programming in javaAbinaya B
 
Object oriented methodologies
Object oriented methodologiesObject oriented methodologies
Object oriented methodologiesnaina-rani
 
CS6502 OOAD - Question Bank and Answer
CS6502 OOAD - Question Bank and AnswerCS6502 OOAD - Question Bank and Answer
CS6502 OOAD - Question Bank and AnswerGobinath Subramaniam
 
3 d viewing projection
3 d viewing  projection3 d viewing  projection
3 d viewing projectionPooja Dixit
 
State Machine Diagram
State Machine DiagramState Machine Diagram
State Machine DiagramNiloy Rocker
 

What's hot (20)

Function Oriented Design
Function Oriented DesignFunction Oriented Design
Function Oriented Design
 
TIL networks
TIL networksTIL networks
TIL networks
 
Window to viewport transformation&matrix representation of homogeneous co...
Window to viewport transformation&matrix representation of homogeneous co...Window to viewport transformation&matrix representation of homogeneous co...
Window to viewport transformation&matrix representation of homogeneous co...
 
Sequence diagram
Sequence diagramSequence diagram
Sequence diagram
 
Visible surface detection in computer graphic
Visible surface detection in computer graphicVisible surface detection in computer graphic
Visible surface detection in computer graphic
 
Unit 4
Unit 4Unit 4
Unit 4
 
object oriented Programming ppt
object oriented Programming pptobject oriented Programming ppt
object oriented Programming ppt
 
Dotnet framework difference faqs- 3
Dotnet framework difference faqs- 3Dotnet framework difference faqs- 3
Dotnet framework difference faqs- 3
 
Procedures functions structures in VB.Net
Procedures  functions  structures in VB.NetProcedures  functions  structures in VB.Net
Procedures functions structures in VB.Net
 
Applications Of Computer Graphics
Applications Of Computer GraphicsApplications Of Computer Graphics
Applications Of Computer Graphics
 
Understanding Subroutines and Functions in VB6
Understanding Subroutines and Functions in VB6Understanding Subroutines and Functions in VB6
Understanding Subroutines and Functions in VB6
 
graphics programming in java
graphics programming in javagraphics programming in java
graphics programming in java
 
Object oriented methodologies
Object oriented methodologiesObject oriented methodologies
Object oriented methodologies
 
Vb introduction.
Vb introduction.Vb introduction.
Vb introduction.
 
CS6502 OOAD - Question Bank and Answer
CS6502 OOAD - Question Bank and AnswerCS6502 OOAD - Question Bank and Answer
CS6502 OOAD - Question Bank and Answer
 
class and object in c++.pptx
class and object in c++.pptxclass and object in c++.pptx
class and object in c++.pptx
 
3 d viewing projection
3 d viewing  projection3 d viewing  projection
3 d viewing projection
 
Sequence diagrams
Sequence diagramsSequence diagrams
Sequence diagrams
 
Oops in vb
Oops in vbOops in vb
Oops in vb
 
State Machine Diagram
State Machine DiagramState Machine Diagram
State Machine Diagram
 

Viewers also liked

Problems problem spaces and search
Problems problem spaces and searchProblems problem spaces and search
Problems problem spaces and searchAmey Kerkar
 
Internship_presentation
Internship_presentationInternship_presentation
Internship_presentationPoonam Thadani
 
Foundation of computing history final
Foundation of computing history finalFoundation of computing history final
Foundation of computing history finalRajith Pemabandu
 
#4 formal methods – predicate logic
#4 formal methods – predicate logic#4 formal methods – predicate logic
#4 formal methods – predicate logicSharif Omar Salem
 
Object Oriented Software Engineering (OOSE) presentation on SOFTWARE MAINTENANCE
Object Oriented Software Engineering (OOSE) presentation on SOFTWARE MAINTENANCEObject Oriented Software Engineering (OOSE) presentation on SOFTWARE MAINTENANCE
Object Oriented Software Engineering (OOSE) presentation on SOFTWARE MAINTENANCEVipin Kumar
 
Object Oriented Software Engineering
Object Oriented Software EngineeringObject Oriented Software Engineering
Object Oriented Software EngineeringAli Haider
 
weak slot and filler structure
weak slot and filler structureweak slot and filler structure
weak slot and filler structureAmey Kerkar
 
Informed and Uninformed search Strategies
Informed and Uninformed search StrategiesInformed and Uninformed search Strategies
Informed and Uninformed search StrategiesAmey Kerkar
 
Hierarchical Object Oriented Design
Hierarchical Object Oriented DesignHierarchical Object Oriented Design
Hierarchical Object Oriented Designsahibsahib
 
Object oriented software engineering concepts
Object oriented software engineering conceptsObject oriented software engineering concepts
Object oriented software engineering conceptsKomal Singh
 

Viewers also liked (12)

Problems problem spaces and search
Problems problem spaces and searchProblems problem spaces and search
Problems problem spaces and search
 
Internship_presentation
Internship_presentationInternship_presentation
Internship_presentation
 
Gec pest
Gec pestGec pest
Gec pest
 
Foundation of computing history final
Foundation of computing history finalFoundation of computing history final
Foundation of computing history final
 
#4 formal methods – predicate logic
#4 formal methods – predicate logic#4 formal methods – predicate logic
#4 formal methods – predicate logic
 
Object Oriented Software Engineering (OOSE) presentation on SOFTWARE MAINTENANCE
Object Oriented Software Engineering (OOSE) presentation on SOFTWARE MAINTENANCEObject Oriented Software Engineering (OOSE) presentation on SOFTWARE MAINTENANCE
Object Oriented Software Engineering (OOSE) presentation on SOFTWARE MAINTENANCE
 
Object Oriented Software Engineering
Object Oriented Software EngineeringObject Oriented Software Engineering
Object Oriented Software Engineering
 
weak slot and filler structure
weak slot and filler structureweak slot and filler structure
weak slot and filler structure
 
Informed and Uninformed search Strategies
Informed and Uninformed search StrategiesInformed and Uninformed search Strategies
Informed and Uninformed search Strategies
 
Object Oriented Software Analysis and Design
Object Oriented Software Analysis and DesignObject Oriented Software Analysis and Design
Object Oriented Software Analysis and Design
 
Hierarchical Object Oriented Design
Hierarchical Object Oriented DesignHierarchical Object Oriented Design
Hierarchical Object Oriented Design
 
Object oriented software engineering concepts
Object oriented software engineering conceptsObject oriented software engineering concepts
Object oriented software engineering concepts
 

Similar to An OO class encapsulates data and behavior

Ooad notes
Ooad notesOoad notes
Ooad notesNancyJP
 
Object oriented programming C++
Object oriented programming C++Object oriented programming C++
Object oriented programming C++AkshtaSuryawanshi
 
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
 
Unit two concept of classes and objects
Unit two concept of classes and objects Unit two concept of classes and objects
Unit two concept of classes and objects Dr Chetan Shelke
 
2 lesson 2 object oriented programming in c++
2 lesson 2 object oriented programming in c++2 lesson 2 object oriented programming in c++
2 lesson 2 object oriented programming in c++Jeff TUYISHIME
 
Class and object 1
Class and object 1Class and object 1
Class and object 1sajib miha
 
Java Progamming Paradigms, OOPS Concept, Introduction to Java, Structure of J...
Java Progamming Paradigms, OOPS Concept, Introduction to Java, Structure of J...Java Progamming Paradigms, OOPS Concept, Introduction to Java, Structure of J...
Java Progamming Paradigms, OOPS Concept, Introduction to Java, Structure of J...Sakthi Durai
 
Java Programming Paradigms Chapter 1
Java Programming Paradigms Chapter 1 Java Programming Paradigms Chapter 1
Java Programming Paradigms Chapter 1 Sakthi Durai
 
1207028 634528828886611250
1207028 6345288288866112501207028 634528828886611250
1207028 634528828886611250Akhil Nama
 
Object oriented concepts
Object oriented conceptsObject oriented concepts
Object oriented conceptschristradus
 

Similar to An OO class encapsulates data and behavior (20)

Ooad notes
Ooad notesOoad notes
Ooad notes
 
Object oriented programming C++
Object oriented programming C++Object oriented programming C++
Object oriented programming C++
 
General OOP concept [by-Digvijay]
General OOP concept [by-Digvijay]General OOP concept [by-Digvijay]
General OOP concept [by-Digvijay]
 
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
 
OOSD1-unit1_1_16_09.pptx
OOSD1-unit1_1_16_09.pptxOOSD1-unit1_1_16_09.pptx
OOSD1-unit1_1_16_09.pptx
 
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
 
Unit two concept of classes and objects
Unit two concept of classes and objects Unit two concept of classes and objects
Unit two concept of classes and objects
 
Jar chapter 2
Jar chapter 2Jar chapter 2
Jar chapter 2
 
Oops
OopsOops
Oops
 
2 lesson 2 object oriented programming in c++
2 lesson 2 object oriented programming in c++2 lesson 2 object oriented programming in c++
2 lesson 2 object oriented programming in c++
 
Class and object 1
Class and object 1Class and object 1
Class and object 1
 
Java Progamming Paradigms, OOPS Concept, Introduction to Java, Structure of J...
Java Progamming Paradigms, OOPS Concept, Introduction to Java, Structure of J...Java Progamming Paradigms, OOPS Concept, Introduction to Java, Structure of J...
Java Progamming Paradigms, OOPS Concept, Introduction to Java, Structure of J...
 
Java Programming Paradigms Chapter 1
Java Programming Paradigms Chapter 1 Java Programming Paradigms Chapter 1
Java Programming Paradigms Chapter 1
 
Java chapter 3
Java   chapter 3Java   chapter 3
Java chapter 3
 
Chapter 3
Chapter 3Chapter 3
Chapter 3
 
Objects by Sufian Idris
Objects by Sufian IdrisObjects by Sufian Idris
Objects by Sufian Idris
 
1207028 634528828886611250
1207028 6345288288866112501207028 634528828886611250
1207028 634528828886611250
 
Lecture 4. mte 407
Lecture 4. mte 407Lecture 4. mte 407
Lecture 4. mte 407
 
Unit - 3.pptx
Unit - 3.pptxUnit - 3.pptx
Unit - 3.pptx
 
Object oriented concepts
Object oriented conceptsObject oriented concepts
Object oriented concepts
 

More from shah zeb

Lecture 3,4
Lecture 3,4Lecture 3,4
Lecture 3,4shah zeb
 
Lecture 3,4
Lecture 3,4Lecture 3,4
Lecture 3,4shah zeb
 
Lecture 1,2
Lecture 1,2Lecture 1,2
Lecture 1,2shah zeb
 
Discover leo (english)
Discover leo (english)Discover leo (english)
Discover leo (english)shah zeb
 

More from shah zeb (8)

Lecture 8
Lecture 8Lecture 8
Lecture 8
 
Lecture 7
Lecture 7Lecture 7
Lecture 7
 
Lecture 6
Lecture 6Lecture 6
Lecture 6
 
Lecture 5
Lecture 5Lecture 5
Lecture 5
 
Lecture 3,4
Lecture 3,4Lecture 3,4
Lecture 3,4
 
Lecture 3,4
Lecture 3,4Lecture 3,4
Lecture 3,4
 
Lecture 1,2
Lecture 1,2Lecture 1,2
Lecture 1,2
 
Discover leo (english)
Discover leo (english)Discover leo (english)
Discover leo (english)
 

Recently uploaded

SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtimeandrehoraa
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceBrainSell Technologies
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...OnePlan Solutions
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfFerryKemperman
 
What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....kzayra69
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...Technogeeks
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作qr0udbr0
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Matt Ray
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
How to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfHow to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfLivetecs LLC
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)jennyeacort
 

Recently uploaded (20)

SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtime
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. Salesforce
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdf
 
What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...
 
2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
How to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfHow to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdf
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
 

An OO class encapsulates data and behavior

  • 1. 1
  • 2.  A class is an OO concept that encapsulates the data and procedural abstractions required to describe the content and behavior of some real world entity 2 Taylor {TAY90] uses the notation shown on the right side of Figure to describe a class (and objects derived from a class) An alternative representation of an object oriented class
  • 3.  The data abstractions (attributes) that describe the class are enclosed by a “wall” of procedural abstractions (called operations, methods, or services) that are capable of manipulating the data in some way.  The only way to reach the attributes (and operate on them) is to go through one of the methods that form the wall.  Therefore, the class encapsulates data (inside the wall) and the processing that manipulates the data (the methods that make up the wall) 3
  • 4.  This achieves information hiding and reduces the impact of side effects associated with change  Since the methods tend to manipulate a limited number of attributes, they are cohesive; and because communication occurs only through the methods that make up the “wall,” the class tends to be decoupled from other elements of a system.  All of these design characteristics lead to high quality software. 4
  • 5.  Stated another way, a class is a generalized description (e.g., a template, pattern, or blueprint) that describes a collection of similar objects  By definition, all objects that exist within a class inherit its attributes and the operations that are available to manipulate the attributes  A superclass is a collection of classes, and a subclass is a specialized instance of a class 5
  • 6.  These definitions imply the existence of a class hierarchy in which the attributes and operations of the superclass are inherited by subclasses that may each add additional “private” attributes and methods.  A class hierarchy for the class furniture is illustrated in Figure on next slide . 6
  • 7. 7 Real life entities are often described with words that indicate stable features. Most physical objects have features such as shape, weight, color, and type of material. People have features including date of birth, parents, name, and eye color. A feature may be seen as a binary relation between a class and a certain domain Automobile: color{white, black, silver, gray, blue, red, yellow, green}
  • 8.  An object encapsulates data (represented as a collection of attributes) and the algorithms that process the data. These algorithms are called operations, methods, or services1 and can be viewed as modules in a conventional sense.  Each of the operations that is encapsulated by an object provides a representation of one of the behaviors of the object  For example, the operation GetColor for the object automobile will extract the color stored in the color attribute 8
  • 9.  The implication of the existence of this operation is that the class automobile has been designed to receive a stimulus [JAC92] (we call the stimulus a message) that requests the color of the particular instance of a class  Whenever an object receives a stimulus, it initiates some behavior  This can be as simple as retrieving the color of automobile or as complex as the initiation of a chain of stimuli that are passed among a variety of different objects 9
  • 10.  In the latter case, consider an example in which the initial stimulus received by object 1 results in the generation of two other stimuli that are sent to object 2 and object 3  Operations encapsulated by the second and third objects act on the stimuli, returning necessary information to the first object  Object 1 then uses the returned information to satisfy the behavior demanded by the initial stimulus 10
  • 11.  Messages are the means by which objects interact  Using the terminology introduced in the preceding slides, a message stimulates some behavior to occur in the receiving object.  The behavior is accomplished when an operation is executed  Whenever an object is stimulated by a message, it initiates some behavior by executing an operation. 11
  • 12. 12
  • 13.  The interaction between messages is illustrated schematically in the figure. An operation within a sender object generates a message of the form Message: [destination, operation, parameters]  where destination defines the receiver object that is stimulated by the message, operation refers to the operation that is to receive the message, and parameters provides information that is required for the operation to be successful. 13
  • 14.  As an example of message passing within an OO system, consider the objects shown in Figure on slide 16. Four objects, A, B, C, and D communicate with one another by passing messages. For example, if object B requires processing associated with operation op10 of object D, it would send D a message of the form message: [D, op10, {data}] As part of the execution of op10, object D may send a message to object C of the form message: (C, op08, {data}) 14
  • 15.  Then C finds op08, performs it, and sends an appropriate return value to D. Operation op10 completes and sends a return value to B  Cox {COX86] describes the interchange between objects in the following manner: An object is requested to perform one of its operations by sending it a message telling the object what to do. The receiver [object] responds to the message by first choosing the operation that implements the message name, executing this operation, and then returning control to the caller. 15
  • 16. 16 Messaging ties an object-oriented system together. Messages provide insight into the behavior of individual objects and the OO system as a whole