SlideShare a Scribd company logo
1 of 37
OO Basics
4/9/2024 1
Introduction to Object Orientation Topics
• Overview
• Basic Principles of Object Orientation
• Basic Concepts of Object Orientation
• Strengths of Object Orientation
4/9/2024 2
Overview
• What are object-oriented (OO) methods?
– OO methods provide a set of techniques for
analyzing, decomposing, and modularizing software
system architectures
– In general, OO methods are characterized by
structuring the system architecture on the basis of its
objects (and classes of objects) rather than the
actions it performs
• What are the benefits of OO?
– OO enhances key software quality factors of a system
and its constituent components
OO Basics 3
OOA, OOD, and OOP
• Object-oriented methods may be applied to
different phases in the software lifecycle
– e.g., analysis, design, implementation, etc.
• Object-oriented analysis (OOA) is a process of
discovery
– models and understands the requirements
of the system
• Object-oriented design (OOD) is a process of
invention and adaptation
– creates the abstractions and mechanisms
necessary to meet the system's behavioral
requirements determined during analysis
OO Basics 4
Basic Definitions OOD, and OOP
• Object-Oriented Design (OOD)
– A method for decomposing software architectures based
on the objects every system or subsystem manipulates
– Rather than "the" function it is meant to ensure
• Object-Oriented Programming (OOP)
– construction of software systems using object oriented
concepts as inheritance, polymorphism, encapsulation,
dynamic binding.
• Distinguish between OOD and OOP
– OOD is relatively independent of the programming
language used.
– OOP is primarily concerned with programming language
and software implementation issues
OO Basics 5
Object-Oriented Approach
• Model objects that are part of the problem
• Have objects exhibit their normal behavior
• Add objects that do not have problem-space
analogs
• Have the objects work together to create a
solution
Design patterns help you identify less-obvious
abstractions and the objects that can capture them.
- GOF
OO Basics 6
Five Basic Characteristics of OO
"Pure" object-orientation by Alan Kay (Smalltalk):
• Everything is an object.
• A program is a bunch of objects telling each
other what to do by sending messages.
• Each object has its own memory made up of
other objects.
• Every object has a type.
• All objects of a particular type can receive the
same message.
OO Basics 7
4/9/2024 8
Basic Principles of Object Orientation
Object Orientation
Encapsulation
Abstraction
Hierarchy
Polymorphism
What Is Abstraction?
• The essential characteristics of an entity that
distinguishes it from all other kinds of entities.
• Defines a boundary relative to the perspective of the
viewer.
• Is not a concrete manifestation, denotes the ideal
essence of something.
4/9/2024 9
Salesperson: Not
saying Which
salesperson – just a
salesperson in general!!!
Customer
Product
Manages Complexity
What Is Encapsulation?
• Hides implementation from clients.
– Clients depend on interface.
4/9/2024 10
Improves Resiliency
Encapsulation
• "Encapsulation is a mechanism used to hide the
data, internal structure, and implementation details
of an object. All interaction with the object is through
a public interface of operations." (Craig Larman)
• A boundary exists around each object;
– the boundary encapsulates the object’s characteristics
(data elements) and behaviors (functionality).
• The reason for hiding features is to:
(1) keep users from touching parts of the object
they shouldn’t touch;
(2) allows creator of the object to change the object’s internal
working without affecting the users of the object.
4/9/2024 11
What Is Polymorphism?
• The ability to hide many different
implementations behind a single interface.
4/9/2024 12
Manufacturer A
Manufacturer B
Manufacturer C
OO Principle:
Encapsulation Remote Control
Polymorphism
• Occurs with inheritance.
• Different subclasses may have different
implementations of the identical operations
• Allows you to treat an object as the base class,
rather than as a specific inherited type.
• Programmer doesn’t have to keep track of the
specific subclasses, the system selects the correct
operation based on the object type.
• Accomplished at run time using dynamic binding.
– lets you substitute objects that have identical interfaces for
each other at run-time.
4/9/2024 13
What is Hierarchy?
4/9/2024 14
Decreasing
abstraction
Increasing
abstraction
Asset
RealEstate
Savings
BankAccount
Checking Stock
Security
Bond
Elements at the same level of the hierarchy
should be at the same level of abstraction
Levels of abstraction
Basic Concepts of Object Orientation
• Object
• Class
• Attribute
• Operation
• Interface
• Package
• Relationships
4/9/2024 15
What is an Object?
• Informally, an object represents an entity, either
physical, conceptual, or software
– Physical entity
– Conceptual entity
– Software entity
4/9/2024 16
Truck
Chemical Process
Linked List
A More Formal Definition
• An object is a concept, abstraction, or thing with
sharp boundaries and meaning for an
application
• An object is something that has:
– State
– Behavior
– Identity
4/9/2024 17
What is a Class?
• A class is a description of a group of objects with
common properties (attributes), behavior
(operations), relationships, and semantics
– An object is an instance of a class
• A class is an abstraction in that it:
– Emphasizes relevant characteristics
– Suppresses other characteristics
4/9/2024 18
OO Principle: Abstraction
4/9/2024 19
Sample Class
a + b = 10
Class
Course
Properties
Name
Location
Days offered
Credit hours
Start time
End time
Behavior
Add a student
Delete a student
Get course roster
Determine if it is full
Representing Classes in the UML
• A class is represented using a rectangle with
three compartments:
– The class name
– The structure (attributes)
– The behavior (operations)
4/9/2024 20
Professor
- name
- employeeID : UniqueId
- hireDate
- status
- discipline
- maxLoad
+ submitFinalGrade()
+ acceptCourseOffering()
+ setMaxLoad()
+ takeSabbatical()
+ teachClass()
Classes of Objects
• How many classes do you see?
4/9/2024 21
Classes and Objects Relationship
• A class is an abstract definition of an object
– It defines the structure and behavior of each object in
the class
– It serves as a template for creating objects
• Objects are grouped into classes
4/9/2024 22
Objects Class
Professor Smith
Professor Jones
Professor Mellon
Professor
What Is an Attribute?
• An attribute is a named property of a class that
describes the range of values that instances of
the property may hold.
– A class may have any number of attributes or no
attributes at all.
4/9/2024 23
Attributes
Student
- name
- address
- studentID
- dateOfBirth
What Is an Operation?
• A service that can be requested from an object
to effect behavior. An operation has a signature,
which may restrict the actual parameters that are
possible.
• A class may have any number of operations or
none at all.
4/9/2024 24
Operations
Student
+ get tuition()
+ add schedule()
+ get schedule()
+ delete schedule()
+ has prerequisites()
What is an Interface?
• Interfaces formalize polymorphism
• Interfaces support “plug-and-play” architectures
4/9/2024 25
Tube
Pyramid
Cube
Shape
Draw
Move
Scale
Rotate
<<interface>>
Realization relationship (stay tuned for realization relationships)
Interface
• How do you get an object to do useful work for
you?
• Objects are known only through their interfaces
• Every object presents an interface to the world.
• Interface determines what you can get an object
to do.
• Represent a "contract" with other objects.
• Communicate with objects by sending messages
to them; an object’s interface is the set of
messages an object will respond to.
4/9/2024 26
What is a Package?
• A package is a general purpose mechanism for
organizing elements into groups
• A model element which can contain other model
elements
• Uses
– Organize the model under development
– A unit of configuration managemen
4/9/2024 27
Package Name
Relationships
• Association
– Aggregation
• Dependency
• Inheritance
• Realization
4/9/2024 28
ConsoleWindow
Window
open()
close()
move()
display()
handleEvent()
Event
DialogBox Control
association
generalization
Relationships: Association
• Models a semantic connection among classes
4/9/2024 29
Professor University
Works for
Class
Association
Association Name
Relationships: Association Aggregation
• To model a “whole/part” relationship, use
aggregation.
• Aggregation represents a “has-a” or “is a part-of”
relationship, meaning that an object of the whole
has objects of the part.
[Martin Fowler]
30
4/9/2024
Company Department
*
1
Association: Multiplicity and Navigation
• Multiplicity defines how many objects participate
in a relationships
– Specified for each end of the association
• Associations are bi-directional by default, but it is
often desirable to restrict navigation to one
direction
4/9/2024 31
Customer Account
1 0..*
Multiplicity
Navigation
Relationships: Dependency
• A relationship between two model elements where a
change in one may cause a change in the other
– E.g. Class A depends on class B: method of A manipulates
objects of B in the parameters, local variables, or return types
4/9/2024 32
Package
ClientPackage SupplierPackage
Client Supplier
Class
Dependency
relationship
Relationships: Realization
4/9/2024 33
Tube
Pyramid
Cube
Shape
Draw
Move
Scale
Rotate
<<interface>>
Realization relationship (stay tuned for realization relationships)
4/9/2024 34
Inheritance
[Martin Fowler]
Shape
origin
draw()
erase()
move()
setColor()
getColor()
Circle
draw()
erase()
Square
draw()
erase()
move()
4/9/2024 35
Polymorphism
[Martin Fowler]
Goose
move()
Penguin
move()
FlockManager
reLocate()
Bird
move()
What Gets Inherited?
• A subclass inherits its parent’s attributes,
operations, and relationships
• A subclass may:
– Add additional attributes, operations, relationships
– Redefine inherited operations (use caution!)
• Common attributes, operations, and/or
relationships are shown at the highest applicable
level in the hierarchy
4/9/2024 36
Inheritance leverages the similarities among classes
4/9/2024 37
Example: What Gets Inherited
Truck
tonnage
GroundVehicle
weight
licenseNumber
Car
owner
register( )
getTax( )
Person
0..*
Trailer
1
Superclass
(parent)
Subclass
generalization
size

