SlideShare a Scribd company logo
1 of 24
Download to read offline
SWE 316: Software Design and Architecture
Objectives
Object Orientation
SWE 316: Software Design and Architecture
Before Object Orientation
Real world concepts
Software
Design
Entities
Skljkvjkvjfkavjafkk
saovjsdvjfvkfjvkfjk
Skljkvjkvjfkavjafkk
saovjsdvjfvkfjvkfjk
Skljkvjkvjfkavjafkk
saovjsdvjfvkfjvkfjk
Skljkvjkvjfkavjafkk
saovjsdvjfvkfjvkfjk
Object Orientation Classes and Objects Example Polymorphism Interfaces Things to be considered 2/24
SWE 316: Software Design and Architecture
Goals of Object Orientation
How Do We Express
Ourselves?
"Customers Montague and
Susan entered the Ajax bank
and were served by teller
Andy ..... "
AJAX BANK
Object Orientation Classes and Objects Example Polymorphism Interfaces Things to be considered 3/24
SWE 316: Software Design and Architecture
How We Express Ourselves
"Customers
Montague and Susan
entered the Ajax
bank and were
served by teller Andy
..... "
CLASSES OBJECTS
Note that Java code convention reverses this capitalization.
Object Orientation Classes and Objects Example Polymorphism Interfaces Things to be considered 4/24
SWE 316: Software Design and Architecture
Object Orientation
Real world concepts
Software design entities
Skljkvjkvjfkavjafkk
saovjsdvjfvkfjvkfjk
Skljkvjkvjfkavjafkk
saovjsdvjfvkfjvkfjk
Skljkvjkvjfkavjafkk
saovjsdvjfvkfjvkfjk
Skljkvjkvjfkavjafkk
saovjsdvjfvkfjvkfjk
Account
getDetails()
Transaction
execute()
Customer
getFirstName()
Direct
correspondence
Graphics reproduced with permission from Corel.
Object Orientation Classes and Objects Example Polymorphism Interfaces Things to be considered 5/24
SWE 316: Software Design and Architecture
Benefits of OO
Object orientation provides a direct
mapping between concepts and code
Object Orientation Classes and Objects Example Polymorphism Interfaces Things to be considered 6/24
SWE 316: Software Design and Architecture
Classes and Objects
AjaxCustomer
Real world Class
in Design
(UML notation)
Class
in Source code
(Java)
class AjaxCustomer
{ . . . .
}
PermissionToPay
class PermissionToPay
{ . . . .
}
Mental
concept
Object Orientation Classes and Objects Example Polymorphism Interfaces Things to be considered 7/24
SWE 316: Software Design and Architecture
The Members of a Class
Auto
public int vehicleID …
protected int mileage …
private myPrivateVariable …
static int numAutosMade …
Class model
Toyota
numAutosMade
12390924850984
aliceBrownBMW:Auto
… mileage
33024
jaynesCar:Auto
…
mileage
83402
Objects of Auto
Subclasses
have these
members
too
myToyota:Toyota
…
mileage
2105
…
Static variable:
One version only
Non-static variable: One
version for every object
Object Orientation Classes and Objects Example Polymorphism Interfaces Things to be considered 8/24
SWE 316: Software Design and Architecture
Attribute Types
 Naming:
 fixed for each object
 distinguishes individuals
 Descriptive:
 varies through life of object
 Referential:
 ties instance of one class to instance(s) of another
 == aggregation
Auto
vehicleID
mileage
owner
Object Orientation Classes and Objects Example Polymorphism Interfaces Things to be considered 9/24
SWE 316: Software Design and Architecture
Classes and Objects
 A class expresses a concept such as
“HondaCivic.”
 An object is an instance of a class such as
