SlideShare a Scribd company logo
Generalizable
Element
Namespace
Model
Element
name
visibility
isSpecification
Classifier
isRoot
Constraint
Body
Coming up: Introduction to
Objects
Objects, Classes, and
Basic Class Diagrams
CS/SWE 421
Introduction to Software Engineering
Dan Fleck
(Slides adapted from Dr. Stephen Clyde with permission)
Coming up: Introduction to Objects
Introduction to Objects
 Objects are the fundamental building blocks
of object-oriented systems
 What is an object?
– It represents any “thing”
– It has a boundary in space and time
– It is an abstraction
– It encapsulates state and/or behavior
– It has identity
Coming up: Exercise - Object Hunt
Introduction to Objects
 What aren’t objects?
– Events (sometimes)
– Relationships between objects (most of the
time)
– Behavior (most of the time)
– Constraints (most of the time)
Coming up: Introduction to Classes
Exercise - Object Hunt
 Part 1 - List examples of objects in the
Third National Bank Elevator System
 Part 2 - List some concepts from this
system that would not typically be modeled
as objects
Coming up: Three Perspectives
Introduction to Classes
 Classes are abstractions that allow us to deal with whole collections of objects that share some
commonalties
 Examples of classes in a Student Records Management System
Student
Course
Class
Section
Instructor
Class
Grade Major
Department
College
Semester
Coming up: Classes from different Perspectives
Three Perspectives
 Objects and classes, as well as all other
modeling components in UML, can be
interpreted from different perspectives:
 Three common perspectives:
– Analysis - description of the problem
domain
– Specification - logical description of
software system
– Implementation - description of software
components and their deployment
Coming up: Class Syntax
Classes from different Perspectives
 Meaning from three perspectives
– Analysis: sets of objects
– Specifications: interfaces to encapsulated
software representations of objects
– Implementations: abstract data types
Student
Analysis Specification
Student
{Joe, Sue, Mary,
Frank, Tim, …}
Interface Student
{…}
Implementation
class Student
{…}
Student
Coming up: Class Names
Class Syntax
 A box divided into
compartments
– Name
– Attributes
– Operations
– Responsibilities
– Used-defined
compartments
Student
major: String
gpa: Real
standing: String
add(Class Section)
drop(Class Section)
-- The set of students
known to the registration
system
-- An exception occurs if
gpa falls below 2.0
Coming up: Class Name Syntax
Class Names
 The name should be a noun or noun
phrase
 The name should be singular and
description of each object in the class
 The name should be meaningful from a
problem-domain perspective
– “Student” is better than “Student Data” or
“S-record” or any other implementation
driven name
 Avoid jargon in the names
 Try to make the name descriptive of the
class’s common properties
Coming up: Return to Objects – Object Syntax
Exercise – Class Identification
 Identify meaningful classes in the Elevator
System
Coming up: Object Name Syntax
Return to Objects – Object Syntax
 Object syntax is
similar to class syntax,
except
– the name identifies
specific or generic
object
– the name includes the
class that the object
belongs to
 Remember, individual
objects are instances
of classes
joe: Student
major: String = “CS”
gpa: Real = 4.0
standing: String = “”
add(Class Section)
drop(Class Section)
Coming up: Attributes from an Analysis Perspective
Attributes
 Attributes represent characteristics or
properties of objects
 They are place holders or slots that hold
values
 The values they hold are other objects
 The name of an attribute communicates its
meaning
 An attribute can be defined for individual
objects or classes of objects
– If defined for a class, then every object in
the class has that attribute (place holder)
Coming up: Attributes from a Specification Perspective
Attributes from an Analysis
Perspective
 An attribute relates an object to some other
object
 It has the same semantics as an association
joe: Student
name: String = “Joe Jones”
joe: Student Joe Jones : String
Is basically the
same as ...
name
1
Coming up: Attributes from an Implementation Perspective
Attributes from a Specification
Perspective
 An attribute represents an obligation to