More Related Content

Similar to 1a-OO-Basics.pptx lạoanfanfanfjasnfjnfkaskfklas

UNIT IV DESIGN PATTERNS.pptx
UNIT IV DESIGN PATTERNS.pptxUNIT IV DESIGN PATTERNS.pptx
UNIT IV DESIGN PATTERNS.pptxanguraju1
 
Object Modelling Technique " ooad "
Object Modelling Technique  " ooad "Object Modelling Technique  " ooad "
Object Modelling Technique " ooad "AchrafJbr
 
Teaching Object Oriented Programming Courses by Sandeep K Singh JIIT,Noida
Teaching Object Oriented Programming Courses by Sandeep K Singh JIIT,NoidaTeaching Object Oriented Programming Courses by Sandeep K Singh JIIT,Noida
Teaching Object Oriented Programming Courses by Sandeep K Singh JIIT,NoidaDr. Sandeep Kumar Singh
 
Intro to oop.pptx
Intro to oop.pptxIntro to oop.pptx
Intro to oop.pptxUmerUmer25
 
introduction of Object oriented programming
introduction of Object oriented programmingintroduction of Object oriented programming
introduction of Object oriented programmingRiturajJain8
 
CPP-Unit 1.pptx
CPP-Unit 1.pptxCPP-Unit 1.pptx
CPP-Unit 1.pptxYashKoli22
 