“the Honda Civic with vehicle ID
89R783HJD894.”
Object Orientation Classes and Objects Example Polymorphism Interfaces Things to be considered 10/24
SWE 316: Software Design and Architecture
The Clients of a Class
class Customer
{ . . .
String getName() { … }
int computeBalance() { … }
. . .
}
class AjaxWebsiteGenerator
{ . . .
void makeProfile( Customer c )
{ …
String name = c.getName() …
}
. . .
}
class AjaxAssets
{ . . .
int computeAssets()
{ . . .
Customer c = customers[ i ];
assets += c.computeBalance();
. . .
}
. . .
} Client of Customer
Client of Customer
Object Orientation Classes and Objects Example Polymorphism Interfaces Things to be considered 11/24
SWE 316: Software Design and Architecture
Why OO is Useful for Application
Development?
 Class (Sec 2.2.1)
 basic motive of Object
Orientation
 identifying parts that
corresponds to the real
world
 Instantiation (Sec
2.2.2)
 creating instances of
encapsulated concepts
 Inheritance (Sec 2.3.1)
 capturing the way
concepts occur in
hierarchy
 Polymorphism (Sec
2.3.2)
 capturing use of single
action word to represent
different things,
depending on context
Object Orientation Classes and Objects Example Polymorphism Interfaces Things to be considered 12/24
SWE 316: Software Design and Architecture
Requirements For e-Mail Creation Example
1. Summary:
Produces e-mail text for various types of customers.
2. Detailed requirements
2.1 The application displays choices to the console, as
shown in figure 2.13.
2.2 For customers delinquent more than 90 days, the e-
mail message generated is the statement shown in figure
2.12.
Page 1 of 4
Object Orientation Classes and Objects Example Polymorphism Interfaces Things to be considered 13/24
SWE 316: Software Design and Architecture
Requirements For e-Mail Creation Example
2.3 All non-delinquent customers receive a tailored
e-mail messages as follows.
2.3.1 Mountain customers:
This month we have a special on West Face tents.
Only $700.
... lots more output specialized to mountaineering
customers ...
2.3.2 Regular customers:
All items are marked down 20% for this month
only.
... lots more output for regular customers ...
Page 3 of 4
Object Orientation Classes and Objects Example Polymorphism Interfaces Things to be considered 14/24
SWE 316: Software Design and Architecture
Requirements For e-Mail Creation Example
2.4 The e-mail is to be displayed on the console.
3. Future enhancements
We anticipate that the text is likely to change
frequently, and that new kinds of customers are
likely to be specified, each with its own new set of
requirements.
Page 4 of 4
Object Orientation Classes and Objects Example Polymorphism Interfaces Things to be considered 15/24
SWE 316: Software Design and Architecture
Disadvantages of Branching
 Code for each case not cohesive
(“cohesive”: forms a comprehensible unity)
 All types of customers coded together in single class
Expensive to …
 … add new functionality
 bloat switch or if - then code
 … remove functionality
 hunt for all parts that must be removed
 … change functionality
 hunt for all parts that must be changed
Object Orientation Classes and Objects Example Polymorphism Interfaces Things to be considered 16/24
SWE 316: Software Design and Architecture
Aspects of the Customer Design Needing
Improvement
 We need to visualize the design
 Code not an effective way to understand design
 The design’s maintainability still has flaws
 As the application grows, specialized class(es) will be required
to interact with the user
Object Orientation Classes and Objects Example Polymorphism Interfaces Things to be considered 17/24
SWE 316: Software Design and Architecture
What’s Needed to Specify Functionality
 Name of the function
Example: add
 Argument types(if any)
Example:
 First parameter: integer
 Second parameter: float
 Return type
Example: double, reference
type, void
 Exceptions (if any)
Example: IOException
 More(?)
 Are parameters inputs
and/or outputs?
 Describe what the function
does (natural language)
Object Orientation Classes and Objects Example Polymorphism Interfaces Things to be considered 18/24
SWE 316: Software Design and Architecture
Polymorphism
 the use of several versions of a
method, one in each derived class.
 This enables