provide or manage a certain (single) piece
of information
Student
major: String
gpa: Real
standing: String
 For example, each
Student object must
be able to
encapsulate a
major, a GPA, and
a standing
Coming up: Exercise – Attributes
Attribute Syntax
visibility: public “+”, protected “#”, or private “-”
name: capitalize first letter of each word that
makes up the name, except for the first
multiplicity: number, range, or sequence of
number or ranges.
type: build-in type or any user-defined class
initial-value: any constant and user-defined object
property-string: e.g, changeable, addOnly, frozen
[visibility] name [multiplicity] [:type] [=initial-value]
[{property-string}]
Coming up: Operations
Operations
 Meaning from three perspectives
– Analysis: Ways in which objects interaction
– Specification: An obligation to provide a
service
– Implementation: A function member, a
method
Coming up: Operation Syntax
Operations
Student
major: String
GPA: Real
standing: String
add(Class Section)
drop(Class Section)
Class Section
name: String
capacity: Integer
add(Student)
drop(Student)
checkPrerequisites(Students)
Prerequisite
<has
takes>
Course
Coming up: Type of Relationships in Class Diagrams
Operation Syntax
visibility: “+”, “#”, “-”
name: verb or verb phase, capitalize first letter
of every word, except first
parameter-list: coma separated list of
parameters
return-type: primitive type or user-defined type
property-string: isQuery, sequential, guarded,
concurrent
[visibility] name [(parameter-list)] [:return-
type] [{property-strong}]
Coming up: Associations
Type of Relationships in Class
Diagrams
Relation
A consolidated snippet of the UML Meta-model
Association
Generalization Dependency
Aggregation
Binary Association N-ary Association
Coming up: Associations
Associations
 An association is a structural relationship
that specifies that objects of class may be
connected to objects of another class
 Meaning from three perspectives
– Analysis: Links between objects
– Specification: Obligation to provide a
connection between objects
– Implementation: Object pointers,
references, linking structures, etc.
Coming up: Association Names
Associations
Student
Class
Section
Course
Semester
Instructor
Department
takes>
is registered for>
teaches>
sponsors>
<works
for
is
instance
of>
i
s
h
e
l
d
d
u
r
i
n
g
>
Coming up: Navigation
Association Names
 Associations may be named
– The names should communicate the
meaning of the links
– The names are typically verb phases
– The name should include an arrow
indicating the direction in which the name
should be read
Coming up: Navigation
Navigation
 The navigation of associations can be
– uni-directional
– bi-directional
– unspecified
Class
Section
Course
Instructor
Department
teaches>
sponsors>
<works
for
is
instance
of>
Coming up: Generalization
Generalization
 Generalization is another kind of
relationship in UML – see Meta Model
 From an analysis perspective, it is a pure
generalization/specialization concept, i.e.,
the specialization is a subset of the
generalization
Student
Person
Graduate
Student
Coming up: Generalization
Generalization
 From a specification/implementation
perspective, generalization can represent sub-
typing, inheritance, type capability, and
substitutability (depends on the language)
Student
major: String
GPA: Real
standing: String
add(Class Section)
drop(Class Section)
Person
name: String
address: String
changeAddress(new_address)
Coming up: Class Diagrams
Exercise – Simple Associations
 From an analysis perspective:
– Identify meaningful associations and
generalization/specializations among
classes in the Elevator System
Coming up: Class Diagrams
Class Diagrams
 Class Diagrams describe
– the types of objects in a system
– their properties (attributes and operations)
– relationships between objects
 They can also include
– Grouping concepts like packages
– Constraints
– Various kinds of annotations
Coming up: Multiplicity Constraints
Multiplicity Constraints
Student
Class
Section
Course
Semester
Instructor
Department
takes>
is registered for>
teaches>
sponsors>
<works
for
is
instance
of>
i
s
h
e
l
d
d
u
r
i
n
g
>
1..*
1
1..*
1..*
1
1
1..*
0..8
0..*
0..6
1..3
Questions
 From the previous diagram
