Object-Oriented Analysis and Design
Object-Oriented Analysis and Design
Design
Lecture 3
Class:
Is a group of objects having the same attributes and
processes.
Class:
Is a set of similar things in their properties and behavior.
Example: (animals, transportation, plants, students, .....).
Object :
It is all that you look at around you is an object.
Such as car, home, computer, etc.
The shape shows the object and its
attributes and actions
The object and ( attributes & actions)
If we replace the object of the person (Khalid)
here with any other object, we will find
attributes and actions will be with him and will
change depending on the type of object itself,
and here we say that the object of whatever
kind, will consist of attributes and actions.
Object Attributes
Object properties: Object specifications.
These things come in the format name = value
what does that mean?.
Now if you want to buy a car, you will ask about its price, color, and other
specifications that are of interest to you during the purchase. As we said that the car is
an object, its price,
Properties, for this object (car), and to illustrate the intended use of the formula
:name = value, note how to set the specifications below
car.color = red
car.price = 66500
We conclude from the above that color represents the property name.
And red represents the value of the property.
The same applies to the price property.
Object Actions
Here we will talk about the second component
of the object, actions
You may find them in the name of Behavior,
Methods, and others.
Object Actions:
It is the things that the object does.
Class and object and the relationship
between them
Class and object and the relationship
between them
We conclude that the object is a copy of class,
and this is the relationship.
That is, Class may create several copies of it.
All these copies are objects.
Programmatic representation for both
Class and Object in java
class Person
{
public String name;
public int age;
public boolean gender;
public void eat() {...}
public void sleep() {...}
public void run() {...}
}
Code showing object creation
Person khaled = new Person();
khaled.name = “Khaled”;
khaled.age = 25;
khaled.gender = true;
The Class Diagram
Definition
Is one of the UML schemes by which the system
structure is described by showing system layers,
properties, processes, and relationships
between objects.
The Class Diagram
Things can be placed within Classes.
The Class diagram function comes to illustrate
these classes and association among them.
For each class:
• -class name
• -Attributes
• - Methods and sometimes we call them
operations.
When to use a class diagram?
• Class schemas are used in almost all object-
oriented programming designs.
• They are used to describe system classes and
their relationship to each other.
Class Diagram
Thus, the class can be represented in one of the
following ways:
How can I identify classes?
We can follow the method used in the
determination of actors and use cases, by
creating a table helps in the identification of
items and the analysis of functional
requirements.
Identifying Classes
Number Requirements Class
1 At the beginning of the school year, student
the student advances to the
manager to join the school.