objectOfBaseClass.theMethod() to be
interpreted variously at runtime,
depending on what derived class
objectOfBaseClass belongs to.
Object Orientation Classes and Objects Example Polymorphism Interfaces Things to be considered 19/24
SWE 316: Software Design and Architecture
The Need For Interfaces: Simplify …
class Draw
{ …
int setColor( String ) { … }
Pen getStandardPen() { … }
int getLogoStyle() { … }
void setColor( int ) { … }
void drawLogo( int, int ) { … }
void speedUpPen( int ) { … }
…
}
Object Orientation Classes and Objects Example Polymorphism Interfaces Things to be considered 20/24
SWE 316: Software Design and Architecture
Interface Example: a Draw Class
 Functions dealing with the pen used
 Pen getStandardPen()
 void speedUpPen( int )
 . . .
 Functions dealing with the colors available
 void setColor( int )
 int setColor( String )
 . . .
 Functions covering the drawing of the company’s logo
 void drawLogo( int, int )
 int getLogoStyle()
 . . .
}
}
}
Logo interface
Object Orientation Classes and Objects Example Polymorphism Interfaces Things to be considered 21/24
SWE 316: Software Design and Architecture
Interfaces
An interface is a set of function
prototypes (each with name, parameter
types, return type, exception type).
Object Orientation Classes and Objects Example Polymorphism Interfaces Things to be considered 22/24
SWE 316: Software Design and Architecture
Issues to be Addressed
 How do we visualize a set of classes?
 How can classes relate to each other?
 How should classes relate to each other?
 How can we describe functionality occurring among
several classes?
 How do we describe the manner in which objects
respond to events occurring on them?
 Are there patterns of class usage that recur?
 So we can existing reuse design parts
Object Orientation Classes and Objects Example Polymorphism Interfaces Things to be considered 23/24
SWE 316: Software Design and Architecture
Summary of This Chapter
 A Class represents a concept
 Example: House
 An Object is an instance of a class
 Example: 23 Main Street, Springfield
 Classes can relate in several ways: Mainly …
 A Client of a class refers to that class in one of its methods
 Inheritance:“kind of” relationship
 Aggregation:“has a” relationship, explained in chapter xx
 Polymorphism means “action depends on context”
 Executing anObject.aMethod() actually executes the version of aMethod()
in the subclass that anObject belongs to
Object Orientation Classes and Objects Example Polymorphism Interfaces Things to be considered 24/24

More Related Content

Similar to Object Orientation.pdf

Design Pattern For C# Part 1
Design Pattern For C# Part 1Design Pattern For C# Part 1
Design Pattern For C# Part 1Shahzad
 
Simon Brown: Software Architecture as Code at I T.A.K.E. Unconference 2015
Simon Brown: Software Architecture as Code at I T.A.K.E. Unconference 2015Simon Brown: Software Architecture as Code at I T.A.K.E. Unconference 2015
Simon Brown: Software Architecture as Code at I T.A.K.E. Unconference 2015Mozaic Works
 
CS8592 Object Oriented Analysis & Design - UNIT II
CS8592 Object Oriented Analysis & Design - UNIT IICS8592 Object Oriented Analysis & Design - UNIT II
CS8592 Object Oriented Analysis & Design - UNIT IIpkaviya
 
Java căn bản- Chapter1
Java  căn bản- Chapter1Java  căn bản- Chapter1
Java căn bản- Chapter1Vince Vo
 
Chapter1 - Introduction to Object-Oriented Programming and Software Development
Chapter1 - Introduction to Object-Oriented Programming and Software DevelopmentChapter1 - Introduction to Object-Oriented Programming and Software Development
Chapter1 - Introduction to Object-Oriented Programming and Software DevelopmentEduardo Bergavera
 
Exploring Ink Analysis
Exploring Ink AnalysisExploring Ink Analysis
Exploring Ink AnalysisFrank La Vigne
 
1Introduction to OOAD
1Introduction to OOAD1Introduction to OOAD
1Introduction to OOAD Shahid Riaz
 
