Class Diagram advanced concepts - PowerPoint PPT Presentation

1 / 30
About This Presentation
Title:

Class Diagram advanced concepts

Description:

Information hiding. Responsibility. 7M701. 5. Encapsulation ... Information hiding. Information hiding is the use of an encapsulation to restrict from external ... – PowerPoint PPT presentation

Number of Views:461
Avg rating:3.0/5.0
Slides: 31
Provided by: OntwerpS
Category:

less

Transcript and Presenter's Notes

Title: Class Diagram advanced concepts


1
Class Diagramadvanced concepts
2
Characteristics of Object Oriented Design (OOD)
  • Data and operations (functions) are combined ?
    object
  • Objects arte abstractions of real-world or system
    entities and manage themselves.
  • Objects are independent and encapsulate state and
    represent information.
  • System functionality is expressed in terms of
    object services.
  • Objects communicate by message passing.

3
  • Objects are abstractions of real-world entities.
  • Objects encapsulate state and represent
    information.
  • Objects state is protected.
  • Objects have responsibility.
  • Objects interact by interfaces.

4
Conceptions
  • Encapsulation
  • Information hiding
  • Responsibility

5
Encapsulation
  • Encapsulation is the grouping of related ideas
    into one unit, which can thereafter be referred
    to by a single name.
  • Object-oriented encapsulation is the packaging of
    operations and attributes representing state into
    an object type so that state is accessible or
    modifiable via the interface provided by the
    encapsulation.

6
Information hiding
  • Information hiding is the use of an encapsulation
    to restrict from external visibility certain
    information decisions that are internal to the
    encapsulation structure.

7
Responsibility
  • Object oriented design is a responsibility driven
    design approach.
  • Objects have responsibilities that they prove
    oneself.
  • Therefore, collaboration with other objects is
    needed.

8
Objects and object classes
  • Objects are entities in a software system which
    represent instances of real-world and system
    entities
  • Object classes are templates for objects. They
    may be used to create objects
  • Object classes may inherit attributes and
    services from other object classes

9
Objects
An object is an entity which has a state and a
defined set of operations which operate on that
state. The state is represented as a set of
object attributes. The operations associated with
the object provide services to other objects
(clients) which request these services when some
computation is required. Objects are created
according to some object class definition. An
object class definition serves as a template for
objects. It includes declarations of all the
attributes and services which should be
associated with an object of that class.
10
Class diagrams
  • Class diagrams are the most commonly used
    diagrams in UML.
  • Class diagrams are for visualizing, specifying
    and documenting the system from a static
    perspective.
  • Class diagrams indicate which classes know about
    other classes and, if they do, what type of
    relationship exists.
  • Class diagrams help in showing the functional
    requirements of the system by the services the
    system should provide to its end-users.

11
Relationship between diagrams
12
(No Transcript)
13
Advanced Class Features
14
Advanced Class Concepts Visibility
  • Visibility class members (attributes,
    operations) may be specified as
  • we have feature f, an attribute or operation
    that is defined on an object O of class C
  • public
  • f is public ? f is visible to any object and f
    is inherited by the subclasses of C.
  • private
  • f is private ? f is visible only to O and f is
    not inherited by the subclasses of C.
  • - protected
  • (f is protected ? f is visible only to objects of
    class C and to objects of Cs subclasses and f is
    inherited by the subclasses of C.
  • Restricting visibility is the same as restricting
    accessibility.

15
Advanced Class Concepts Scope
  • Individual member data ( attributes) may have
  • Class scope a single copy of an attribute is
    shared by all instances of a class.
  • Instance scope each instance of a class would
    have its own copy of the attribute.

16
Advanced Class Concepts Abstract
  • An operation is abstract if it has no
    implementation.
  • A abstract class cannot have any direct
    instances.
  • Abstract classes only occur in the context of an
    inheritance hierarchy.
  • Abstract operations and classes are specified by
    writing its name in italics.

17
Advanced Class Concepts Abstract
18
Interfaces and Abstract Classes
  • One can vary the interfaces of classes
    independent of the implementation.
  • A pure interface is a class with no
    implementation and, therefore has operation
    declarations but no method bodies an fields.
  • Interfaces are often declared through abstract
    classes.

19
Window as Abstract Class
20
Interfaces and Abstract Class
  • Sub classing is not only the way to do this.
  • For instance Java provides an interface
    construct, and the compiler checks that the
    implementing class provides implementations of
    all the interfaces operations.

21
Lollipop notation for Interfaces
22
Aggregation and Composition
  • Aggregation is a special form of association that
    specifies a whole-part relationship between the
    aggregate (the whole) and a component (the part)
    aggregation is the part-of relationship. it is
    a special form of association in which a
    collection of objects, each having an independent
    existence, is associated with an single object
    unfilled diamond
  • Composition is a form of aggregation with strong
    ownership and coincident lifetime of the parts by
    the whole the part object may belong to only one
    whole the parts are usually expected to live
    and die with the whole.
  • (usually, any deletion of the whole is
    considered to cascade to the partsfilled
    diamond

23
Aggregation and Composition Example
24
Alternative notation for Composition
25
Derived Associations and Attributes
  • Derived associations and attributes can be
    calculated from other associations and
    attributes, respectively, on a class diagram.
  • For example, an age attribute of a Person can be
    derived if you know that Persons date of birth.

26
(No Transcript)
27
Qualified Associations
  • The qualifier specifies how a specific object at
    the many end of the association is identified,
    and may be seen as a kind of key separating all
    the objects in the association.

28
Relations and Constraints
29
Object Diagram
  • Shows a set of objects and their relationships.
  • Illustrates instances of things found in class
    diagrams.
  • Represents the static design view.

30
Object Diagram Example
Write a Comment
User Comments (0)
About PowerShow.com