– How many classes can a student take?
– Do you have to be registered in any classes
to be a student?
– Do I need to teach this class to be an
Instructor? Do I need to teach ANY
classes?
Coming up: Dependencies
Multiplicity Constraints
 A multiplicity constraint can be
– a single number
– a “*”, meaning an arbitrarily large number or
simply “many”
– a range, denoted by “min..max”
– a sequence of single numbers and ranges
Coming up: Dependencies
Dependencies
Relation
A consolidated snippet of the UML Meta-model
Association
Generalization Dependency
Aggregation
Binary Association N-ary Association
Coming up: Dependencies
Dependencies
 A dependency is a type of relationship
 It says that one modeling component “uses”
another.
 If the later changes then, the former may
have to change as well
Student
add(Course)
drop(Course)
Prerequisite
Coming up: Dependencies
Dependencies
 Meaning from three perspectives
– Analysis: physical or logical dependency
between the connected classes
– Specification: a “uses” relationship at an
interface level
– Implementation: a “uses” relationship at an
implementation level.
Just think: uses!
Coming up: Aggregations (is part of)
Dependencies
 Syntax:
– a dashed link with an straight-line
arrowhead point to a component on which
there is a dependency
 Dependencies can be defined among:
classes, notes, packages, and other types
of components
 Can dependencies go both ways?
 Any problems with having lots of
dependencies?
Coming up: Aggregation
Aggregations (is part of)
Relation
A consolidated snippet of the UML Meta-model
Association
Generalization Dependency
Aggregation
Binary Association N-ary Association
Coming up: Composition (very similar to aggregation)
Aggregation
 Aggregation: is a special kind of association
that means “part of”
 Aggregations should focus on single type of
composition (physical, organization, etc.)
1 1
*
4..*
1
1
1 1
1..3 1
0..9 1
Pizza Order
Slice
Crust
Sauce Serving
Cheese Serving
Topping Serving
Coming up: Using a class diagram
Composition (very similar to aggregation)
 Think of composition as a stronger form of
aggregation. Composition means
something is a part of the whole, but cannot
survive on it’s own.
Building
Room
Lets look at
BookstoreExample4.jpg
 Does John McCain (who has 7 houses) have
a problem using this system?
 If Barack Obama decides to create a Federal
sales tax, how would we change the system?
 Why is there a display method in Item, Book,
MusicCD and Software?
 An ItemOrder is part of how many Orders?
 Can you explain how a search works using
this diagram?
Class Exercise
 Lets create the WeGrow class diagram
Coming up: Questions
Validating a class diagram
 One of the most important, and often
overlooked issues is how to validate a class
diagram. (Usually best for an diagram at the
implementation perspective)
 Given a specification or a use-case, can you
look at the class diagram and use attributes
and methods to “execute” a use case?
 Lets try it for the WeGrow class diagram
Coming up: More Questions
Questions
 What’s the difference between an attribute and an
association with another class? For example, should
“grade” be an attribute or a link to another class called
“Grade”?
 When during the software engineering life cycle should
you build classes diagrams?
Coming up: More Questions
More Questions
 How do you know when a class diagram is
complete?
 How can you manage change control on all
the class diagrams for project?
 What do you do with class diagrams after a
system has been built and delivered?
Bonus Slide!
 If you’re interested in Auto-generating UML,
Netbeans has an option to do it.
– Install the UML plugin
– Right-click on a project
– Choose “Reverse Engineer”
– Go to the new UML project
– Select a package and choose to generate a
new UML diagram

More Related Content

Similar to Basic Class Diagrams in software engineering (20)

PPT
M03 1 Structuraldiagrams
Dang Tuan
 
DOCX
Chapterunifiedmo 3 UML Class Diagram.docx
MohammedNouh7
 
