Tải bản đầy đủ (.pdf) (52 trang)

Software design: Lecture 21 - Sheraz Pervaiz

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (740.51 KB, 52 trang )

1

Software Design

Lecture : 21


2

Problem Statement ­ 1


3

Ø

Ø

Suppose that you're writing a document in some 
of  famous  text  processing  tools,  like  Microsoft 
Word  for  example.  You  can  start  typing  a  new 
document,  or  open  an  existing  one.  You  type  a 
text by using your keyboard. 

Every  document  consists  of  several  pages,  and 
every  page  consists  of  header,  document's  body 
or/and footer. In header and footer you may add 
date, time, page number, file location e.t.c.


4



Step­1 : Extracting Candidate 
Classes
document,  text  processing  tool,  MicrosoftWord,  text, 
keyboard,  header,  footer,  document's  body,  date,  time, 
page  number,  location  of  file,  page,  sentence,  word, 
punctual  sign,  letter,  number,  special  character,  picture, 
table, row, column, cell, user
Ø

Keywords  in  Grey  are  candidate  attributes  ,  rest  are 


5

Document Class
A  document  will  be  the  central  class  in  our  class 
diagram. Document has a several pages, therefore a 
numberOfPages  will  be  one  of  the  attributes  for 
the  Document  class.  For  the  operations  we  have: 
open(), save(), print() and new(). Every document 
consists of pages. The Page will be also a candidate 
for the class.


6

Structure of Document class



7

Page Class
Ø

The  Page  class  will  hold  pageNumber  as  an 
attribute,  and  operations  allowed  here  can  be: 
newPage(),  hideHeader()  and  hideFooter(). 
Operations for the header and footer tells us that 
the  Header  and  The  Footer  can  be  also  a 
classes.


8

Structure of Page Class


9

Header and Footer Classes


The Header class and the Footer class has common 
attributes: 

Ø

date,  time,  pageNumber  and  fileLocation.  These 
attributes are optional for every header or footer and 

user  may  configure  them.  This  will  guide  us  that  a 
common class can be introduced. This will be a good 
time to make an inheritance. 


10

Structure of BottomUp Class


11

Analysis of Document
Ø

Document's  text  is  made  up  of  sentences. 
Sentences  are  made  up  of  words  and  words  are 
made  up  of  characters.  If  words  are  array  of 
characters and sentence is array of words, then a 
sentence is also an array of characters. Therefore 
a document's body can be an array of characters. 
For this purpose to make a document's text we'll 


12

Character Class with SubClasses


13


Table Class
Ø

The  Table  class  has  numbRows  and  numbColumns  as 
attributes and newRow(), newColumn() and newTable() 
as  operations.  Every  table  consists  of  one  or  more  cells. 
And in every cell, text or pictures can be placed.


14

Proposed Solution


15


16

Problem Statement ­ 2


17

Ø

Ø

Ø


Ø

We need to design a system to handle the world 
cup where there are multiple teams and each 
team is having 11 players.
Each team represents a country of its belonging.
Countries qualify from zone, where each zone is 
having one or more countries in it.
Each team is given a number of games in a 
specific city.


18

Proposed Solution


19


20

Solution to Problem Writing


21


22


Categories of UML Diagrams (3)
Ø

Ø

Static
ü

Use case diagram

ü

Class diagram

Dynamic

ü

Activity diagram


23

Ø

Implementation

ü


Component diagram

ü

Deployment diagram


24

Introduction to Activity Diagram
Ø

In many ways UML Activity diagrams are the object­
oriented equivalent of flow charts and data­flow 
diagrams (DFDs).  They are used to explore the logic of:

Ø

A complex operation

Ø

A complex business rule

Ø

A single use case

Ø


Several use cases

Ø

A business process 


25

Activity Diagram – Dynamic 
Category
Ø

It shows the flow from activity to activity within 
a single process.

Ø

With an activity diagram, you can also model the 
flow of an object as it moves from state to state

    at different points in the flow of control


×