Module 3
Module 3
Module – 3
Object Orientation Topics Covered:
1. What is object orientation? 12. Advanced objects and class concepts
2. What is OO development? 13. Association ends
3. OO themes 14. N-array association
4. Evidence for usefulness ofOO 15. Aggregation
development 16. Abstract class
5. Modeling as design technique 17. Multiple inheritance
6. Modeling: 18. Metadata
7. Abstraction 19. Reification; Constraints
8. The three models 20. Derived data; packages
9. Object and class concept
10. Link and association concepts
11. Generalization and inheritance
Page 1
Software Engineering 22MCA23
2. What is OO development?
OO development is a way of thinking about software based on abstraction that
exists in the real world as well as in the program. In this context development refers to
the software life cycle: analysis, design & implementation.
I. Modeling concepts, Not implementation: An OO development approach
encourages software developers to work & think in terms of the application
throughout the software lifecycle. It is only when the inherent concepts of the
application are identified or gained or understood that the details of data
structures & functions can be addressed effectively.
Page 2
Software Engineering 22MCA23
• Class design – The class designer adds details to the analysis model
in accordance with the system design strategy. The class designer elaborates
both domain & application objects using the same OO concepts & notation.
• Implementation – Implementers translate the classes & relationships
developed during class design into a particular programming language,
database or hardware.
III. Three Models: There are three kinds of models to describe a system from different
viewpoints: the class model for the objects in the system & their relationships;
the state model for the life history of objects; & the interaction model for the
interactions among objects. Each model applies during all the stages of
development & acquires detail as development progresses.
• The class model – describes the static structure of the objects in a system
& their relationships. The class model defines the context for software
development. A class diagram is a graph whose nodes are classes & whose
arcs are relationships among classes.
• The state model – describes the aspects of an object that change over time.
The state model specifies & implements control with state diagrams. A state
diagram is a graph whose nodes are states & whose arcs are transitions
between states causes by events.
• The interaction model – describes how the objects in a system
cooperate to achieve broader results. The interaction model starts with use
cases that are then elaborated with sequence & activity diagrams. A use case
diagram focuses on the functionality of a system – that is what a system
does for users. A sequence diagram shows the objects that interact & the
time sequence of their interaction. An activity diagram elaborates important
processing steps.
3. OO themes:
Page 3
Software Engineering 22MCA23
Page 4
Software Engineering 22MCA23
Advantages of OO Methodology:
6. Modeling:
A model is an abstraction of something for the purpose of understanding it
before building it. Because a model omits nonessential details, it is easier to manipulate
than the original entity.
Page 5
Software Engineering 22MCA23
7. Abstraction:
Abstraction is the selective examination of certain aspects of a problem. The goal
of abstraction is to isolate those aspects that are important for some purpose &
suppress those aspects that are unimportant.
All abstraction is incomplete & inaccurate. All human words & languages are
abstractions – incomplete descriptions of the real world. This does not destroy their
usefulness. The purpose of abstraction is to limit the universe so we can understand.
Page 6
Software Engineering 22MCA23
• The state model – describes the aspects of an object that change over time. The
state model specifies & implements control with state diagrams. A state
diagram is a graph whose nodes are states & whose arcs are transitions
between states causes by events.
• The interaction model – describes how the objects in a system cooperate
to achieve broader results. The interaction model starts with use cases that are
then elaborated with sequence & activity diagrams.
Classes:
Class diagrams:
Class diagrams provide a graphic notation for modeling classes & their
relationships, thereby describing possible objects. Class diagram are useful both for
abstract modeling & for designing actual programs. They are concise, easy to
understand & work well in practice.
An object diagram shows individual objects & their relationships. Object
diagrams are helpful for documenting test cases & discussing examples.
Page 7
Software Engineering 22MCA23
A class & objects: objects & classes are the focus of class modeling
The above figure shows a class (left) & instances (right) described by it.
Objects JoeSmith, MarySharp & an anonymous person are instances of class Person.
The same operation may apply to many different classes. Such an operation is
polymorphic: that is, the same operation takes on different forms in different classes. A
method is the implementation of an operation.
Page 8
Software Engineering 22MCA23
Page 9
Software Engineering 22MCA23
Multiplicity:
Multiplicity specifies the number of instances of one class that may relate to a
singleinstance of an associated class. Multiplicity constraints the number of related
objects. Theliterature often describes multiplicity as being “one” or “many”. UML
diagrams explicitly list multiplicity at the ends of association lines. The UMLspecifies
multiplicity with an interval, such as “1” (exactly one), “1 …*”(one or more),
or“3…5”(three to five, inclusive). The special symbol “*” is a shorthand notation that
denotes“many” (zero or more).
Page 10
Software Engineering 22MCA23
One-to-one association: Multiplicity specifies the number of instances of one class that
may relate to a single instance of an associated class
Page 11
Software Engineering 22MCA23
Association Classes:
An association class is an association that is also a class. Like the links of an association,
the instances of an association class derive identity from instances of theconstituent
classes. Like a class, an association class can have attributes & operations &participate
in associations.
Page 12
Software Engineering 22MCA23
Qualified associations:
A qualified association is an association in which an attribute called the
qualifieddisambiguates the objects for a “many” association end. It is possible to define
qualifier forone-to-many & many-to-many association.
Page 13
Software Engineering 22MCA23
Page 14
Software Engineering 22MCA23
Page 15
Software Engineering 22MCA23
Association end names are especially convenient for traversing associations, because
you can treat one as a pseudo attribute. Association end names are necessary
forassociations between tow objects of the same class.
Page 17
Software Engineering 22MCA23
Page 18
Software Engineering 22MCA23
Ternary association & links: An n-ary association can have association end names, just
like a binary association
15. Aggregation: -
Page 19
Software Engineering 22MCA23
Page 20
Software Engineering 22MCA23
Propagation of operations:
Propagation (also called triggering) is the automatic application of an operation to a
network of objects when the operation is applied to some starting object.Propagation
of operations to parts is often a good indicator of aggregation.
Page 21
Software Engineering 22MCA23
Page 22
Software Engineering 22MCA23
18. Metadata: -
Page 23
Software Engineering 22MCA23
Metadata is data that describes other data. For example, a class definition is metadata.
Models are inherently metadata, since they describe the things being modeled(rather
than being the things).
Above figure shows, an example of metadata & data. A car model has a model
name,year, base price & a manufacturer. Some examples of car models are 1969 Ford
Mustang &a 1975 Volkswagen Rabbit.
A physical car has a serial number, color, options & an owner. As an example ofphysical
cars, John Doe may own a blue Ford with serial number IFABP & a red Volkswagenwith
serial number 7E81F. A car model is a metadata relative to a physical car, which isdata.
Page 24
Software Engineering 22MCA23
Constraints: -
A constraint is a boolean condition involving model elements, such as objects,classes,
attributes, links, associations & generalization sets. A constraint restricts the valuesthat
elements can assume.
Page 25
Software Engineering 22MCA23
Packages: -
A package is a group of elements (classes, association, generalizations &
lesserpackages) with a common theme. A package partitions a model, making it easier
tounderstand & manage. Large applications may require several tiers of packages form
a treewith increasing abstraction toward the root, which is the application, the top-level
package.
There are various themes for forming packages: dominant classes, dominant
relationships, major aspects of functionality & symmetry
Page 26