0% found this document useful (0 votes)
55 views45 pages

SAD - Ch11 - Case Study

This document discusses a case study to demonstrate system analysis and design using UML. It describes a dice game problem where a player rolls two dice 10 times to try and get a total of 7, earning 10 points for each roll of 7. The case study then walks through modeling the requirements, analysis using UML diagrams, and design of the system. Key activities include creating use case diagrams, activity diagrams, class diagrams, sequence diagrams, and defining the system architecture. The goal is to analyze and design the dice game system to track scores and display results.

Uploaded by

LÊ HỮU ĐẠT
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
55 views45 pages

SAD - Ch11 - Case Study

This document discusses a case study to demonstrate system analysis and design using UML. It describes a dice game problem where a player rolls two dice 10 times to try and get a total of 7, earning 10 points for each roll of 7. The case study then walks through modeling the requirements, analysis using UML diagrams, and design of the system. Key activities include creating use case diagrams, activity diagrams, class diagrams, sequence diagrams, and defining the system architecture. The goal is to analyze and design the dice game system to track scores and display results.

Uploaded by

LÊ HỮU ĐẠT
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 45

System analysis and design

SYSTEM ANALYSIS AND DESIGN


• Nguyen Thanh Binh, Nguyen Quang Vu, Le Viet Truong,
Nguyen Thi Hanh, Vo Van Luong, Le Thi Bich Tra
• Faculty of Computer Science

1
System analysis and design

•Chapter 11

Case study

2
System analysis and design

Case study
• Problem
• A very simple problem to show the use of UML in analysis and design
• It is taken from the “Applying UML and Patterns” book of Claig Larman

• A dice game
• The player rolls 10 times 2 dice. If the total of two dice is 7, he gains 10 points. At the end of the game, the
score is saved to the scoreboard

3
System analysis and design

Main Activities of Software Development


Requirements Gathering Analysis Design

Define requirement Define the conceptual Design the solution /


specification model software plan

Implementation Integration and Test


Deployment
Code the system based on Prove that the system meets
Installation and training
the design the requirements

Maintenance

Post-install review
Support docs
Active support

4
System analysis and design

Case study

• Requirement analysis
• Use-case diagram

• Use-case: Play
• Description: The player rolls 2 dice 10 times. If each time the total is 7, he receives 10 points.

• Use-case: View High Score


• Description: They player consults the scores

5
System analysis and design

Case study
• Requirement analysis
• Activity diagram
• Some activities are linked to the graphical user interface

[view ] [play ] [exit ]

View High Score Play

Roll dice

[true ]

Turn < 10 [false ]

Update High Score

6
System analysis and design

Use-case
• Requirement analysis
• Activity diagram
• The relationship between the use-case diagram and activity diagram

7
System analysis and design

Main Activities of Software Development


Requirements Gathering Analysis Design

Define requirement Define the conceptual Design the solution /


specification model software plan

Implementation Integration and Test


Deployment
Code the system based on Prove that the system meets
Installation and training
the design the requirements

Maintenance

Post-install review
Support docs
Active support

8
System analysis and design

Case study

• Analysis
• Modelling the real world
• Independent of the implementation
• Modelling of the domain: conceptual class diagram
• Modelling of the dynamic behaviour of the system: collaboration diagram

9
System analysis and design

Case study
• Modeling of conceptual class diagram

10
System analysis and design

Case study

• A first communication diagram

11
System analysis and design

Case study
• A first class diagram

12
System analysis and design

Case study
• Collaboration diagram and class diagram

13
System analysis and design

Case study
• Sequence diagram

14
System analysis and design

Case study

• The creation of objects at the beginning of the game (DiceGame) for a player

15
System analysis and design

Case study
• State diagram: modelling the states of the DiceGame

16
System analysis and design

Case study
• Detection of inconsistency between the activity diagram and the state diagram

17
System analysis and design

Case study
• Modification of the activity diagram as well as the envisaged graphical user interface

18
System analysis and design

Case study
• The treatment of the scoreboard must be taken into account: the update and the creation

No treatment

19
System analysis and design

Case study
• Sequence diagram: manage high score, create new player

20
System analysis and design

Case study

• Sequence diagram: add high score to score board

21
System analysis and design

Case study
• Class diagram

22
System analysis and design

Main Activities of Software Development


Requirements Gathering Analysis Design

Define requirement Define the conceptual Design the solution /


specification model software plan

Implementation Integration and Test


Deployment
Code the system based on Prove that the system meets
Installation and training
the design the requirements

Maintenance

Post-install review
Support docs
Active support

23
System analysis and design

Case study

