Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
© SERGClass Diagram(UML)
UML
Class Diagram
Presented By :
Kajal Waghmare
Roll No : 95
© SERG
What is a Class Diagram?
Class Diagram (UML)
• A Class Diagram is a diagram describing the structure of
a
system.
•...
© SERGClass Diagram(UML)
Classes
ClassName
attributes
operations
A class is a description of a set of
objects that share t...
© SERGClass Diagram (UML)
Class Names
ClassName
attributes
operations
The name of the class is the only required
tag in th...
© SERGClass Diagram (UML)
Class Attributes
Person
name : String
address : Address
birthdate : Date
ssn : Id
An attribute i...
© SERGClass Diagram (UML)
Class Attributes (Cont’d)
Person
name : String
address : Address
birthdate : Date
/ age : Date
s...
© SERGClass Diagram (UML)
Class Attributes (Cont’d)
Person
+ name : String
# address : Address
# birthdate : Date
/ age : ...
© SERGClass Diagram (UML)
Class Operations
Person
name : String
address : Address
birthdate : Date
ssn : Id
eat
sleep
work...
© SERGClass Diagram (UML)
Class Responsibilities
A class may also include its responsibilities in a class diagram.
A respo...
© SERGClass Diagram (UML)
Relationships
In UML, object interconnections (logical or physical), are
modeled as relationship...
© SERGClass Diagram (UML)
Dependency Relationships
CourseSchedule
add(c : Course)
remove(c : Course)
Course
A dependency i...
© SERGClass Diagram (UML)
Generalization Relationships
Person
A generalization connects a subclass
to its superclass. It d...
© SERGClass Diagram (UML)
Generalization Relationships (Cont’d)
Student
UML permits a class to inherit from multiple super...
© SERGClass Diagram (UML)
Association Relationships
If two classes in a model need to communicate with each other,
there m...
© SERGClass Diagram (UML)
Association Relationships(Cont’d)
We can indicate the multiplicity of an association by adding
m...
© SERGClass Diagram (UML)
Association Relationships
(Cont’d)
The example indicates that every Instructor has one or more
S...
© SERGClass Diagram (UML)
Interfaces
An interface is a named set of
operations that specifies the behavior
of objects with...
© SERGClass Diagram (UML)
Enumeration
<<enumeration>>
Boolean
false
true
An enumeration is a user-defined
data type that c...
© SERGClass Diagram (UML)
Packages
Compiler
A package is a container-like element
for organizing other elements into
group...
© SERG
Example : Ticket Sale
Software Design (UML)
© SERG
Quiz 1
• An __________is a user-defined data type that consists of a
name and an ordered list of enumeration litera...
© SERG
Quiz 2
• Answer of Quiz 1 : 2. Enumeration
• We can indicate the ___________of an association by
adding ___________...
© SERG
Quiz 3
• Answer of Quiz 2 :4. Multiplicity , Multiplicity adornments
• _______________ denotes an inheritance of at...
© SERG
Quiz 4
• Answer of Quiz 3 : 3. Generalization
• ____________ can be rendered in the model by a one- or
two-compartm...
© SERG
Quiz 5
• Answer of Quiz 4 : All of above
• Generalization indicates a ___________in the subclass of
the more genera...
© SERG
• Answer of Quiz 5 : 2. Specialization
Class Diagram (UML)
Upcoming SlideShare
Loading in …5
×

Uml class Diagram

9,346 views

Published on

Uml class Diagram

Published in: Education
  • Be the first to comment

