Telechargé par chiraz.khelia

object in computer science

publicité
College pilote Mégrine
Computer Science
Project
Object in
Computer science
Realised by :
Mayssa Koubâa
2019 - 2020
1
PLAN
1
What is an object ?
2
1 3
How do objects collaborate ?
What criteria allow as to classify
something as an object?
2
1
What is an object ?
“Something you can do things to” (G. Booch)
An object = an entity that has its state and behavior
- The object maintains its state in one or more variables
● Variable = a data named by an identifier
- The object implements its behavior by the methods
● Method = a function associated with an object
Behavior (methods)
variable
variable
variable
State (variables)
● An object is an IT entity that includes variables and methods
The variables form a core of the object and the methods form an envelope that surrounds the
3
kernel and hides it to other objects in the program
1
What is an object ?
Examples of real world objects
- Dog with the state defined by its
name, color, race, position, ...
and behavior as: sitting, couch,
brings, barks ...
- Bike with the state defined by its number
of speeds, current speed, color, ...
and behavior as: accelerates, changes the
speed ...
accelerate
Sits
name
color
Position
Lies
brings
Dog modeled as computer object
slows
Nb speeds
current speed
color
Change
speed
Bike modeled as computer object
4
PLAN
1
What is an object ?
2
1 3
How do objects collaborate ?
What criteria allow as to classify
something as an object?
5
2
How do objects collaborate ?
● The object appears as a component of a program that contains many others
● It is through the interaction of its objects that the program acquires a higher level of
functionality and complexity
● The objects interact with each other sending messages
Changes the speed (first Speed)
The message includes:
- The target object to whom the message
is addressed (the bike)
- The name of the method to be performed
(changeValue)
You
- The parameter ( or parameters) that the
method needs (firstSpeed)
The bike
6
PLAN
1
What is an object ?
2
1 3
How do objects collaborate ?
What criteria allow as to classify
something as an object?
7
1 3
What criteria allow as to classify
something as an object
In computer science, an object can be
- a variable,
- a data structure,
- a function,
- or a method,
and as such, is a value in memory referenced by an
identifier.
In the class-based object-oriented programming paradigm,
object refers to a particular instance of a class, where the
object can be a combination of variables, functions, and
data structures.
8
Thank you
for attention
9
Téléchargement