Class Diagram & Object Diagram
ATA.USAMA
AMP/IT/2015/F/0018
What is a Class Diagram?
 A Class Diagram is a diagram describing the structure
of a system.
 It consists the :
 Classes.
 Attributes.
 Operations.
 Relationships among the classes.
Classes
 A class is a description of a set of objects that share the
same attributes , operations, relationships, and
semantics.
 Graphically, a class is rendered as a rectangle, usually
including its name , attributes, and operations in
separate , designated compartments.
ClassName
attributes
operations
Class Names
 The name of the class is the only required tag in the
graphical representation of a class. It always appears in
the top-most compartment.
ClassName
attributes
operations
Class Attributes
should include all fields of the object.
Attributes are usually listed in the form:
attributeName : Type
A derived attribute is one that can be computed from other
attributes, but doesn’t actually exist.
Example;
 a Person’s age can be computed from his birth date.
/ age : Date
Person
name : String
address : Address
birthdate : Date
/ age : Date
ssn : Id
Class Attributes (Cont..)
 Attributes can be:
 + public.
 # protected.
 - private.
 / derived.
Person
+ name : String
# address : Address
# birthdate : Date
/ age : Date
- ssn : Id
Class Operations
 Operations describe the class behavior and appear in
the third compartment.
Person
name : String
address : Address
birthdate : Date
ssn : Id
eat
sleep
work
play
Relationships
There are three types of relationships you can
set up between classes.
Dependencies
Generalizations
Associations
Dependency Relationships
 A dependency indicates a semantic relationship
between two or more elements.
 Symbolized by dotted line.
Generalization Relationships
 A generalization connects a subclass to its superclass.
 Generalization provides the capability to create
supper classes that encapsulate structure and behavior
common to several classes.
 specialization provides the ability to create subclasses
that represent refinement to the supper-class.t.
Example :
Association Relationships
 If two classes in a model need to communicate with each
other, there must be link between them.
Here , an association is instructs
Instructor Student
instructs
Association Relationships(Cont..)
 We can indicate the multiplicity of an association by
adding multiplicity adornments to the line denoting the
association.
The example indicates that a Student has one or more
Instructors:
Student Instructor
1..*
Thank You
Kingsoft Office
published by www.Kingsoftstore.com
@Kingsoft_Office
kingsoftstore

class Diagram.ppt

  • 1.
    Class Diagram &Object Diagram ATA.USAMA AMP/IT/2015/F/0018
  • 2.
    What is aClass Diagram?  A Class Diagram is a diagram describing the structure of a system.  It consists the :  Classes.  Attributes.  Operations.  Relationships among the classes.
  • 3.
    Classes  A classis a description of a set of objects that share the same attributes , operations, relationships, and semantics.  Graphically, a class is rendered as a rectangle, usually including its name , attributes, and operations in separate , designated compartments. ClassName attributes operations
  • 4.
    Class Names  Thename of the class is the only required tag in the graphical representation of a class. It always appears in the top-most compartment. ClassName attributes operations
  • 5.
    Class Attributes should includeall fields of the object. Attributes are usually listed in the form: attributeName : Type A derived attribute is one that can be computed from other attributes, but doesn’t actually exist. Example;  a Person’s age can be computed from his birth date. / age : Date Person name : String address : Address birthdate : Date / age : Date ssn : Id
  • 6.
    Class Attributes (Cont..) Attributes can be:  + public.  # protected.  - private.  / derived. Person + name : String # address : Address # birthdate : Date / age : Date - ssn : Id
  • 7.
    Class Operations  Operationsdescribe the class behavior and appear in the third compartment. Person name : String address : Address birthdate : Date ssn : Id eat sleep work play
  • 8.
    Relationships There are threetypes of relationships you can set up between classes. Dependencies Generalizations Associations
  • 9.
    Dependency Relationships  Adependency indicates a semantic relationship between two or more elements.  Symbolized by dotted line.
  • 10.
    Generalization Relationships  Ageneralization connects a subclass to its superclass.  Generalization provides the capability to create supper classes that encapsulate structure and behavior common to several classes.  specialization provides the ability to create subclasses that represent refinement to the supper-class.t.
  • 11.
  • 12.
    Association Relationships  Iftwo classes in a model need to communicate with each other, there must be link between them. Here , an association is instructs Instructor Student instructs
  • 13.
    Association Relationships(Cont..)  Wecan indicate the multiplicity of an association by adding multiplicity adornments to the line denoting the association. The example indicates that a Student has one or more Instructors: Student Instructor 1..*
  • 14.
    Thank You Kingsoft Office publishedby www.Kingsoftstore.com @Kingsoft_Office kingsoftstore