• Design
• Take into account the implementation
• Manage the graphical user interface part
• Manage the persistence of scoreboard
• Define the logical architecture
• Define the physical architecture
• Introduce the technical class permitting to implement the architecture

24
System analysis and design

Case study
• General architecture
• Classical three layer architecture

Presentation

Business Logic

Persistence

25
System analysis and design

Case study
• A package diagram corresponds to the architecture

UI : presentation layer
Core : Business logic layer
DB : Persistence layer
Util : utility services/classes/functionalities

26
System analysis and design

Case study
• Use design patterns to improve the classes of “Core” package

Class DiceGame has only one object


Class HighScore has only one object

Design pattern : Singleton

27
System analysis and design

Case study
• Singleton design pattern
Singleton
static uniqueSingleton
other attributs … return uniqueSingleton;

static instance()
other operations …

• Application to DiceGame and HighScore.

28
System analysis and design

Case study
• Modified class diagram

29
System analysis and design

Case study
• Observer design pattern

Subject Observer
observer
attach(o Observer) update()
dettach(o Observer) for all o in observer
notify() o.update()

ConcreteSubject ConcreteObserver
subject
getState() update()
setState() observerState
return subjectState;
subjectState

observerState=
subject.getState()

30
System analysis and design

Case study

• Application of Observer design pattern to improve the class diagram


• Decouple the graphical views and objects for the dice and players
• Application of Observer pattern
• Die and Player classes are ConcreteSubject class
• Introduce DieView et PlayerView as ConcreteObserver classes

31
System analysis and design

Case study
• User view are instances of javax.swing.JPanel.java

Observable
-changed : bool = false «interface»
Observer
+ notifyObserrvers ()
+ addObserver () + update (o : Observable , arg : Object )()
+...()

JPanel
Player Die
-name -faceValue : int = 1
-score : int = 0 + rolls ()
+ play () + Die ()
+ Player () + display () DieView
+ display ()
+ DieView (die : Die )()
PlayerView + update (o : Observable , arg : Object )()

+ PlayerView (player : Player )()


+ update (o : Observable , arg : Object )()

32
System analysis and design

Case study

• Sequence diagram describes the interactions between Die object the its view

33
System analysis and design

Case study
• The design of “UI” package

34
System analysis and design

Case study
• The design of “Util” package

35
System analysis and design

Case study
• The design of “DB” package
• How to ensure the independence between “Core” and “DB” package
• In order to be able to use several persistence types
• File (serialisation)
• Relation Database Management System (via JDBC)

• Use FactoryMethod design pattern


Creator product = factoryMethod();
* 1 factoryMethod() …
Product
anOperation()

ConcreteProduct CreateCreator return new ConcreteProduct();


factoryMethod()
<<create>>

36
System analysis and design

Case study
• The design of “DB” package
• Class diagram
HighScore DBKit

- $ hs : HighScore = null - :
+ HighScore () + makeKit ()
+ getInstance () : HighScore
+ add ()
+ load ()
+ save ()

FileKit JDBCKit
HighScoreFile
HighScoreJDBC

+ makeKit () + makeKit ()
+ HighScoreFile ()
+ HighScoreJDBC ()
+ load ()
+ load ()
+ save ()
+ save ()

<< create >>

Note : HighScore class is a Singleton

37
System analysis and design

Case study
• The design of the “DB” package
• Sequence diagram

38
System analysis and design

Case study

• Deployment diagram

39
System analysis and design

Main Activities of Software Development


Requirements Gathering Analysis Design

Define requirement Define the conceptual Design the solution /


specification model software plan

Implementation Integration and Test


Deployment
Code the system based on Prove that the system meets
Installation and training
the design the requirements

Maintenance

Post-install review
Support docs
Active support

40
System analysis and design

Case study

• Complete the interaction diagrams


• Generate the code

41
System analysis and design

Conclusions
System analysis and design

Conclusions

• Distinction between functional approach and object-oriented approach


• Master the basic object-oriented concepts

• UML: a modelling language


• Need a development process
• Different views
• Different models
• Use of the models in different development activities

• Master the main diagrams


• Use-case diagram
• Class diagram
• Interaction diagram

43
System analysis and design

Conclusions

• The UML concepts can be extended


• The extensions

• Transformation of models to code


• Models independent of programming language

• The automatic code generation is only a supplement


• The models guide the coding process

• Master design principles


• GRAPS principles/patterns
• Some design patterns

44
System analysis and design

Conclusions

• The UML concepts can be extended


• The extensions

• Transformation of models to code


• Models independent of programming language

• The automatic code generation is only a supplement


• The models guide the coding process

• Master design principles


• GRAPS principles/patterns
• Some design patterns

45

You might also like