Introduction to SOFTWARE ARCHITECTURE
Introduction to SOFTWARE ARCHITECTUREIntroduction to SOFTWARE ARCHITECTURE
Introduction to SOFTWARE ARCHITECTUREIvano Malavolta
 
DECORATOR PATTERN IN WEB APPLICATION
DECORATOR PATTERN IN WEB APPLICATIONDECORATOR PATTERN IN WEB APPLICATION
DECORATOR PATTERN IN WEB APPLICATIONijait
 
Webinar on Design Patterns titled 'Dive into Design Patterns'
Webinar on Design Patterns titled 'Dive into Design Patterns'Webinar on Design Patterns titled 'Dive into Design Patterns'
Webinar on Design Patterns titled 'Dive into Design Patterns'Edureka!
 
Java Design Patterns Tutorial | Edureka
Java Design Patterns Tutorial | EdurekaJava Design Patterns Tutorial | Edureka
Java Design Patterns Tutorial | EdurekaEdureka!
 
unit-1modellingconceptsclassmodeling-140929182538-phpapp01.pdf
unit-1modellingconceptsclassmodeling-140929182538-phpapp01.pdfunit-1modellingconceptsclassmodeling-140929182538-phpapp01.pdf
unit-1modellingconceptsclassmodeling-140929182538-phpapp01.pdfRojaPogul1
 
Design patterns 1july
Design patterns 1julyDesign patterns 1july
Design patterns 1julyEdureka!
 
Lecture 1 uml with java implementation
Lecture 1 uml with java implementationLecture 1 uml with java implementation
Lecture 1 uml with java implementationthe_wumberlog
 
Design Patterns : The Ultimate Blueprint for Software
Design Patterns : The Ultimate Blueprint for SoftwareDesign Patterns : The Ultimate Blueprint for Software
Design Patterns : The Ultimate Blueprint for SoftwareEdureka!
 
Put Your Hands in the Mud: What Technique, Why, and How
Put Your Hands in the Mud: What Technique, Why, and HowPut Your Hands in the Mud: What Technique, Why, and How
Put Your Hands in the Mud: What Technique, Why, and HowMassimiliano Di Penta
 

Similar to Object Orientation.pdf (20)

Introduction of C# & MVC
Introduction of C# & MVCIntroduction of C# & MVC
Introduction of C# & MVC
 
Design Pattern For C# Part 1
Design Pattern For C# Part 1Design Pattern For C# Part 1
Design Pattern For C# Part 1
 
Simon Brown: Software Architecture as Code at I T.A.K.E. Unconference 2015
Simon Brown: Software Architecture as Code at I T.A.K.E. Unconference 2015Simon Brown: Software Architecture as Code at I T.A.K.E. Unconference 2015
Simon Brown: Software Architecture as Code at I T.A.K.E. Unconference 2015
 
Sw Software Design
Sw Software DesignSw Software Design
Sw Software Design
 
SA_UNIT_1.pptx
SA_UNIT_1.pptxSA_UNIT_1.pptx
SA_UNIT_1.pptx
 
CS8592 Object Oriented Analysis & Design - UNIT II
CS8592 Object Oriented Analysis & Design - UNIT IICS8592 Object Oriented Analysis & Design - UNIT II
CS8592 Object Oriented Analysis & Design - UNIT II
 
Java căn bản- Chapter1
Java  căn bản- Chapter1Java  căn bản- Chapter1
Java căn bản- Chapter1
 
Chapter1 - Introduction to Object-Oriented Programming and Software Development
Chapter1 - Introduction to Object-Oriented Programming and Software DevelopmentChapter1 - Introduction to Object-Oriented Programming and Software Development
Chapter1 - Introduction to Object-Oriented Programming and Software Development
 
Exploring Ink Analysis
Exploring Ink AnalysisExploring Ink Analysis
Exploring Ink Analysis
 
1Introduction to OOAD
1Introduction to OOAD1Introduction to OOAD
1Introduction to OOAD
 
