3. What is object orientation?
• Object Oriented (OO) means that we organize software
as a collection of discrete objects that incorporate both
data structure & behavior.
• OO approach its generally include four aspects:
1. Identity
2. Classification
3. Inheritance
4. Polymorphism
4. • Identity means that data is quantized into discrete,
distinguishable entities called objects.
• Each object has its own inherent identity.
• In other words, two objects are distinct even if all their
attributes values (such as name and size) are identical.
• The white queen in a chess game for example of
objects.
Identity
5. Objects can be:
• External Entity (e.g., other systems, devices, people)
that produce or consume information to be used by
system
• Things (e.g., reports, displays, letters, signals) that are
part of information domain for the problem
• Places (e.g., book’s room) that establish the context of
the problem and the overall function of the system.
• Organizational units (e.g., division, group, team,
department) that are relevant to an application,
• Transaction (e.g., loan, take course, buy, order).
How to identify object?
6. 6
Object Identity Behaviors State
An employee “Mr. John” Join(),
Retire()
Joined,
Retired.
A book “Book with title
Object Oriented
Analysis Design”
Add Exemplar, Rent,
available,
reserved
A sale “Sale no 0015,
15/12/98”
SendInvoiced(),
Cancel().
Invoiced,
cancelled.
Object
7. What is classification?
• Classification means that objects with the same data
structure (attributes) and behavior (operations) are
grouped into a class.
• For example Paragraph, Monitor & Chess Piece.
• Class is a collection of objects.
• A Class is an abstraction that describes properties
important to an application and ignores the rest.
• Any choice of classes is arbitrary and depends on the
applications.
• For example,
Fruit mango, apple, banana…etc.
8. Classification
• Each Class describes a possibly infinite set of individual
objects.
• Each object is said to be an instance of its class.
• An object has its own value for each attribute but
shares the attribute names and operations with other
instances of the class.
9. What is Inheritance?
3. Inheritance :
• Inheritance is the process, in which one object can use the properties
of another object.
• It allows the declaration and implementation of one class to based an
existing class.
• The concept of inheritance provides the idea of reusability..
Parent Base or Super class
Child Derived or Sub class
Parent +
Child
features
Parent
features
10. Inheritance
• Inheritance is the sharing of attributes and operations
(features) among classes based on a hierarchical
relationship.
• A Super class has general information that subclasses
refine and elaborate.
• Each subclass incorporates, or inherits, all the features
of its super class and adds its own unique features.
• Subclasses need not repeat the features of the super
class.
• For example, Scrolling Window and Fixed Window are
subclasses of Window.
11. Inheritance
• Both subclasses inherit the features of Window, such as
a visible region on the screen.
• Scrolling Window adds a scroll bar and an offset.
• The ability to factor out common features of several
classes into a super class can greatly reduce repetition
within designs and programs and is one of the main
advantages of OO technology.
Bird
Flying Bird Non Flying Bird
12. What is Polymorphism?
• Polymorphism means the ability to take more than one
form.
• It allows a single name to be used for more than one
related purpose.
• It can be also defined as the property that allows an
operation to have different behavior on different objects.
Shape
SquareCircle
name
getName( )
calculateArea( )
side
calculateArea( )
radius
calculateArea( )
13. What is Polymorphism?
• An operations is a procedure or transformation that an
object perform is subject to.
• For example ,
Polygon objects ---------- Polygon class
Attributes
-vertices
-border color
-fill color
Operations
-draw
-erase
-move
14. Polymorphism
• An implementation of an operation by a specific class is
called a method.
• Because an OO operator is polymorphic, it may have more
than one method implementing it, each for a different
class of object.
15. Abstraction
• Abstraction is the selective examination of certain
aspects of a problem.
• Creating new data types using encapsulated items is
known as data abstraction.
• It is also the process of grouping the attributes and
functions to operate these attributes.
• And the data type created by the data abstraction are
known as Abstract Data Types (ADT).
• Attributes : is known as data members.
16. Abstraction
• Abstraction is the presentation of simple concept (or
object) to the external world.
• Abstraction concept is to describe a set of similar
concrete entities.
• It focuses on the essential, inherent aspects of an entity
and ignoring its accidental properties.
• The abstraction concept is usually used during analysis:
deciding only with application-domain concepts, not
making design and implementation decisions.
17. Abstraction
• Two popular abstractions: procedure abstraction and
data abstraction.
• Procedure abstraction is to decompose problem to many
simple sub-works.
• Data abstraction is to collect essential elements
composing to a compound data.
• These two abstractions have the same objective:
reusable and replaceable.
18. Abstraction
• Below figure shows an example of data abstraction to
abstract doors as a data structure with essential
properties.
• Example of Data Abstraction.
19. Three Models
• We use three kinds of models to describe a system
from different viewpoints:
1. Class Model
2. State Model
3. Interaction Model
• Class Model: For the objects in the system & their
relationships.
• State Model: For the life history of objects.
• Interaction Model: For the interactions among objects.
20. Class Model
1. Class Model:
• For the objects in the system & their relationships.
• The class model defines the context for software development –
the universe of discourse.
• The class model contains class diagrams.
• A class diagram is a graph whose nodes are classes and whose
arcs relationships among classes.
22. State Model
2. State Model:
• For the life history of objects.
• The state model specifies and implements control with
state diagrams.
• A state diagram is a graph whose nodes are states and
whose arcs are transitions between states caused by
events.
23. Interaction Model
3. Interaction Model:
• For the interactions among objects.
• The interaction model start with use case with activity
and sequence diagram.
• A use case focuses on the functionality of a system – that
is, what a system does for users.
• A sequence diagram shows the objects that interact and
the time sequence of their interactions.
• An activity diagram elaborates important processing
steps.
24. Interaction Model
• Use cases ,sequence diagrams, and activity diagrams
document the interaction model.
• Use cases document major themes for interaction
between the system and outside actors.
• Sequence diagrams show the objects that interact and
the time sequence of their interactions
• Activity diagrams show the floe of control among the
processing steps of a computations.
25. Modeling
• A model is an abstraction of something for the purpose of
understanding it before building it.
a) Testing a physical entity before building it.
b) Communication with customers.
c) Visualization.
d) Reduction of complexity.
26. Relationship Among the Models
• Each models describes one aspect of the system but
contains references to the other models.
• The class model describes data structure on which the state
and interaction models operate.
• The operations in the class model correspond to events and
actions.
• The state model describes the control structure of objects.
• It shows decisions that depend on object values and causes
actions that change object values and state.
• The interaction model focuses on the exchange between
objects and provides a holistic overview of the operation of
a system.
27. TEXTBOOK EXERCISES
1.5)All objects have identity and are distinguishable. However,
for large collections of objects, it may not be a trivial matter
to devise a scheme to distinguish them. Furthermore, a
scheme may depend on the purpose of the distinction. For
each of the
following collections of objects, describe how they could be
distinguished:
28. TEXTBOOK EXERCISES
• a . All persons in the world for the purpose of sending mail.
Country; state or province; city; street and number;
apartment, suite, or mail drop; name (ie, USA ->
Florida -> Orlando -> 633 N Orange Ave -> Mail Point 85 ->
Mark Zieg)
• b . All persons in the world for the purpose of criminal
investigations.
Known aliases, fingerprints, photo, results of restriction-
enzyme DNA tests (ie, Andrew Wiggen, AKA Ender Wiggen,
AKA Xenocide)
29. TEXTBOOK EXERCISES
• c . All customers with safe deposit boxes in a given bank.
Box number (ie, 1258)
• d . All telephones in the world for making telephone calls.
National code, local exchange (area code), local number (ie, 10-
104 (407) 420-6072)
• e . All customers of a telephone company for billing purposes.
Area code, telephone number (ie, (407) 420-6072)
• f . All electronic mail addresses throughout the world.
Server domain or IP, account name (ie,
mzieg@orlandosentinel.com)
• g . All employees of a company to restrict access for security
purposes.
Department; clearance level; name, social security number, or
employee number (ie, SYSTEMS-L15- 2072)
30. • A variable length array would make effective use of the following operations:
append, copy, count, delete, index, insert, and update. The only operation
which wouldn’t make a great deal of sense would be intersect. The append
operation makes sense because the ordered nature of the array presupposes
a ‘beginning’ and an ‘end’. The append operation would allow object users to
easily add something to the end of the array, in the manner of a queue or
other common data structure. Copy makes sense with any object, because
multiple object instantiations are frequently found in many common
applications. Count makes since because it provides a bound to the index
range, although the question didn’t specifically mention that the indexes had
to be sequential or positive values. Delete is another natural operation,
especially when parameterized with a beginning, end, or [index] indicator.
Index would be essential in order to access various elements. Insert would be
a more flexible version of append, and indeed under some interfaces render it
unnecessary. Update would be important in any application in which data
needed to be modified without going through a delete/insert sequence.
Intersect could readily be provided if really desired, but I haven’t had much
call do use such an operation on an ordered array.
31. • A symbol table uses a somewhat smaller set of operations. Here, copy,
delete, intersect, and update are the most likely candidates. Again, copy is
universally popular. Update, in the sense of an unordered insert, would be
necessary to propagate the table, and delete would be necessary to
• flush unnecessary values. Intersect somehow sounds more likely for this
class than for array,
• because you certainly need to compare elements of symbol tables when
linking libraries and object
• code. Some sort of operation to retrieve or read an entry would also be
necessary, although I
• wouldnÕt call it Òindex,Ó which suggests an ordered position rather than a
key value. Append,
• index, and the ordered insert make less sense because they provide
implementation-specific details
• which arenÕt necessary and contradict the tenets of OOD. Count could
perhaps be useful in certain
• systems, but many could do perfectly well without it.
32. • Finally a set could use copy, count, delete, intersect, and update
operationsÑalmost the same list
• as a symbol table, and for similar reasons. Copy is universal (as long as you
give due credit to
• your source :-) Update (unordered insert) and delete are fundamental to
all collections, and count is
• just plain handy to have around. Once again, some sort of read or retrieve
operation would be nice
• to have available, but index has all the wrong connotations. You could
have ÒdeleteÓ return an
• item, I suppose. On the other hand, append, index, and insert violate the
premise of
• Òunorderedness.Ó And having a set class without intersect (as well as
union) just wouldnÕt be
• proper.