PPT
UML Diagrams: Class Diagrams in Software Engineering
NabeelRehman21
 
PPT
Class diagrams
Nadia_Nazeer
 
PPT
Uml - An Overview
Raj Thilak S
 
PPT
08 class and sequence diagrams
kebsterz
 
PPTX
1. introduction to uml
PRABU M
 
PPT
Week 10-classdiagrams.pptdddddddddddddddddddddddddddd
v67904413
 
PPT
Descriptions of class diagrams in software
ssuser9d62d6
 
PPT
Chapter3
Dang Tuan
 
DOCX
Structural ModelingDr. Ardeshir BadrObjectives• .docx
susanschei
 
PPT
UML-class_diagram.ppt diagrams ppt download
divijareddy0502
 
PPT
UML-class diagram for beginners to adance.ppt
WorkDrive2
 
PPT
cse 355 UML class diagram software engineering.ppt
Safaet Hossain
 
PPT
UML-class_diagram.ppt
PragnyaNandaSabat
 
PPTX
Relationships and their representation in a class diagram.pptx
nesarahmad37
 
PPTX
Slideshow on the notes of software engineering
erickbaldskie
 
PPTX
Unit 1- OOAD ppt
PRIANKA R
 
PPTX
Fundamentals of Software Engineering
Madhar Khan Pathan
 
PPTX
Unified Modeling Language and Examples .pptx
abinaya707644
 
M03 1 Structuraldiagrams
Dang Tuan
 
Chapterunifiedmo 3 UML Class Diagram.docx
MohammedNouh7
 
UML Diagrams: Class Diagrams in Software Engineering
NabeelRehman21
 
Class diagrams
Nadia_Nazeer
 
Uml - An Overview
Raj Thilak S
 
08 class and sequence diagrams
kebsterz
 
1. introduction to uml
PRABU M
 
Week 10-classdiagrams.pptdddddddddddddddddddddddddddd
v67904413
 
Descriptions of class diagrams in software
ssuser9d62d6
 
Chapter3
Dang Tuan
 
Structural ModelingDr. Ardeshir BadrObjectives• .docx
susanschei
 
UML-class_diagram.ppt diagrams ppt download
divijareddy0502
 
UML-class diagram for beginners to adance.ppt
WorkDrive2
 
cse 355 UML class diagram software engineering.ppt
Safaet Hossain
 
UML-class_diagram.ppt
PragnyaNandaSabat
 
Relationships and their representation in a class diagram.pptx
nesarahmad37
 
Slideshow on the notes of software engineering
erickbaldskie
 
Unit 1- OOAD ppt
PRIANKA R
 
Fundamentals of Software Engineering
Madhar Khan Pathan
 
Unified Modeling Language and Examples .pptx
abinaya707644
 

More from SurindraKumar (9)

PPT
Amplitude modulation and frequency modulation
SurindraKumar
 
PPT
Database management system in engineering
SurindraKumar
 
PPT
Database management system in software engineering
SurindraKumar
 
PPT
Amplitude modulation and frequency modulation in analog and digital communica...
SurindraKumar
 
PPT
Basic Class Diagrams in fundamental computing.ppt
SurindraKumar
 
PPT
Object oriented programming in C++ programming language
SurindraKumar
 
PPT
Introduction to software engineering in data science.ppt
SurindraKumar
 
PPT
Department of Computer science and engineering
SurindraKumar
 
PPT
Object oriented programming language in software engineering
SurindraKumar
 
Amplitude modulation and frequency modulation
SurindraKumar
 
Database management system in engineering
SurindraKumar
 
Database management system in software engineering
SurindraKumar
 
Amplitude modulation and frequency modulation in analog and digital communica...
SurindraKumar
 
Basic Class Diagrams in fundamental computing.ppt
SurindraKumar
 
Object oriented programming in C++ programming language
SurindraKumar
 
Introduction to software engineering in data science.ppt
SurindraKumar
 