Introduction to SOFTWARE ARCHITECTURE
Introduction to SOFTWARE ARCHITECTUREIntroduction to SOFTWARE ARCHITECTURE
Introduction to SOFTWARE ARCHITECTURE
 
DECORATOR PATTERN IN WEB APPLICATION
DECORATOR PATTERN IN WEB APPLICATIONDECORATOR PATTERN IN WEB APPLICATION
DECORATOR PATTERN IN WEB APPLICATION
 
Webinar on Design Patterns titled 'Dive into Design Patterns'
Webinar on Design Patterns titled 'Dive into Design Patterns'Webinar on Design Patterns titled 'Dive into Design Patterns'
Webinar on Design Patterns titled 'Dive into Design Patterns'
 
Java Design Patterns Tutorial | Edureka
Java Design Patterns Tutorial | EdurekaJava Design Patterns Tutorial | Edureka
Java Design Patterns Tutorial | Edureka
 
Design Patterns
Design PatternsDesign Patterns
Design Patterns
 
unit-1modellingconceptsclassmodeling-140929182538-phpapp01.pdf
unit-1modellingconceptsclassmodeling-140929182538-phpapp01.pdfunit-1modellingconceptsclassmodeling-140929182538-phpapp01.pdf
unit-1modellingconceptsclassmodeling-140929182538-phpapp01.pdf
 
Design patterns 1july
Design patterns 1julyDesign patterns 1july
Design patterns 1july
 
Lecture 1 uml with java implementation
Lecture 1 uml with java implementationLecture 1 uml with java implementation
Lecture 1 uml with java implementation
 
Design Patterns : The Ultimate Blueprint for Software
Design Patterns : The Ultimate Blueprint for SoftwareDesign Patterns : The Ultimate Blueprint for Software
Design Patterns : The Ultimate Blueprint for Software
 
Put Your Hands in the Mud: What Technique, Why, and How
Put Your Hands in the Mud: What Technique, Why, and HowPut Your Hands in the Mud: What Technique, Why, and How
Put Your Hands in the Mud: What Technique, Why, and How
 

Recently uploaded

Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfPower Karaoke
 
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
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
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
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
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
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
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
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 

Recently uploaded (20)

Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdf
 
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
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
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
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
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
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
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
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 