Software Engineering Lec5 oop-uml-i
Software Engineering Lec5 oop-uml-iSoftware Engineering Lec5 oop-uml-i
Software Engineering Lec5 oop-uml-iTaymoor Nazmy
 
Introducción al Análisis y Diseño Orientado a Objetos
Introducción al Análisis y Diseño Orientado a ObjetosIntroducción al Análisis y Diseño Orientado a Objetos
Introducción al Análisis y Diseño Orientado a ObjetosUniversidad de Occidente
 
oomd-unit-i-cgpa.ppt
oomd-unit-i-cgpa.pptoomd-unit-i-cgpa.ppt
oomd-unit-i-cgpa.pptPavan992098
 
Object oriented analysis_and_design_v2.0
Object oriented analysis_and_design_v2.0Object oriented analysis_and_design_v2.0
Object oriented analysis_and_design_v2.0Ganapathi M
 
Oo concepts and class modeling
Oo concepts and class modelingOo concepts and class modeling
Oo concepts and class modelingPreeti Mishra
 

Similar to 1a-OO-Basics.pptx lạoanfanfanfjasnfjnfkaskfklas (20)

ppt_ooad.pdf
ppt_ooad.pdfppt_ooad.pdf
ppt_ooad.pdf
 
UNIT IV DESIGN PATTERNS.pptx
UNIT IV DESIGN PATTERNS.pptxUNIT IV DESIGN PATTERNS.pptx
UNIT IV DESIGN PATTERNS.pptx
 
Object Modelling Technique " ooad "
Object Modelling Technique  " ooad "Object Modelling Technique  " ooad "
Object Modelling Technique " ooad "
 
OOAD chapter 1
OOAD chapter 1 OOAD chapter 1
OOAD chapter 1
 
01 chapter
01 chapter01 chapter
01 chapter
 
Teaching Object Oriented Programming Courses by Sandeep K Singh JIIT,Noida
Teaching Object Oriented Programming Courses by Sandeep K Singh JIIT,NoidaTeaching Object Oriented Programming Courses by Sandeep K Singh JIIT,Noida
Teaching Object Oriented Programming Courses by Sandeep K Singh JIIT,Noida
 
Ooad unit – 1 introduction
Ooad unit – 1 introductionOoad unit – 1 introduction
Ooad unit – 1 introduction
 
Ooad 2
Ooad 2Ooad 2
Ooad 2
 
Ooad
OoadOoad
Ooad
 
Introduction
IntroductionIntroduction
Introduction
 
Intro to oop.pptx
Intro to oop.pptxIntro to oop.pptx
Intro to oop.pptx
 
introduction of Object oriented programming
introduction of Object oriented programmingintroduction of Object oriented programming
introduction of Object oriented programming
 
CPP-Unit 1.pptx
CPP-Unit 1.pptxCPP-Unit 1.pptx
CPP-Unit 1.pptx
 
Software Engineering Lec5 oop-uml-i
Software Engineering Lec5 oop-uml-iSoftware Engineering Lec5 oop-uml-i
Software Engineering Lec5 oop-uml-i
 