Uml class Diagram

  1. 1. © SERGClass Diagram(UML) UML Class Diagram Presented By : Kajal Waghmare Roll No : 95
  2. 2. © SERG What is a Class Diagram? Class Diagram (UML) • A Class Diagram is a diagram describing the structure of a system. • It consists the : • Classes • Attributes • Operations (or methods), • Relationships among the classes.
  3. 3. © SERGClass Diagram(UML) Classes ClassName attributes operations 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.
  4. 4. © SERGClass Diagram (UML) Class Names ClassName attributes operations 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.
  5. 5. © SERGClass Diagram (UML) Class Attributes Person name : String address : Address birthdate : Date ssn : Id An attribute is a named property of a class that describes the object being modeled. In the class diagram, attributes appear in the second compartment just below the name-compartment.
  6. 6. © SERGClass Diagram (UML) Class Attributes (Cont’d) Person name : String address : Address birthdate : Date / age : Date ssn : Id 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. For example, a Person’s age can be computed from his birth date. A derived attribute is designated by a preceding ‘/’ as in: / age : Date
  7. 7. © SERGClass Diagram (UML) Class Attributes (Cont’d) Person + name : String # address : Address # birthdate : Date / age : Date - ssn : Id Attributes can be: + public # protected - private / derived
  8. 8. © SERGClass Diagram (UML) Class Operations Person name : String address : Address birthdate : Date ssn : Id eat sleep work play Operations describe the class behavior and appear in the third compartment.
  9. 9. © SERGClass Diagram (UML) Class Responsibilities A class may also include its responsibilities in a class diagram. A responsibility is a contract or obligation of a class to perform a particular service. SmokeAlarm Responsibilities -- sound alert and notify guard station when smoke is detected. -- indicate battery state
  10. 10. © SERGClass Diagram (UML) Relationships In UML, object interconnections (logical or physical), are modeled as relationships. There are three kinds of relationships in UML: • Dependencies • Generalizations • Associations
  11. 11. © SERGClass Diagram (UML) Dependency Relationships CourseSchedule add(c : Course) remove(c : Course) Course A dependency indicates a semantic relationship between two or more elements. The dependency from CourseSchedule to Course exists because Course is used in both the add and remove operations of CourseSchedule.
  12. 12. © SERGClass Diagram (UML) Generalization Relationships Person A generalization connects a subclass to its superclass. It denotes an inheritance of attributes and behavior from the superclass to the subclass and indicates a specialization in the subclass of the more general superclass. Student
  13. 13. © SERGClass Diagram (UML) Generalization Relationships (Cont’d) Student UML permits a class to inherit from multiple superclasses, although some programming languages (e.g., Java) do not permit multiple inheritance. TeachingAssistant Employee
  14. 14. © SERGClass Diagram (UML) Association Relationships If two classes in a model need to communicate with each other, there must be link between them. An association denotes that link. StudentInstructor instructs Here , an association is instructs.
  15. 15. © SERGClass Diagram (UML) Association Relationships(Cont’d) 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: InstructorStudent 1..*
  16. 16. © SERGClass Diagram (UML) Association Relationships (Cont’d) The example indicates that every Instructor has one or more Students: InstructorStudent 1..*
  17. 17. © SERGClass Diagram (UML) Interfaces An interface is a named set of operations that specifies the behavior of objects without showing their inner structure. It can be rendered in the model by a one- or two-compartment rectangle, with the stereotype <<interface>> above the interface name. <<interface>> ControlPanel
  18. 18. © SERGClass Diagram (UML) Enumeration <<enumeration>> Boolean false true An enumeration is a user-defined data type that consists of a name and an ordered list of enumeration literals.
  19. 19. © SERGClass Diagram (UML) Packages Compiler A package is a container-like element for organizing other elements into groups. A package can contain classes and other packages and diagrams. Packages can be used to provide controlled access between classes in different packages.
  20. 20. © SERG Example : Ticket Sale Software Design (UML)
  21. 21. © SERG Quiz 1 • An __________is a user-defined data type that consists of a name and an ordered list of enumeration literals. Options : 1. Generalization 2. Enumeration 3. Association 4. Dependency Class Diagram (UML)
  22. 22. © SERG Quiz 2 • Answer of Quiz 1 : 2. Enumeration • We can indicate the ___________of an association by adding ___________ ___________ to the line denoting the association. Options: 1. Association , Association adornments 2. Multiplicity , Association adornments 3. Association , Multiplicity adornment 4. Multiplicity , Multiplicity adornments Class Diagram (UML)
  23. 23. © SERG Quiz 3 • Answer of Quiz 2 :4. Multiplicity , Multiplicity adornments • _______________ denotes an inheritance of attributes and behavior from the superclass to the subclass and indicates a specialization in the subclass of the more general superclass. Options: 1. Interfaces 2. Dependency 3. Generalization 4. Packages Class Diagram (UML)
  24. 24. © SERG Quiz 4 • Answer of Quiz 3 : 3. Generalization • ____________ can be rendered in the model by a one- or two-compartment rectangle, with the stereotype << >> above the name. Options: 1. Interface 2. Packages 3. Enumeration 4. None of these Class Diagram (UML)
  25. 25. © SERG Quiz 5 • Answer of Quiz 4 : All of above • Generalization indicates a ___________in the subclass of the more general super class. Options: 1. Association 2. Specialization 3. Relationship 4. Link Class Diagram (UML)
  26. 26. © SERG • Answer of Quiz 5 : 2. Specialization Class Diagram (UML)

×