Download presentation
Presentation is loading. Please wait.
1
Information System Design
Lab 3
2
Lab Objectives Class diagram element of class diagram.
class relationships. How to create class diagram.
3
Class Diagram Class diagrams are widely used to describe the types of objects in a system and their relationships. Classes have attributes (member variables), operations (member methods) and relationships with other classes. You usually apply class modeling during analysis and design activities
4
List of attributes (variables) List of operations (methods)
Elements of a Class Diagram Class A class represents an entity of a given system . A class is represented by a rectangle. Classes are composed of three things: name. attributes(variables). operations (methods). Class name List of attributes (variables) List of operations (methods)
5
Elements of a Class Diagram (cont..)
Class name The class name typically has the first alphabet capitalized . If the class has more than one words then capitalize the first alphabet of both words and join the two (e.g. CourseAdmin).
6
Elements of a Class Diagram (cont..)
List of attributes : visibility attributeName : type[=default value ] it indicates whether the attribute is accessible from outside the class. It may be one of the following: + public visibility(everyone) # protected visibility (friends and derived) - Private visibility (no one) Visibility Is the name of the attribute you are describing. attributeName It indicates the type of data an attribute may hold. Type It indicates the initial value of an attribute. Default Value
7
name : type [= default value]
Elements of a Class Diagram (cont..) List of operations: visibility operationName(parameter _list ):return type Parameter_list Each parameter is shown as a text string having the following syntax: name : type [= default value]
8
Class Relationships Associations
When two classes are connected to each other in any way, an association relation is established. Represent relationship between instances of classes for example Courses have students Courses have exams You can add several kinds of details, to an association. These details include the following: Association name. Multiplicity .
9
Class Relationships Association name. Multiplicity
an Association name is used To clarify its meaning. The association name is represented as a label placed midway along the association line. Usually a verb or a verb phrase. Multiplicity The multiplicity of an association specifies how many instances of one class may relate to instance of another class.
10
Class Relationships Multiplicity Notation Meaning Symbol
One and only one(exactly one) 1 Zero or one 0..1 From M to N M..N From zero to any positive integer * 0..* From one to any positive integer 1..*
11
Multiplicity 1 teach 1..* Teacher Student One-to-one or many 1 holds
6,12 EggBox Egg One-to-6 or 12 1 has 3 Tricycle Wheel One-to-3 1 Married to 1 Husband Wife One-to-one
12
Examples Work on 1 1..* 1 1..* manage enroll 1 1..4
13
Class Relationships Aggregation
An aggregation is a special kind of association—a “whole/part” relationship within which one or more classes are parts of a larger whole. It is also called a "has a" relationship. An aggregation appears as a line with an open diamond at one end. The class next to the diamond is the whole class; the class at the other end of the line is the part class. whole part
14
Example company Employee
15
Class Relationships Composition
Composition is a “strong” form of aggregation. It is a whole-part relationship between a composite (the whole) and its parts, in which the parts must belong only to one whole and the whole is responsible for creating and destroying its parts when it created or destroyed. Composition is shown using a filled diamond attached to the class that represents the whole. whole part
16
Example House Room Book Page
17
Class Relationships Generalization
Generalization refers to a relationship between a general class (the superclass or parent) and a more specific version of that class (the subclass or child). Also called an "is a" relationship, because the child class is a type of the parent class. The inheritance relationship in UML is depicted by a peculiar triangular arrowhead. This arrowhead points to the base class.
18
Example C# C++ java Programming language
19
How To Create Class Diagram?
Identify classes Identify the “Active” Entity in system . Identify the “passive” Entity in system . Identify attributes and operation for each class. Identify relationship between classes Identify relationship between “Active” Entities. Identify relationship between “passive” business Entities. Identify relationship between “passive” and “active” Entities.
20
Example : Student Grades Management system
the system allow the teacher to record the students grades and view them. Our students can view their grades and the printing administrator can create report cards so , he must view the grades also . Finally teacher can distribute the report cards by the system.
21
Identify classes :. Identify the “Active” Entity in system .
1) Teacher. 2) Student )Printing Administrator. Identify the “passive” Entity in system . 4) Grade ) Report Card. Identify attributes and operation for each class.
22
Identify the “Active” Entity in system .
Operations Attributes Class Name RecordGrade() ViewGrade() DistributeReportCard() ModifyGrade() DeleteGrade() ViewAllGrade() ViewStudentInfo () ViewAllStudentInfo() name passward course grade* student* reportCard* Teacher ID Student CreateReportCard() ModifyReportCard() DeleteReportCard() ViewReportCard() FormatReportCard() PrintingAdmin
23
Operations Attributes Class Name
Identify the “passive” Entity in system . Operations Attributes Class Name RecordGrade() ViewGrade() ModifyGrade() DeleteGrade() ViewAllGrade() Course grade student* Grade CreateReportCard() ModifyReportCard() DeleteReportCard() ( ViewReportCard( DistributeReportCard() FormatReportCard() grade* dimension border font color row column picture backGround ReportCard
24
Identify relationship between classes:.
Identify relationship between “Active” Entities. 6) User Operations Attributes Class Name Authentication() name password User
25
Identify relationship between “passive” business Entities.
26
Teacher PrintingAdmin Student ReportCard Grade User
Identify relationship between “passive” and “active” Entities. Teacher PrintingAdmin Student ReportCard Grade User 1..* View Manage Distribute 1 *
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.