Seng 123 8-ooad
Seng 123 8-ooadSeng 123 8-ooad
Seng 123 8-ooad
 
Introducción al Análisis y Diseño Orientado a Objetos
Introducción al Análisis y Diseño Orientado a ObjetosIntroducción al Análisis y Diseño Orientado a Objetos
Introducción al Análisis y Diseño Orientado a Objetos
 
2 uml
2 uml2 uml
2 uml
 
oomd-unit-i-cgpa.ppt
oomd-unit-i-cgpa.pptoomd-unit-i-cgpa.ppt
oomd-unit-i-cgpa.ppt
 
Object oriented analysis_and_design_v2.0
Object oriented analysis_and_design_v2.0Object oriented analysis_and_design_v2.0
Object oriented analysis_and_design_v2.0
 
Oo concepts and class modeling
Oo concepts and class modelingOo concepts and class modeling
Oo concepts and class modeling
 

Recently uploaded

Museum of fine arts Lauren Simpson…………..
Museum of fine arts Lauren Simpson…………..Museum of fine arts Lauren Simpson…………..
Museum of fine arts Lauren Simpson…………..mvxpw22gfc
 
Digital C-Type Printing: Revolutionizing The Future Of Photographic Prints
Digital C-Type Printing: Revolutionizing The Future Of Photographic PrintsDigital C-Type Printing: Revolutionizing The Future Of Photographic Prints
Digital C-Type Printing: Revolutionizing The Future Of Photographic PrintsMatte Image
 
Call Girls Varanasi Just Call 8617370543Top Class Call Girl Service Available
Call Girls Varanasi Just Call 8617370543Top Class Call Girl Service AvailableCall Girls Varanasi Just Call 8617370543Top Class Call Girl Service Available
Call Girls Varanasi Just Call 8617370543Top Class Call Girl Service AvailableNitya salvi
 
codes and conventions of film magazine and website.pptx
codes and conventions of film magazine and website.pptxcodes and conventions of film magazine and website.pptx
codes and conventions of film magazine and website.pptx17duffyc
 
+97470301568>> buy weed, thc oil,cbd oil, kush, hash in Doha qatar}}
+97470301568>> buy weed, thc oil,cbd oil, kush, hash in Doha qatar}}+97470301568>> buy weed, thc oil,cbd oil, kush, hash in Doha qatar}}
+97470301568>> buy weed, thc oil,cbd oil, kush, hash in Doha qatar}}Health
 
Russian Call Girls Pilibhit Just Call 👉👉 📞 8617370543 Top Class Call Girl Ser...
Russian Call Girls Pilibhit Just Call 👉👉 📞 8617370543 Top Class Call Girl Ser...Russian Call Girls Pilibhit Just Call 👉👉 📞 8617370543 Top Class Call Girl Ser...
Russian Call Girls Pilibhit Just Call 👉👉 📞 8617370543 Top Class Call Girl Ser...Nitya salvi
 
