0% found this document useful (0 votes)
62 views

Unit 4 Requirement Analysis and Specification

The document discusses class diagrams and their elements. Class diagrams are used to model object-oriented systems by describing classes and relationships between them. The key elements of a class diagram include the class name, attributes, operations, and relationships like generalization and specialization. Class diagrams provide an overview of the system by representing classes, attributes, operations, and their relationships.

Uploaded by

Anonymous Dev
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
62 views

Unit 4 Requirement Analysis and Specification

The document discusses class diagrams and their elements. Class diagrams are used to model object-oriented systems by describing classes and relationships between them. The key elements of a class diagram include the class name, attributes, operations, and relationships like generalization and specialization. Class diagrams provide an overview of the system by representing classes, attributes, operations, and their relationships.

Uploaded by

Anonymous Dev
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 17

Software Engineering (3150711)

Unit 4
Requirement analysis and
Specification
Analysis Models Part 1
 Class Diagram

Dr. Pradyumansinh U. Jadeja


Computer Engineering Department
Darshan Institute of Engineering & Technology, Rajkot
[email protected]
+91-9879461848
Class diagram
The purpose of class modeling is to describe objects in systems and different types of
relationships between them.

The class diagram is used to construct and visualize object-oriented systems.


 Class modeling is used to specify the structure of the objects, classes, or components that
exist in the problem domain or system.
 Class diagram provides a graphic notation for modeling classes and their relationships.
 Class is a blueprint of an object.
 An object is a concept, abstraction, or thing with an identity that has meaning for an
application.
 Class diagrams represent an overview of the system like classes, attributes, operations, and
relationships.

#3150711 (SE)  Unit 1 – Introduction to Software & Software


Prof. Pradyumansinh U. Jadeja 2
Elements of Class Diagram (Class Name)
 The name of the class appears in the upper section.
 Class name should be meaningful.
 Class name should always be aligned center of the upper section.
Class Name  Class name should start with capital letters, and intermediate letter is
a capital.
Attributes
 Class name should be always bold format.
Operations  For e.g.:
Account Customer Employee

 Abstract class name should be written in italic format.

#3150711 (SE)  Unit 1 – Introduction to Software & Software


Prof. Pradyumansinh U. Jadeja 3
Elements of Class Diagram (Class Name) Cont.
 For e.g. in the banking system, there are two types of accounts; one is a saving account and
another is a current account.
 Account is an abstract class and saving account and the current account is a subclass of
Account.
 The system can’t directly access the Account class. It is accessible by only saving accounts
and current accounts. Abstract class
Account italic font

Normal class
SavingAccount CurrentAccount non italic font

#3150711 (SE)  Unit 1 – Introduction to Software & Software


Prof. Pradyumansinh U. Jadeja 4
Elements of Class Diagram (Attributes)
 An attribute is a named property of a class that describes a value
held by each object of the class.
 The UML notation lists attributes in the second compartment of the
Class Name
class box.
Attributes  The attribute name should be in the regular face, left align in the box
& use the lowercase letters for the first character.
Operations
 The data type for the attribute should be written after the colon.
 Accessibility of attribute must be defined using a member access
modifier.
 Syntax : accessModifier attributeName:dataType=defaultValue
 For e.g. in this example ‘–’ represents private access modifier
Account Customer Employee
- accountNumber:long - customerName:String - employeeName:String

#3150711 (SE)  Unit 1 – Introduction to Software & Software


Prof. Pradyumansinh U. Jadeja 5
Elements of Class Diagram (Access Modifiers)
 Public (+): Member accessible by all classes, whether these classes are in the same package or