Department of Computer science and engineering
SurindraKumar
 
Object oriented programming language in software engineering
SurindraKumar
 
Ad

Recently uploaded (20)

PPTX
265587293-NFPA 101 Life safety code-PPT-1.pptx
chandermwason
 
PPTX
Server Side Web Development Unit 1 of Nodejs.pptx
sneha852132
 
PPTX
Thermal runway and thermal stability.pptx
godow93766
 
DOCX
CS-802 (A) BDH Lab manual IPS Academy Indore
thegodhimself05
 
PPTX
Pharmaceuticals and fine chemicals.pptxx
jaypa242004
 
PDF
6th International Conference on Machine Learning Techniques and Data Science ...
ijistjournal
 
PPTX
MPMC_Module-2 xxxxxxxxxxxxxxxxxxxxx.pptx
ShivanshVaidya5
 
PDF
ARC--BUILDING-UTILITIES-2-PART-2 (1).pdf
IzzyBaniquedBusto
 
PPTX
Introduction to Design of Machine Elements
PradeepKumarS27
 
PDF
Water Design_Manual_2005. KENYA FOR WASTER SUPPLY AND SEWERAGE
DancanNgutuku
 
PPTX
原版一样(Acadia毕业证书)加拿大阿卡迪亚大学毕业证办理方法
Taqyea
 
PPTX
ISO/IEC JTC 1/WG 9 (MAR) Convenor Report
Kurata Takeshi
 
PDF
Book.pdf01_Intro.ppt algorithm for preperation stu used
archu26
 
PDF
Unified_Cloud_Comm_Presentation anil singh ppt
anilsingh298751
 
PPTX
Solar Thermal Energy System Seminar.pptx
Gpc Purapuza
 
PDF
Ethics and Trustworthy AI in Healthcare – Governing Sensitive Data, Profiling...
AlqualsaDIResearchGr
 
PPTX
Lecture 1 Shell and Tube Heat exchanger-1.pptx
mailforillegalwork
 
PPTX
Heart Bleed Bug - A case study (Course: Cryptography and Network Security)
Adri Jovin
 
PDF
Zilliz Cloud Demo for performance and scale
Zilliz
 
PPTX
美国电子版毕业证南卡罗莱纳大学上州分校水印成绩单USC学费发票定做学位证书编号怎么查
Taqyea
 
265587293-NFPA 101 Life safety code-PPT-1.pptx
chandermwason
 
Server Side Web Development Unit 1 of Nodejs.pptx
sneha852132
 
Thermal runway and thermal stability.pptx
godow93766
 
CS-802 (A) BDH Lab manual IPS Academy Indore
thegodhimself05
 
Pharmaceuticals and fine chemicals.pptxx
jaypa242004
 
6th International Conference on Machine Learning Techniques and Data Science ...
ijistjournal
 
MPMC_Module-2 xxxxxxxxxxxxxxxxxxxxx.pptx
ShivanshVaidya5
 
ARC--BUILDING-UTILITIES-2-PART-2 (1).pdf
IzzyBaniquedBusto
 
Introduction to Design of Machine Elements
PradeepKumarS27
 
Water Design_Manual_2005. KENYA FOR WASTER SUPPLY AND SEWERAGE
DancanNgutuku
 
原版一样(Acadia毕业证书)加拿大阿卡迪亚大学毕业证办理方法
Taqyea
 
ISO/IEC JTC 1/WG 9 (MAR) Convenor Report
Kurata Takeshi
 
Book.pdf01_Intro.ppt algorithm for preperation stu used
archu26
 
Unified_Cloud_Comm_Presentation anil singh ppt
anilsingh298751
 
Solar Thermal Energy System Seminar.pptx
Gpc Purapuza
 
Ethics and Trustworthy AI in Healthcare – Governing Sensitive Data, Profiling...
AlqualsaDIResearchGr
 
Lecture 1 Shell and Tube Heat exchanger-1.pptx
mailforillegalwork
 
