0% found this document useful (0 votes)
14 views19 pages

3 ConceptObjectOriented Part1

The document covers the fundamentals of Object-Oriented Development with Java, focusing on key concepts such as objects, classes, attributes, and operations. It explains the relationships between classes and objects, the definition of an object, and the role of packages in organizing model elements. The learning outcomes include understanding abstraction, encapsulation, modularity, hierarchy, polymorphism, and generalization.

Uploaded by

Mark
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views19 pages

3 ConceptObjectOriented Part1

The document covers the fundamentals of Object-Oriented Development with Java, focusing on key concepts such as objects, classes, attributes, and operations. It explains the relationships between classes and objects, the definition of an object, and the role of packages in organizing model elements. The learning outcomes include understanding abstraction, encapsulation, modularity, hierarchy, polymorphism, and generalization.

Uploaded by

Mark
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 19

Object Oriented Development

with Java
(CT038-3-2)

Concept of Object Orientation – Part 1


Object Oriented Modeling

Prepared by: Lee Kim Keong First Prepared on: June 13 Last Modified on: April 19
Quality checked by: null
Copyright 2019 Asia Pacific University of Innovation and Technology
Learning outcome

• At the end of this lesson, you will be able


to
– Describe abstraction, encapsulation,
modularity, and hierarchy
– Describe the physical structure of a class
– Describe the relationship between a class and
an object
– Define polymorphism and generalization

CT038-3-2 Object Oriented Development with Java Concepts of Object Oriented


What Is an Object?

• Informally, an object represents an entity,


either physical, conceptual, or software.

– Physical entity Truck

– Conceptual entity Chemical Process

– Software entity
Linked List
CT038-3-2 Object Oriented Development with Java Concepts of Object Oriented
A More Formal Definition
Attributes

• An object is an entity
with a well-defined
boundary and identity
that encapsulates state
and behavior.
– State is represented by
attributes and relationships.
– Behavior is represented by
operations, methods, and
Object
state machines.
Operations

CT038-3-2 Object Oriented Development with Java Concepts of Object Oriented


An Object Has State

• State is a condition or situation during the life of


an object, which satisfies some condition,
performs some activity, or waits for some event.
• The state of an object normally changes over
time.
Name: J Clark
Employee ID:
567138
HireDate: 07/25/1991
Status: Tenured
Name: J Clark Discipline: Finance
Employee ID: 567138 MaxLoad: 3

Date Hired: July 25, 1991


Status: Tenured
Discipline: Finance Professor Clark
Maximum Course Load: 3 classes
CT038-3-2 Object Oriented Development with Java Concepts of Object Oriented
An Object Has Behavior

• Behavior determines how an object acts and


reacts.
• The visible behavior of an object is modeled by
a set of messages it can respond to (operations
that the object can perform). Ac
ce
pt

)
s(
Co

de
ur
se

ra
O

G
ff e

al
rin

in
g

itF
()

bm
Su
Se
tM
Professor Clark’s behavior

ax
Lo
Submit Final Grades

ad
) (
Accept Course Offering TakeSabbatical()
Take Sabbatical
Set Max Load Professor Clark
CT038-3-2 Object Oriented Development with Java Concepts of Object Oriented
An Object Has Identity

• Each object has a unique identity, even if


the state is identical to that of another
object.

Professor “J Clark” Professor “J Clark”


teaches Biology teaches Biology

CT038-3-2 Object Oriented Development with Java Concepts of Object Oriented


Representing Objects in the UML

• An object is represented as a rectangle


with an underlined name.
Professor

Named Object

: Professor
Professor J Clark

Anonymous Object

CT038-3-2 Object Oriented Development with Java Concepts of Object Oriented


What Is a Class?

• A class is a description of a set of objects


that share the same attributes, 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.

CT038-3-2 Object Oriented Development with Java Concepts of Object Oriented


A Sample Class
Class
Course

Properties Behavior
Name Add a student
Location Delete a student
Days offered Get course roster
Credit hours Determine if it is full
Start time
End time

CT038-3-2 Object Oriented Development with Java Concepts of Object Oriented


Representing Classes in UML

• A class is represented using a rectangle


with three compartments:
Professor
– The class name - name
- employeeID : UniqueId
- hireDate
- status
– The structure (attributes) - discipline
- maxLoad

+ submitFinalGrade()
+ acceptCourseOffering()
+ setMaxLoad()
– The behavior (operations) + takeSabbatical()
+ teachClass()

CT038-3-2 Object Oriented Development with Java Concepts of Object Oriented


The Relationship between
Classes and Objects
• 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.
• Classes are not collections of objects.

Professor

Professor Meijer Professor Allen


CT038-3-2 Object Oriented Development with Java Concepts of Object Oriented
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.
Student
- name
- address
Attributes
- studentID
- dateOfBirth

CT038-3-2 Object Oriented Development with Java Concepts of Object Oriented


Attributes in Classes and Objects

Class
:Student
- name = “M. Modano”
- address = “123 Main St.”
Student - studentID = 9
- name - dateOfBirth = “03/10/1967”
- address
- studentID Objects
- dateOfBirth
:Student
- name = “D. Hatcher”
- address = “456 Oak Ln.”
- studentID = 2
- dateOfBirth = “12/11/1969”
CT038-3-2 Object Oriented Development with Java Concepts of Object Oriented
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. Student

+ get tuition()
+ add schedule()
Operations + get schedule()
+ delete schedule()
+ has prerequisites()

CT038-3-2 Object Oriented Development with Java Concepts of Object Oriented


What Is a Package?

• A general purpose mechanism for organizing


elements into groups.
• A model element that can contain other model
elements.
• A package can be used:
– To organize the model under development.
– As a unit of configuration management.

University
Artifacts

CT038-3-2 Object Oriented Development with Java Concepts of Object Oriented


A Package Can Contain Classes

• The package, University Artifacts, contains


one package and five classes.
Student Professor
Artifacts

University
Artifacts Course Schedule

Student CourseOffering

CT038-3-2 Object Oriented Development with Java Concepts of Object Oriented


17
Review

• What is an object?
• What is a class? How are classes and objects
related?
• What is an attribute? An operation?
• Why use packages?

CT038-3-2 Object Oriented Development with Java Concepts of Object Oriented


Q&A

CT038-3-2 Object Oriented Development with Java Concepts of Object Oriented

You might also like