Object Orientation.pdf

  • 1. SWE 316: Software Design and Architecture Objectives Object Orientation
  • 2. SWE 316: Software Design and Architecture Before Object Orientation Real world concepts Software Design Entities Skljkvjkvjfkavjafkk saovjsdvjfvkfjvkfjk Skljkvjkvjfkavjafkk saovjsdvjfvkfjvkfjk Skljkvjkvjfkavjafkk saovjsdvjfvkfjvkfjk Skljkvjkvjfkavjafkk saovjsdvjfvkfjvkfjk Object Orientation Classes and Objects Example Polymorphism Interfaces Things to be considered 2/24
  • 3. SWE 316: Software Design and Architecture Goals of Object Orientation How Do We Express Ourselves? "Customers Montague and Susan entered the Ajax bank and were served by teller Andy ..... " AJAX BANK Object Orientation Classes and Objects Example Polymorphism Interfaces Things to be considered 3/24
  • 4. SWE 316: Software Design and Architecture How We Express Ourselves "Customers Montague and Susan entered the Ajax bank and were served by teller Andy ..... " CLASSES OBJECTS Note that Java code convention reverses this capitalization. Object Orientation Classes and Objects Example Polymorphism Interfaces Things to be considered 4/24
  • 5. SWE 316: Software Design and Architecture Object Orientation Real world concepts Software design entities Skljkvjkvjfkavjafkk saovjsdvjfvkfjvkfjk Skljkvjkvjfkavjafkk saovjsdvjfvkfjvkfjk Skljkvjkvjfkavjafkk saovjsdvjfvkfjvkfjk Skljkvjkvjfkavjafkk saovjsdvjfvkfjvkfjk Account getDetails() Transaction execute() Customer getFirstName() Direct correspondence Graphics reproduced with permission from Corel. Object Orientation Classes and Objects Example Polymorphism Interfaces Things to be considered 5/24
  • 6. SWE 316: Software Design and Architecture Benefits of OO Object orientation provides a direct mapping between concepts and code Object Orientation Classes and Objects Example Polymorphism Interfaces Things to be considered 6/24
  • 7. SWE 316: Software Design and Architecture Classes and Objects AjaxCustomer Real world Class in Design (UML notation) Class in Source code (Java) class AjaxCustomer { . . . . } PermissionToPay class PermissionToPay { . . . . } Mental concept Object Orientation Classes and Objects Example Polymorphism Interfaces Things to be considered 7/24
  • 8. SWE 316: Software Design and Architecture The Members of a Class Auto public int vehicleID … protected int mileage … private myPrivateVariable … static int numAutosMade … Class model Toyota numAutosMade 12390924850984 aliceBrownBMW:Auto … mileage 33024 jaynesCar:Auto … mileage 83402 Objects of Auto Subclasses have these members too myToyota:Toyota … mileage 2105 … Static variable: One version only Non-static variable: One version for every object Object Orientation Classes and Objects Example Polymorphism Interfaces Things to be considered 8/24
  • 9. SWE 316: Software Design and Architecture Attribute Types  Naming:  fixed for each object  distinguishes individuals  Descriptive:  varies through life of object  Referential:  ties instance of one class to instance(s) of another  == aggregation Auto vehicleID mileage owner Object Orientation Classes and Objects Example Polymorphism Interfaces Things to be considered 9/24
  • 10. SWE 316: Software Design and Architecture Classes and Objects  A class expresses a concept such as “HondaCivic.”  An object is an instance of a class such as “the Honda Civic with vehicle ID 89R783HJD894.” Object Orientation Classes and Objects Example Polymorphism Interfaces Things to be considered 10/24
  • 11. SWE 316: Software Design and Architecture The Clients of a Class class Customer { . . . String getName() { … } int computeBalance() { … } . . . } class AjaxWebsiteGenerator { . . . void makeProfile( Customer c ) { … String name = c.getName() … } . . . } class AjaxAssets { . . . int computeAssets() { . . . Customer c = customers[ i ]; assets += c.computeBalance(); . . . } . . . } Client of Customer Client of Customer Object Orientation Classes and Objects Example Polymorphism Interfaces Things to be considered 11/24
  • 12. SWE 316: Software Design and Architecture Why OO is Useful for Application Development?  Class (Sec 2.2.1)  basic motive of Object Orientation  identifying parts that corresponds to the real world  Instantiation (Sec 2.2.2)  creating instances of encapsulated concepts  Inheritance (Sec 2.3.1)  capturing the way concepts occur in hierarchy  Polymorphism (Sec 2.3.2)  capturing use of single action word to represent different things, depending on context Object Orientation Classes and Objects Example Polymorphism Interfaces Things to be considered 12/24
  • 13. SWE 316: Software Design and Architecture Requirements For e-Mail Creation Example 1. Summary: Produces e-mail text for various types of customers. 2. Detailed requirements 2.1 The application displays choices to the console, as shown in figure 2.13. 2.2 For customers delinquent more than 90 days, the e- mail message generated is the statement shown in figure 2.12. Page 1 of 4 Object Orientation Classes and Objects Example Polymorphism Interfaces Things to be considered 13/24
  • 14. SWE 316: Software Design and Architecture Requirements For e-Mail Creation Example 2.3 All non-delinquent customers receive a tailored e-mail messages as follows. 2.3.1 Mountain customers: This month we have a special on West Face tents. Only $700. ... lots more output specialized to mountaineering customers ... 2.3.2 Regular customers: All items are marked down 20% for this month only. ... lots more output for regular customers ... Page 3 of 4 Object Orientation Classes and Objects Example Polymorphism Interfaces Things to be considered 14/24
  • 15. SWE 316: Software Design and Architecture Requirements For e-Mail Creation Example 2.4 The e-mail is to be displayed on the console. 3. Future enhancements We anticipate that the text is likely to change frequently, and that new kinds of customers are likely to be specified, each with its own new set of requirements. Page 4 of 4 Object Orientation Classes and Objects Example Polymorphism Interfaces Things to be considered 15/24
  • 16. SWE 316: Software Design and Architecture Disadvantages of Branching  Code for each case not cohesive (“cohesive”: forms a comprehensible unity)  All types of customers coded together in single class Expensive to …  … add new functionality  bloat switch or if - then code  … remove functionality  hunt for all parts that must be removed  … change functionality  hunt for all parts that must be changed Object Orientation Classes and Objects Example Polymorphism Interfaces Things to be considered 16/24
  • 17. SWE 316: Software Design and Architecture Aspects of the Customer Design Needing Improvement  We need to visualize the design  Code not an effective way to understand design  The design’s maintainability still has flaws  As the application grows, specialized class(es) will be required to interact with the user Object Orientation Classes and Objects Example Polymorphism Interfaces Things to be considered 17/24
  • 18. SWE 316: Software Design and Architecture What’s Needed to Specify Functionality  Name of the function Example: add  Argument types(if any) Example:  First parameter: integer  Second parameter: float  Return type Example: double, reference type, void  Exceptions (if any) Example: IOException  More(?)  Are parameters inputs and/or outputs?  Describe what the function does (natural language) Object Orientation Classes and Objects Example Polymorphism Interfaces Things to be considered 18/24
  • 19. SWE 316: Software Design and Architecture Polymorphism  the use of several versions of a method, one in each derived class.  This enables objectOfBaseClass.theMethod() to be interpreted variously at runtime, depending on what derived class objectOfBaseClass belongs to. Object Orientation Classes and Objects Example Polymorphism Interfaces Things to be considered 19/24
  • 20. SWE 316: Software Design and Architecture The Need For Interfaces: Simplify … class Draw { … int setColor( String ) { … } Pen getStandardPen() { … } int getLogoStyle() { … } void setColor( int ) { … } void drawLogo( int, int ) { … } void speedUpPen( int ) { … } … } Object Orientation Classes and Objects Example Polymorphism Interfaces Things to be considered 20/24
  • 21. SWE 316: Software Design and Architecture Interface Example: a Draw Class  Functions dealing with the pen used  Pen getStandardPen()  void speedUpPen( int )  . . .  Functions dealing with the colors available  void setColor( int )  int setColor( String )  . . .  Functions covering the drawing of the company’s logo  void drawLogo( int, int )  int getLogoStyle()  . . . } } } Logo interface Object Orientation Classes and Objects Example Polymorphism Interfaces Things to be considered 21/24
  • 22. SWE 316: Software Design and Architecture Interfaces An interface is a set of function prototypes (each with name, parameter types, return type, exception type). Object Orientation Classes and Objects Example Polymorphism Interfaces Things to be considered 22/24
  • 23. SWE 316: Software Design and Architecture Issues to be Addressed  How do we visualize a set of classes?  How can classes relate to each other?  How should classes relate to each other?  How can we describe functionality occurring among several classes?  How do we describe the manner in which objects respond to events occurring on them?  Are there patterns of class usage that recur?  So we can existing reuse design parts Object Orientation Classes and Objects Example Polymorphism Interfaces Things to be considered 23/24
  • 24. SWE 316: Software Design and Architecture Summary of This Chapter  A Class represents a concept  Example: House  An Object is an instance of a class  Example: 23 Main Street, Springfield  Classes can relate in several ways: Mainly …  A Client of a class refers to that class in one of its methods  Inheritance:“kind of” relationship  Aggregation:“has a” relationship, explained in chapter xx  Polymorphism means “action depends on context”  Executing anObject.aMethod() actually executes the version of aMethod() in the subclass that anObject belongs to Object Orientation Classes and Objects Example Polymorphism Interfaces Things to be considered 24/24