in another package.
 Private (-): Member cannot be accessed outside the enclosing/declaring class.
 Protected (#): Member can be accessed only by subclasses and within a class.
 Package (~): Member can be accessible by all classes, within the package. Outside package
member not accessible.
 Static (underlined) : Member can be accessed using class name only. SavingAccount
 In example you can see how to use access specifier + accountNumber:long
+ name:String
# dob: Date
~ panNumber:String

#3150711 (SE)  Unit 1 – Introduction to Software & Software


Prof. Pradyumansinh U. Jadeja 6
Elements of Class Diagram (Operation)
 The operation is a function or procedure that may be applied to objects
Class Name in a class.
 The UML notation is to list operations in the third compartment of the
Attributes
class box.
Operations  The operation name in the regular face, left align the name in the box,
and use a lowercase letter for the first character.
 Optional detail, such as an argument list and result type, may follow
each operation name.
 The return type of method should be written after colon.
 Accessibility of operation must be defined using a member access
modifier.
 Syntax : accessModifier methodName(argumentList):returnType
For e.g.: you can see change phone number is a Account
method that accepts phone number as an argument
and return the int value as a response. + changePhoneNumber(phoneNumber:String):int
#3150711 (SE)  Unit 1 – Introduction to Software & Software
Prof. Pradyumansinh U. Jadeja 7
Generalization & Specialization
 Generalization is the process of Vehical
extracting shared characteristics from + no of wheels:int
two or more classes and combining them +start() : void
into a generalized superclass +stop() : void
 Shared characteristics can be attributes +applyBreak() : void

Specialization
+refilllFule() : int

Generalization
or methods.
 Represents an "is-a" relationship
 For example, a car is a vehicle and a truck
is a vehicle. In this case, vehicle is the
general thing, whereas car and truck are Car Truck
the more specific things.
 Specialization is the reverse process of +parkAtHome() : void + loadGoods() : void
Generalization means creating new sub- + unloadGoods() : void
classes from an existing class.

#3150711 (SE)  Unit 1 – Introduction to Software & Software


Prof. Pradyumansinh U. Jadeja 8
Generalization & Specialization
 For example in a bank, any
Customer opens an account. Account
 The account can be either a + accountNo:long
+ balance:double
savings account or a current +debitAmount(amount:double): void
account. In saving account, +creditAmount(amount:double) : int
+getBalance(accountNo:long) : double
customer earns fixed interest on
the deposit. But this facility is
not available in the current
account. SavingAccount CurrentAccount
+ interestRate:double
+ isTransactionLimitOut(accountNo:long) : int

#3150711 (SE)  Unit 1 – Introduction to Software & Software


Prof. Pradyumansinh U. Jadeja 9
Link and Association Concepts
 Link and associations are the means for establishing relationships among objects and classes.
 A link is a physical or conceptual connection among objects.
 An association is a description of a group of links with common structure and common semantic
& it is optional.
 Aggregation and Composition are the two forms of association. It is a subset of association.
 Means they are specific cases of association. In both aggregation and composition object of
one class "owns" object of another class, but there is a minor difference.

#3150711 (SE)  Unit 1 – Introduction to Software & Software


Prof. Pradyumansinh U. Jadeja 10
Aggregation
Aggregation is a subset of association. it is a collection of different things.
It is more specific than an association.
It represents ‘has a’ relationship.
Aggregation implies a relationship where the child is independent of its parent.
 For e.g.: Here we are considering a car and a
wheel example. A car cannot move without a
wheel.
Car Wheel
 But the wheel can be independently used with
the bike, scooter, cycle, or any other vehicle.
 The wheel object can exist without the car
object, which proves to be an aggregation
relationship.

#3150711 (SE)  Unit 1 – Introduction to Software & Software


Prof. Pradyumansinh U. Jadeja 11
Composition

The composition is a part of the aggregation. It represents the dependency between a parent
and its children, which means if the parent is discarded then its children will also discard.

It represents ‘part-of’ relationship.


In composition, both the entities are dependent on each other.

 For e.g.: Person class with Brain class, Heart Person


class, and Legs class.
 If the person is destroyed, the brain, heart, and
legs will also get discarded.

Brain Heart Legs

#3150711 (SE)  Unit 1 – Introduction to Software & Software


Prof. Pradyumansinh U. Jadeja 12
Multiplicity
 Multiplicity is the specification of the number of instances of one class that may be related to
the instance of another class.
 Multiplicity constrains the number of a related object.
 You can use multiple associations between objects.
 Some typical type of multiplicity:
Multiplicity Option Cardinality
0..1 No instances or one instance
1..1 1 Exactly one instance
0..* * Zero or more instances

1..* At least one instance


5..5 5 Exactly 5 instances

m..n At least m but no more than n instances

#3150711 (SE)  Unit 1 – Introduction to Software & Software


Prof. Pradyumansinh U. Jadeja 13
Example Of Multiplicity
One to One Association
has
Account Holder 1 1
Cheque Book One account holder has one cheque book

Many to Zero or One Association


issue
Account Holder Debit Card An account holder can issue at most one debit card.
* 0..1

Many to Many Association


withdraw
Account Holder * *
ATM Every account holder can withdraw money from all ATMs.

One to One or Many Association


have
Bank 1 1..*
Branch The bank should have at least one branch.

#3150711 (SE)  Unit 1 – Introduction to Software & Software


Prof. Pradyumansinh U. Jadeja 14
Class Diagram Of Bank Management System
*
Bank
- name : string *
- code: string ha
ve
+manageBranch();
ve
ha

Account
* 1..*
ATM Branch
- location : string manage - branchName : string 1 have 1..* ~ accountNumber: string
- manageBy: string * * - branchCode: string - balance: number
+transaction(); + manageAccount():void +debitAmount(amount:double): void
+ transaction():init 1..2 +creditAmount(amount:double) : int
*
* +getBalance(accountNo:long) : double

e
ag
tra

ve

an
ns

ha
m
ac
tio

*
n

Customer
- name: string 1 CurrentAccount SavingAccount
- address: string
*
- dob: date - interestRate:double
- panNumber: string + isTransactionLimitOut(accountNo:long) : int
+ manageAccount():void
+ transaction():init

#3150711 (SE)  Unit 1 – Introduction to Software & Software


Prof. Pradyumansinh U. Jadeja 15
Class Diagram Of Library Management System
Librarian 1 manage Member
- name:string workFor *
~ mName: string
- contactNo: number 1
membership - mContact: number
+ addLibrarian():void 1 * - mType: string
* - mNoOfBookIssued: int
+ updateInfo():int Library
+ removeLibrarian(id:int):int - id:int
+ login(uname:string,pass:string):int + addMember():void
- name:string + udateMember():int
1
request + issueBook(bookID:int):void
1 1 + returnBook(bookID:int):void
Book have
manage

1…* + registration():void
- authorName:string + authentication(mID:int):int
- publisherName:String Material 0…3
- materialID:int
*
QestionPaper + addMaterial():void
- subject:string + updateMaterial():int
+ removeMaterial(bookID:int):int Student
- examName:String Staff
+ issueMaterial(bookID:int):void
- name:string - enrNo:int
+ returnMaterial(bookID:int):void
- name:string
CD/DVD + payFine():int
- type:string
- topic:String

#3150711 (SE)  Unit 1 – Introduction to Software & Software


Prof. Pradyumansinh U. Jadeja 16
Software Engineering (3150711)

Thank
You

Dr. Pradyumansinh U. Jadeja


Computer Engineering Department
Darshan Institute of Engineering & Technology, Rajkot
[email protected]
91-9879461848

You might also like