Heart Bleed Bug - A case study (Course: Cryptography and Network Security)
Adri Jovin
 
Zilliz Cloud Demo for performance and scale
Zilliz
 
美国电子版毕业证南卡罗莱纳大学上州分校水印成绩单USC学费发票定做学位证书编号怎么查
Taqyea
 
Ad

Basic Class Diagrams in software engineering

  • 1. Generalizable Element Namespace Model Element name visibility isSpecification Classifier isRoot Constraint Body Coming up: Introduction to Objects Objects, Classes, and Basic Class Diagrams CS/SWE 421 Introduction to Software Engineering Dan Fleck (Slides adapted from Dr. Stephen Clyde with permission)
  • 2. Coming up: Introduction to Objects Introduction to Objects  Objects are the fundamental building blocks of object-oriented systems  What is an object? – It represents any “thing” – It has a boundary in space and time – It is an abstraction – It encapsulates state and/or behavior – It has identity
  • 3. Coming up: Exercise - Object Hunt Introduction to Objects  What aren’t objects? – Events (sometimes) – Relationships between objects (most of the time) – Behavior (most of the time) – Constraints (most of the time)
  • 4. Coming up: Introduction to Classes Exercise - Object Hunt  Part 1 - List examples of objects in the Third National Bank Elevator System  Part 2 - List some concepts from this system that would not typically be modeled as objects
  • 5. Coming up: Three Perspectives Introduction to Classes  Classes are abstractions that allow us to deal with whole collections of objects that share some commonalties  Examples of classes in a Student Records Management System Student Course Class Section Instructor Class Grade Major Department College Semester
  • 6. Coming up: Classes from different Perspectives Three Perspectives  Objects and classes, as well as all other modeling components in UML, can be interpreted from different perspectives:  Three common perspectives: – Analysis - description of the problem domain – Specification - logical description of software system – Implementation - description of software components and their deployment
  • 7. Coming up: Class Syntax Classes from different Perspectives  Meaning from three perspectives – Analysis: sets of objects – Specifications: interfaces to encapsulated software representations of objects – Implementations: abstract data types Student Analysis Specification Student {Joe, Sue, Mary, Frank, Tim, …} Interface Student {…} Implementation class Student {…} Student
  • 8. Coming up: Class Names Class Syntax  A box divided into compartments – Name – Attributes – Operations – Responsibilities – Used-defined compartments Student major: String gpa: Real standing: String add(Class Section) drop(Class Section) -- The set of students known to the registration system -- An exception occurs if gpa falls below 2.0
  • 9. Coming up: Class Name Syntax Class Names  The name should be a noun or noun phrase  The name should be singular and description of each object in the class  The name should be meaningful from a problem-domain perspective – “Student” is better than “Student Data” or “S-record” or any other implementation driven name  Avoid jargon in the names  Try to make the name descriptive of the class’s common properties
  • 10. Coming up: Return to Objects – Object Syntax Exercise – Class Identification  Identify meaningful classes in the Elevator System
  • 11. Coming up: Object Name Syntax Return to Objects – Object Syntax  Object syntax is similar to class syntax, except – the name identifies specific or generic object – the name includes the class that the object belongs to  Remember, individual objects are instances of classes joe: Student major: String = “CS” gpa: Real = 4.0 standing: String = “” add(Class Section) drop(Class Section)
  • 12. Coming up: Attributes from an Analysis Perspective Attributes  Attributes represent characteristics or properties of objects  They are place holders or slots that hold values  The values they hold are other objects  The name of an attribute communicates its meaning  An attribute can be defined for individual objects or classes of objects – If defined for a class, then every object in the class has that attribute (place holder)
  • 13. Coming up: Attributes from a Specification Perspective Attributes from an Analysis Perspective  An attribute relates an object to some other object  It has the same semantics as an association joe: Student name: String = “Joe Jones” joe: Student Joe Jones : String Is basically the same as ... name 1
  • 14. Coming up: Attributes from an Implementation Perspective Attributes from a Specification Perspective  An attribute represents an obligation to provide or manage a certain (single) piece of information Student major: String gpa: Real standing: String  For example, each Student object must be able to encapsulate a major, a GPA, and a standing
  • 15. Coming up: Exercise – Attributes Attribute Syntax visibility: public “+”, protected “#”, or private “-” name: capitalize first letter of each word that makes up the name, except for the first multiplicity: number, range, or sequence of number or ranges. type: build-in type or any user-defined class initial-value: any constant and user-defined object property-string: e.g, changeable, addOnly, frozen [visibility] name [multiplicity] [:type] [=initial-value] [{property-string}]
  • 16. Coming up: Operations Operations  Meaning from three perspectives – Analysis: Ways in which objects interaction – Specification: An obligation to provide a service – Implementation: A function member, a method
  • 17. Coming up: Operation Syntax Operations Student major: String GPA: Real standing: String add(Class Section) drop(Class Section) Class Section name: String capacity: Integer add(Student) drop(Student) checkPrerequisites(Students) Prerequisite <has takes> Course
  • 18. Coming up: Type of Relationships in Class Diagrams Operation Syntax visibility: “+”, “#”, “-” name: verb or verb phase, capitalize first letter of every word, except first parameter-list: coma separated list of parameters return-type: primitive type or user-defined type property-string: isQuery, sequential, guarded, concurrent [visibility] name [(parameter-list)] [:return- type] [{property-strong}]
  • 19. Coming up: Associations Type of Relationships in Class Diagrams Relation A consolidated snippet of the UML Meta-model Association Generalization Dependency Aggregation Binary Association N-ary Association
  • 20. Coming up: Associations Associations  An association is a structural relationship that specifies that objects of class may be connected to objects of another class  Meaning from three perspectives – Analysis: Links between objects – Specification: Obligation to provide a connection between objects – Implementation: Object pointers, references, linking structures, etc.
  • 21. Coming up: Association Names Associations Student Class Section Course Semester Instructor Department takes> is registered for> teaches> sponsors> <works for is instance of> i s h e l d d u r i n g >
  • 22. Coming up: Navigation Association Names  Associations may be named – The names should communicate the meaning of the links – The names are typically verb phases – The name should include an arrow indicating the direction in which the name should be read
  • 23. Coming up: Navigation Navigation  The navigation of associations can be – uni-directional – bi-directional – unspecified Class Section Course Instructor Department teaches> sponsors> <works for is instance of>
  • 24. Coming up: Generalization Generalization  Generalization is another kind of relationship in UML – see Meta Model  From an analysis perspective, it is a pure generalization/specialization concept, i.e., the specialization is a subset of the generalization Student Person Graduate Student
  • 25. Coming up: Generalization Generalization  From a specification/implementation perspective, generalization can represent sub- typing, inheritance, type capability, and substitutability (depends on the language) Student major: String GPA: Real standing: String add(Class Section) drop(Class Section) Person name: String address: String changeAddress(new_address)
  • 26. Coming up: Class Diagrams Exercise – Simple Associations  From an analysis perspective: – Identify meaningful associations and generalization/specializations among classes in the Elevator System
  • 27. Coming up: Class Diagrams Class Diagrams  Class Diagrams describe – the types of objects in a system – their properties (attributes and operations) – relationships between objects  They can also include – Grouping concepts like packages – Constraints – Various kinds of annotations
  • 28. Coming up: Multiplicity Constraints Multiplicity Constraints Student Class Section Course Semester Instructor Department takes> is registered for> teaches> sponsors> <works for is instance of> i s h e l d d u r i n g > 1..* 1 1..* 1..* 1 1 1..* 0..8 0..* 0..6 1..3
  • 29. Questions  From the previous diagram – How many classes can a student take? – Do you have to be registered in any classes to be a student? – Do I need to teach this class to be an Instructor? Do I need to teach ANY classes?
  • 30. Coming up: Dependencies Multiplicity Constraints  A multiplicity constraint can be – a single number – a “*”, meaning an arbitrarily large number or simply “many” – a range, denoted by “min..max” – a sequence of single numbers and ranges
  • 31. Coming up: Dependencies Dependencies Relation A consolidated snippet of the UML Meta-model Association Generalization Dependency Aggregation Binary Association N-ary Association
  • 32. Coming up: Dependencies Dependencies  A dependency is a type of relationship  It says that one modeling component “uses” another.  If the later changes then, the former may have to change as well Student add(Course) drop(Course) Prerequisite
  • 33. Coming up: Dependencies Dependencies  Meaning from three perspectives – Analysis: physical or logical dependency between the connected classes – Specification: a “uses” relationship at an interface level – Implementation: a “uses” relationship at an implementation level. Just think: uses!
  • 34. Coming up: Aggregations (is part of) Dependencies  Syntax: – a dashed link with an straight-line arrowhead point to a component on which there is a dependency  Dependencies can be defined among: classes, notes, packages, and other types of components  Can dependencies go both ways?  Any problems with having lots of dependencies?
  • 35. Coming up: Aggregation Aggregations (is part of) Relation A consolidated snippet of the UML Meta-model Association Generalization Dependency Aggregation Binary Association N-ary Association
  • 36. Coming up: Composition (very similar to aggregation) Aggregation  Aggregation: is a special kind of association that means “part of”  Aggregations should focus on single type of composition (physical, organization, etc.) 1 1 * 4..* 1 1 1 1 1..3 1 0..9 1 Pizza Order Slice Crust Sauce Serving Cheese Serving Topping Serving
  • 37. Coming up: Using a class diagram Composition (very similar to aggregation)  Think of composition as a stronger form of aggregation. Composition means something is a part of the whole, but cannot survive on it’s own. Building Room
  • 38. Lets look at BookstoreExample4.jpg  Does John McCain (who has 7 houses) have a problem using this system?  If Barack Obama decides to create a Federal sales tax, how would we change the system?  Why is there a display method in Item, Book, MusicCD and Software?  An ItemOrder is part of how many Orders?  Can you explain how a search works using this diagram?
  • 39. Class Exercise  Lets create the WeGrow class diagram
  • 40. Coming up: Questions Validating a class diagram  One of the most important, and often overlooked issues is how to validate a class diagram. (Usually best for an diagram at the implementation perspective)  Given a specification or a use-case, can you look at the class diagram and use attributes and methods to “execute” a use case?  Lets try it for the WeGrow class diagram
  • 41. Coming up: More Questions Questions  What’s the difference between an attribute and an association with another class? For example, should “grade” be an attribute or a link to another class called “Grade”?  When during the software engineering life cycle should you build classes diagrams?
  • 42. Coming up: More Questions More Questions  How do you know when a class diagram is complete?  How can you manage change control on all the class diagrams for project?  What do you do with class diagrams after a system has been built and delivered?
  • 43. Bonus Slide!  If you’re interested in Auto-generating UML, Netbeans has an option to do it. – Install the UML plugin – Right-click on a project – Choose “Reverse Engineer” – Go to the new UML project – Select a package and choose to generate a new UML diagram

Editor's Notes

  • #1: Additional information: http://www.rational.com/uml/resources.html
  • #10: Class ended here – 9/2/2008
  • #26: Navigation provides information that helps optimize a design.
  • #27: The names of n-ary associations should contain the names of all the classes, e.g. “Advisor advises Student in Major”.
  • #29: The notations of sub-typing, interface inheritance, type capability, and substitutability are closely related, but are distinct ideas. Their subtle differences probably go beyond the scope of this course.
  • #44: This is in the examples subdirectory
  • #45: Class ended here 9/4/2008
  • #47: Ended here on 2/6/08