Azad Nagar Call Girls ,☎️ ((#9711106444)), 💘 Full enjoy Low rate girl💘 Genuin...
Azad Nagar Call Girls ,☎️ ((#9711106444)), 💘 Full enjoy Low rate girl💘 Genuin...Azad Nagar Call Girls ,☎️ ((#9711106444)), 💘 Full enjoy Low rate girl💘 Genuin...
Azad Nagar Call Girls ,☎️ ((#9711106444)), 💘 Full enjoy Low rate girl💘 Genuin...delhimunirka15
 
如何办理澳洲迪肯大学毕业证(Deakin毕业证书)毕业证成绩单原版一比一
如何办理澳洲迪肯大学毕业证(Deakin毕业证书)毕业证成绩单原版一比一如何办理澳洲迪肯大学毕业证(Deakin毕业证书)毕业证成绩单原版一比一
如何办理澳洲迪肯大学毕业证(Deakin毕业证书)毕业证成绩单原版一比一avy6anjnd
 
Sui Generis Magazine volume one Kristen Murillo.pdf
Sui Generis Magazine volume one Kristen Murillo.pdfSui Generis Magazine volume one Kristen Murillo.pdf
Sui Generis Magazine volume one Kristen Murillo.pdfkristenmurillo218
 
一比一原版(UofG学位证书)圭尔夫大学毕业证学历认证快速办理
一比一原版(UofG学位证书)圭尔夫大学毕业证学历认证快速办理一比一原版(UofG学位证书)圭尔夫大学毕业证学历认证快速办理
一比一原版(UofG学位证书)圭尔夫大学毕业证学历认证快速办理txkonu
 
如何办理(Flinders毕业证)弗林德斯大学毕业证毕业证成绩单原版一比一
如何办理(Flinders毕业证)弗林德斯大学毕业证毕业证成绩单原版一比一如何办理(Flinders毕业证)弗林德斯大学毕业证毕业证成绩单原版一比一
如何办理(Flinders毕业证)弗林德斯大学毕业证毕业证成绩单原版一比一8jg9cqy
 
Completed Event Presentation for Huma 1305
Completed Event Presentation for Huma 1305Completed Event Presentation for Huma 1305
Completed Event Presentation for Huma 1305jazlynjacobs51
 
Storyboard short: Ferrarius Tries to Sing
Storyboard short: Ferrarius Tries to SingStoryboard short: Ferrarius Tries to Sing
Storyboard short: Ferrarius Tries to SingLyneSun
 
THE ARTS OF THE PHILIPPINE BALLET PRESN
THE ARTS OF  THE PHILIPPINE BALLET PRESNTHE ARTS OF  THE PHILIPPINE BALLET PRESN
THE ARTS OF THE PHILIPPINE BALLET PRESNAlvinFerdinandAceCas
 
SB_ Pretzel and the puppies_ Rough_ RiverPhan (2024)
SB_ Pretzel and the puppies_ Rough_ RiverPhan (2024)SB_ Pretzel and the puppies_ Rough_ RiverPhan (2024)
SB_ Pretzel and the puppies_ Rough_ RiverPhan (2024)River / Thao Phan
 
How to order fake Worcester State University diploma?
How to order fake Worcester State University diploma?How to order fake Worcester State University diploma?
How to order fake Worcester State University diploma?melodolykelton
 
ppt seni budaya kelas xi, menganalisis konsep,unsur,prinsip dan teknik
ppt seni budaya kelas xi, menganalisis konsep,unsur,prinsip dan teknikppt seni budaya kelas xi, menganalisis konsep,unsur,prinsip dan teknik
ppt seni budaya kelas xi, menganalisis konsep,unsur,prinsip dan teknikAgustinus791932
 
Top Rated Lucknow Escorts Service, ₹5000 Best Hot Call Girls With Room +91-82...
Top Rated Lucknow Escorts Service, ₹5000 Best Hot Call Girls With Room +91-82...Top Rated Lucknow Escorts Service, ₹5000 Best Hot Call Girls With Room +91-82...
Top Rated Lucknow Escorts Service, ₹5000 Best Hot Call Girls With Room +91-82...meghakumariji156
 
Mussafah Call Girls +971525373611 Call Girls in Mussafah Abu Dhabi
Mussafah Call Girls +971525373611 Call Girls in Mussafah Abu DhabiMussafah Call Girls +971525373611 Call Girls in Mussafah Abu Dhabi
Mussafah Call Girls +971525373611 Call Girls in Mussafah Abu Dhabiromeke1848
 
WhatsApp-(# 9711106444 #)Call Girl in Noida Sector 80 Noida (Escorts) Delhi
WhatsApp-(# 9711106444 #)Call Girl in Noida Sector 80 Noida (Escorts) DelhiWhatsApp-(# 9711106444 #)Call Girl in Noida Sector 80 Noida (Escorts) Delhi
WhatsApp-(# 9711106444 #)Call Girl in Noida Sector 80 Noida (Escorts) Delhidelhimunirka15
 

Recently uploaded (20)

Museum of fine arts Lauren Simpson…………..
Museum of fine arts Lauren Simpson…………..Museum of fine arts Lauren Simpson…………..
Museum of fine arts Lauren Simpson…………..
 
Digital C-Type Printing: Revolutionizing The Future Of Photographic Prints
Digital C-Type Printing: Revolutionizing The Future Of Photographic PrintsDigital C-Type Printing: Revolutionizing The Future Of Photographic Prints
Digital C-Type Printing: Revolutionizing The Future Of Photographic Prints
 
Call Girls Varanasi Just Call 8617370543Top Class Call Girl Service Available
Call Girls Varanasi Just Call 8617370543Top Class Call Girl Service AvailableCall Girls Varanasi Just Call 8617370543Top Class Call Girl Service Available
Call Girls Varanasi Just Call 8617370543Top Class Call Girl Service Available
 
codes and conventions of film magazine and website.pptx
codes and conventions of film magazine and website.pptxcodes and conventions of film magazine and website.pptx
codes and conventions of film magazine and website.pptx
 
+97470301568>> buy weed, thc oil,cbd oil, kush, hash in Doha qatar}}
+97470301568>> buy weed, thc oil,cbd oil, kush, hash in Doha qatar}}+97470301568>> buy weed, thc oil,cbd oil, kush, hash in Doha qatar}}
+97470301568>> buy weed, thc oil,cbd oil, kush, hash in Doha qatar}}
 
Russian Call Girls Pilibhit Just Call 👉👉 📞 8617370543 Top Class Call Girl Ser...
Russian Call Girls Pilibhit Just Call 👉👉 📞 8617370543 Top Class Call Girl Ser...Russian Call Girls Pilibhit Just Call 👉👉 📞 8617370543 Top Class Call Girl Ser...
Russian Call Girls Pilibhit Just Call 👉👉 📞 8617370543 Top Class Call Girl Ser...
 
Azad Nagar Call Girls ,☎️ ((#9711106444)), 💘 Full enjoy Low rate girl💘 Genuin...
Azad Nagar Call Girls ,☎️ ((#9711106444)), 💘 Full enjoy Low rate girl💘 Genuin...Azad Nagar Call Girls ,☎️ ((#9711106444)), 💘 Full enjoy Low rate girl💘 Genuin...
Azad Nagar Call Girls ,☎️ ((#9711106444)), 💘 Full enjoy Low rate girl💘 Genuin...
 
如何办理澳洲迪肯大学毕业证(Deakin毕业证书)毕业证成绩单原版一比一
如何办理澳洲迪肯大学毕业证(Deakin毕业证书)毕业证成绩单原版一比一如何办理澳洲迪肯大学毕业证(Deakin毕业证书)毕业证成绩单原版一比一
如何办理澳洲迪肯大学毕业证(Deakin毕业证书)毕业证成绩单原版一比一
 
Sui Generis Magazine volume one Kristen Murillo.pdf
Sui Generis Magazine volume one Kristen Murillo.pdfSui Generis Magazine volume one Kristen Murillo.pdf
Sui Generis Magazine volume one Kristen Murillo.pdf
 
一比一原版(UofG学位证书)圭尔夫大学毕业证学历认证快速办理
一比一原版(UofG学位证书)圭尔夫大学毕业证学历认证快速办理一比一原版(UofG学位证书)圭尔夫大学毕业证学历认证快速办理
一比一原版(UofG学位证书)圭尔夫大学毕业证学历认证快速办理
 
如何办理(Flinders毕业证)弗林德斯大学毕业证毕业证成绩单原版一比一
如何办理(Flinders毕业证)弗林德斯大学毕业证毕业证成绩单原版一比一如何办理(Flinders毕业证)弗林德斯大学毕业证毕业证成绩单原版一比一
如何办理(Flinders毕业证)弗林德斯大学毕业证毕业证成绩单原版一比一
 
Completed Event Presentation for Huma 1305
Completed Event Presentation for Huma 1305Completed Event Presentation for Huma 1305
Completed Event Presentation for Huma 1305
 
Storyboard short: Ferrarius Tries to Sing
Storyboard short: Ferrarius Tries to SingStoryboard short: Ferrarius Tries to Sing
Storyboard short: Ferrarius Tries to Sing
 
THE ARTS OF THE PHILIPPINE BALLET PRESN
THE ARTS OF  THE PHILIPPINE BALLET PRESNTHE ARTS OF  THE PHILIPPINE BALLET PRESN
THE ARTS OF THE PHILIPPINE BALLET PRESN
 
SB_ Pretzel and the puppies_ Rough_ RiverPhan (2024)
SB_ Pretzel and the puppies_ Rough_ RiverPhan (2024)SB_ Pretzel and the puppies_ Rough_ RiverPhan (2024)
SB_ Pretzel and the puppies_ Rough_ RiverPhan (2024)
 
How to order fake Worcester State University diploma?
How to order fake Worcester State University diploma?How to order fake Worcester State University diploma?
How to order fake Worcester State University diploma?
 
ppt seni budaya kelas xi, menganalisis konsep,unsur,prinsip dan teknik
ppt seni budaya kelas xi, menganalisis konsep,unsur,prinsip dan teknikppt seni budaya kelas xi, menganalisis konsep,unsur,prinsip dan teknik
ppt seni budaya kelas xi, menganalisis konsep,unsur,prinsip dan teknik
 
Top Rated Lucknow Escorts Service, ₹5000 Best Hot Call Girls With Room +91-82...
Top Rated Lucknow Escorts Service, ₹5000 Best Hot Call Girls With Room +91-82...Top Rated Lucknow Escorts Service, ₹5000 Best Hot Call Girls With Room +91-82...
Top Rated Lucknow Escorts Service, ₹5000 Best Hot Call Girls With Room +91-82...
 
Mussafah Call Girls +971525373611 Call Girls in Mussafah Abu Dhabi
Mussafah Call Girls +971525373611 Call Girls in Mussafah Abu DhabiMussafah Call Girls +971525373611 Call Girls in Mussafah Abu Dhabi
Mussafah Call Girls +971525373611 Call Girls in Mussafah Abu Dhabi
 
WhatsApp-(# 9711106444 #)Call Girl in Noida Sector 80 Noida (Escorts) Delhi
WhatsApp-(# 9711106444 #)Call Girl in Noida Sector 80 Noida (Escorts) DelhiWhatsApp-(# 9711106444 #)Call Girl in Noida Sector 80 Noida (Escorts) Delhi
WhatsApp-(# 9711106444 #)Call Girl in Noida Sector 80 Noida (Escorts) Delhi
 

1a-OO-Basics.pptx lạoanfanfanfjasnfjnfkaskfklas

  • 2. Introduction to Object Orientation Topics • Overview • Basic Principles of Object Orientation • Basic Concepts of Object Orientation • Strengths of Object Orientation 4/9/2024 2
  • 3. Overview • What are object-oriented (OO) methods? – OO methods provide a set of techniques for analyzing, decomposing, and modularizing software system architectures – In general, OO methods are characterized by structuring the system architecture on the basis of its objects (and classes of objects) rather than the actions it performs • What are the benefits of OO? – OO enhances key software quality factors of a system and its constituent components OO Basics 3
  • 4. OOA, OOD, and OOP • Object-oriented methods may be applied to different phases in the software lifecycle – e.g., analysis, design, implementation, etc. • Object-oriented analysis (OOA) is a process of discovery – models and understands the requirements of the system • Object-oriented design (OOD) is a process of invention and adaptation – creates the abstractions and mechanisms necessary to meet the system's behavioral requirements determined during analysis OO Basics 4
  • 5. Basic Definitions OOD, and OOP • Object-Oriented Design (OOD) – A method for decomposing software architectures based on the objects every system or subsystem manipulates – Rather than "the" function it is meant to ensure • Object-Oriented Programming (OOP) – construction of software systems using object oriented concepts as inheritance, polymorphism, encapsulation, dynamic binding. • Distinguish between OOD and OOP – OOD is relatively independent of the programming language used. – OOP is primarily concerned with programming language and software implementation issues OO Basics 5
  • 6. Object-Oriented Approach • Model objects that are part of the problem • Have objects exhibit their normal behavior • Add objects that do not have problem-space analogs • Have the objects work together to create a solution Design patterns help you identify less-obvious abstractions and the objects that can capture them. - GOF OO Basics 6
  • 7. Five Basic Characteristics of OO "Pure" object-orientation by Alan Kay (Smalltalk): • Everything is an object. • A program is a bunch of objects telling each other what to do by sending messages. • Each object has its own memory made up of other objects. • Every object has a type. • All objects of a particular type can receive the same message. OO Basics 7
  • 8. 4/9/2024 8 Basic Principles of Object Orientation Object Orientation Encapsulation Abstraction Hierarchy Polymorphism
  • 9. What Is Abstraction? • The essential characteristics of an entity that distinguishes it from all other kinds of entities. • Defines a boundary relative to the perspective of the viewer. • Is not a concrete manifestation, denotes the ideal essence of something. 4/9/2024 9 Salesperson: Not saying Which salesperson – just a salesperson in general!!! Customer Product Manages Complexity
  • 10. What Is Encapsulation? • Hides implementation from clients. – Clients depend on interface. 4/9/2024 10 Improves Resiliency
  • 11. Encapsulation • "Encapsulation is a mechanism used to hide the data, internal structure, and implementation details of an object. All interaction with the object is through a public interface of operations." (Craig Larman) • A boundary exists around each object; – the boundary encapsulates the object’s characteristics (data elements) and behaviors (functionality). • The reason for hiding features is to: (1) keep users from touching parts of the object they shouldn’t touch; (2) allows creator of the object to change the object’s internal working without affecting the users of the object. 4/9/2024 11
  • 12. What Is Polymorphism? • The ability to hide many different implementations behind a single interface. 4/9/2024 12 Manufacturer A Manufacturer B Manufacturer C OO Principle: Encapsulation Remote Control
  • 13. Polymorphism • Occurs with inheritance. • Different subclasses may have different implementations of the identical operations • Allows you to treat an object as the base class, rather than as a specific inherited type. • Programmer doesn’t have to keep track of the specific subclasses, the system selects the correct operation based on the object type. • Accomplished at run time using dynamic binding. – lets you substitute objects that have identical interfaces for each other at run-time. 4/9/2024 13
  • 14. What is Hierarchy? 4/9/2024 14 Decreasing abstraction Increasing abstraction Asset RealEstate Savings BankAccount Checking Stock Security Bond Elements at the same level of the hierarchy should be at the same level of abstraction Levels of abstraction
  • 15. Basic Concepts of Object Orientation • Object • Class • Attribute • Operation • Interface • Package • Relationships 4/9/2024 15
  • 16. What is an Object? • Informally, an object represents an entity, either physical, conceptual, or software – Physical entity – Conceptual entity – Software entity 4/9/2024 16 Truck Chemical Process Linked List
  • 17. A More Formal Definition • An object is a concept, abstraction, or thing with sharp boundaries and meaning for an application • An object is something that has: – State – Behavior – Identity 4/9/2024 17
  • 18. What is a Class? • A class is a description of a group of objects with common properties (attributes), behavior (operations), relationships, and semantics – An object is an instance of a class • A class is an abstraction in that it: – Emphasizes relevant characteristics – Suppresses other characteristics 4/9/2024 18 OO Principle: Abstraction
  • 19. 4/9/2024 19 Sample Class a + b = 10 Class Course Properties Name Location Days offered Credit hours Start time End time Behavior Add a student Delete a student Get course roster Determine if it is full
  • 20. Representing Classes in the UML • A class is represented using a rectangle with three compartments: – The class name – The structure (attributes) – The behavior (operations) 4/9/2024 20 Professor - name - employeeID : UniqueId - hireDate - status - discipline - maxLoad + submitFinalGrade() + acceptCourseOffering() + setMaxLoad() + takeSabbatical() + teachClass()
  • 21. Classes of Objects • How many classes do you see? 4/9/2024 21
  • 22. Classes and Objects Relationship • A class is an abstract definition of an object – It defines the structure and behavior of each object in the class – It serves as a template for creating objects • Objects are grouped into classes 4/9/2024 22 Objects Class Professor Smith Professor Jones Professor Mellon Professor
  • 23. What Is an Attribute? • An attribute is a named property of a class that describes the range of values that instances of the property may hold. – A class may have any number of attributes or no attributes at all. 4/9/2024 23 Attributes Student - name - address - studentID - dateOfBirth
  • 24. What Is an Operation? • A service that can be requested from an object to effect behavior. An operation has a signature, which may restrict the actual parameters that are possible. • A class may have any number of operations or none at all. 4/9/2024 24 Operations Student + get tuition() + add schedule() + get schedule() + delete schedule() + has prerequisites()
  • 25. What is an Interface? • Interfaces formalize polymorphism • Interfaces support “plug-and-play” architectures 4/9/2024 25 Tube Pyramid Cube Shape Draw Move Scale Rotate <<interface>> Realization relationship (stay tuned for realization relationships)
  • 26. Interface • How do you get an object to do useful work for you? • Objects are known only through their interfaces • Every object presents an interface to the world. • Interface determines what you can get an object to do. • Represent a "contract" with other objects. • Communicate with objects by sending messages to them; an object’s interface is the set of messages an object will respond to. 4/9/2024 26
  • 27. What is a Package? • A package is a general purpose mechanism for organizing elements into groups • A model element which can contain other model elements • Uses – Organize the model under development – A unit of configuration managemen 4/9/2024 27 Package Name
  • 28. Relationships • Association – Aggregation • Dependency • Inheritance • Realization 4/9/2024 28 ConsoleWindow Window open() close() move() display() handleEvent() Event DialogBox Control association generalization
  • 29. Relationships: Association • Models a semantic connection among classes 4/9/2024 29 Professor University Works for Class Association Association Name
  • 30. Relationships: Association Aggregation • To model a “whole/part” relationship, use aggregation. • Aggregation represents a “has-a” or “is a part-of” relationship, meaning that an object of the whole has objects of the part. [Martin Fowler] 30 4/9/2024 Company Department * 1
  • 31. Association: Multiplicity and Navigation • Multiplicity defines how many objects participate in a relationships – Specified for each end of the association • Associations are bi-directional by default, but it is often desirable to restrict navigation to one direction 4/9/2024 31 Customer Account 1 0..* Multiplicity Navigation
  • 32. Relationships: Dependency • A relationship between two model elements where a change in one may cause a change in the other – E.g. Class A depends on class B: method of A manipulates objects of B in the parameters, local variables, or return types 4/9/2024 32 Package ClientPackage SupplierPackage Client Supplier Class Dependency relationship
  • 36. What Gets Inherited? • A subclass inherits its parent’s attributes, operations, and relationships • A subclass may: – Add additional attributes, operations, relationships – Redefine inherited operations (use caution!) • Common attributes, operations, and/or relationships are shown at the highest applicable level in the hierarchy 4/9/2024 36 Inheritance leverages the similarities among classes
  • 37. 4/9/2024 37 Example: What Gets Inherited Truck tonnage GroundVehicle weight licenseNumber Car owner register( ) getTax( ) Person 0..* Trailer 1 Superclass (parent) Subclass generalization size