Systems Analysis and Design with UML Version 2.0, Second Edition

  Syst e m s An a lysis a n d Syst e m s An a lysis a n d D e sign w it h UM L V e r sion D e sign w it h UM L V e r sion D e sign w it h UM L V e r sion D e sign w it h UM L V e r sion 2 .0 , Se con d Edit ion 2 .0 , Se con d Edit ion

  Alan Dennis, Barbara Haley Wixom , and David Tegarden a d ega de Ch a pt e r 7 : St r u ct u r a l M ode lin g John Wiley & Sons, I nc.

  Copyright 2005 Copyright 2005 Copyright © 2005 John Wiley & Sons, I nc. J h Wil & S

All right s reserved. Reproduct ion or t ranslat ion of t his All right s reserved. Reproduct ion or t ranslat ion of t his

  I p perm ission of t he copyright owner is unlawful. py g Unit ed St at es Copyright Act wit hout t he express writ t en

work beyond t hat perm it t ed in Sect ion 117 of t he 1976

t he Perm issions Depart m ent , John Wiley & Sons, I nc.

Request for furt her inform at ion should be addressed t o

use only and not for redist ribut ion or resale. The purchaser m ay m ake back up copies for his/ her own The purchaser m ay m ake back- up copies for his/ her own

program s or from t he use of t he inform at ion cont ained

om issions, or dam ages, caused by t he use of t hese om issions, or dam ages, caused by t he use of t hese The Publisher assum es no responsibilit y for errors, herein.

  g n li e d o M l a r

  7

Ke y I de a s K I d

  A st ruct ural or concept ual m odel A st ruct ural or concept ual m odel describes t he st ruct ure of t he dat a t hat support s t he business t hat support s t he business processes in an organizat ion..

  The st ruct ure of dat a used in t he Th t t f d t d i t h syst em is represent ed t hrough CRD

  

cards d , class diagram s l di , and d obj ect bj t

diagram s .

  S L E D O M L A R U T

Pu r pose of St r u ct u r a l M ode ls M d l

  Reduce t he sem ant ic gap bet w een Reduce t he “ sem ant ic gap” bet w een t he real world and t he world of soft ware soft ware Creat e a vocabulary for analyst s and users d Represent t hings, ideas, and concept s of im port ance in t he applicat ion dom ain

Cla sse s Cl

  

Tem plat es for creat ing inst ances or Tem plat es for creat ing inst ances or

obj ect s Concret e Concret e Abst ract

  Typical exam ples: yp p Applicat ion dom ain, user int erface, dat a st ruct ure, file st ruct ure, operat ing environm ent , docum ent , and m ult im edia i t d t d lt i di classes

At t r ibu t e s At t ib t

  Unit s of inform at ion relevant t o Unit s of inform at ion relevant t o t he descript ion of t he class Only at t ribut es im port ant t o t he t ask should be included t ask should be included

Ope r a t ion s O t i

  Act ion t hat inst ances/ obj ect s Act ion t hat inst ances/ obj ect s can t ake Focus on relevant problem - specific operat ions ( at t his specific operat ions ( at t his point )

R l t i h i Re la t ion sh ips

  Generalizat ion Generalizat ion

  Enables inherit ance of at t ribut es and operat ions

  Aggregat ion gg g

  Relat es part s t o w holes

  A o i t ion Associat ion

  Miscellaneous relat ionships bet w een classes

You r Tu r n Y T

  What classes, at t ribut es, and What classes at t ribut es and operat ions t hat would be required t o describe t he process of t o describe t he process of regist rat ion for cam pus housing?

  • - S Y Y T T D

  I I R L L A

  I I B B C

  I I N S S O N N

  I O O T P P A S S R E E O R

  Re spon sibilit ie s a n d Colla bor a t ion s C ll b i

  Responsibilit ies Responsibilit ies

  Knowing Doing

  Collaborat ion Collaborat ion

  Obj ect s working t oget her t o service a request service a request

  d d r r

  d d r a C C C C R R C C

  S M A R G A

  I D

  m a r g i ia D D s s l la C C

Cla ss D ia gr a m Syn t a x Cla ss D ia gr a m Syn t a x

  A CLASS Cl 1 A CLASS Class 1 -attribute AN ATTRI BUTE + operation () Attribute name/ AN ATTRI BUTE AN OPERATI ON derived attribute name operation name () AN ASSOCI ATI ON 1..* 0..1 operation name () ______verb phrase____

M or e on At t r ibu t e s M At t ib t

  Derived at t ribut es Derived at t ribut es

  / age, for exam ple can be calculat ed from birt h dat e and current dat e

  Visibilit y

  Public Public Prot ect ed Privat e P i

M O t i M or e on Ope r a t ion s

  Const ruct or Const ruct or

  Creat es obj ect

  Query

  Makes inform at ion about st at e Makes inform at ion about st at e available

  Upd t e Updat e

  Changes values of som e or all at t ribut es

  Ge n e r a liz a t ion a n d A i Aggr e ga t ion Generalizat ion show s t hat a Generalizat ion show s t hat a subclass inherit s from a superclass

  Do t o n e dm in pe onnel e Doct ors, nurses, adm in personnel are kinds of em ployees

  Aggregat ion classes com prise ot her Aggregat ion classes com prise ot her classes

  H l h l i d f d Healt h t eam class com prised of doct or, nurses, adm in personnel classes

M R l t i h i M or e on Re la t ion sh ips

  Class can be relat ed t o it self Class can be relat ed t o it self ( role) Mult iplicit y

  Exact ly one zero or m ore one or Exact ly one, zero or m ore, one or m ore, zero or one, specified range m ult iple disj oint ranges range, m ult iple disj oint ranges

  Associat ion class

Sim plifyin g Cla ss D ia gr a m s D i

  

The view m echanism show s a The view m echanism show s a

subset of inform at ion Packages show aggregat ions of classes ( or any elem ent s in classes ( or any elem ent s in UML)

  s m a r g i ia

  S S S M D D A R R R A A G C C A C C

  I R R D C C S G G S N N A

  I I L

Obj e ct I de n t ifica t ion Obj e ct I de n t ifica t ion

  Text ual analysis of use- case Text ual analysis of use case inform at ion N Nouns suggest classes t l Verbs suggest operat ions

  Creat es a rough first cut Com m on obj ect list Com m on obj ect list I ncident s Roles R l

Pa t t e r n s Pa t t e r n s

  Useful groupings of classes t hat Useful groupings of classes t hat recur in various sit uat ions Transact ions T t i

  Transact ion class Transact ion line it em class I t em class I t em class Locat ion class

  Part icipant class P t i i t l

  St e ps for Obj e ct I de n t ifica t ion a n d St r u ct u r a l M ode lin g d S l d li

2. Brainstorm additional candidate classes, attributes, operations, and

1

  1. Create CRC cards by performing textual analysis on the use-cases. C t CRC d b f i t t l l i th 3. Role-play each use-case using the CRC cards. relationships by using the common object list approach. p y g j pp

5. Review the structural model for missing and/ or unnecessary classes,

4. Create the class diagram based on the CRC cards.

  4 Create the class diagram based on the CRC cards 6. I ncorporate useful patterns. attributes, operations, and relationships. 7. Review the structural model.

  7 Review the structural model

  Creat e CRC cards. Creat e CRC cards

Exam ine com m on obj ect list s.

  Role- play t he CRC cards.

  Creat e t he class diagram . Creat e t he class diagram Review t he class diagram . g I ncorporat e pat t erns.

  Review t he m odel. Re ie t he m odel

Su m m a r y S

  CRC cards CRC cards capt ure t he essent ial elem ent s capt ure t he essent ial elem ent s of a class.

  Class and obj ect diagram s Class and obj ect diagram s show t he show t he underlying st ruct ure of an obj ect - orient ed syst em . y

Const ruct ing t he st ruct ural m odel is an

it erat ive process involving: t ext ual analysis, brainst orm ing obj ect s, role playing, creat ing t he diagram s , and incorporat ing useful pat t erns. i t i f l t t

Ex pa n din g t h e D om a in E di t h D i

  A quirky and int erest ing t ut orial A quirky and int erest ing t ut orial regarding CRC cards can be found at : f d

ht t p: / / w w w .csc.calpoly.edu/ ht t p: / / w w w .csc.calpoly.edu/ ~ d d

but ler/ t ut orials/ w int er96/ crc_b/

  EOC Qu e st ion Ch a pt e r 7 EOC Q t i Ch t 1 . D e scr ibe t o a bu sin e sspe r son t h e m u lt iplicit y of a p p y

   7 3 . 2 .

W h y a r e a ssu m pt ion s im por t a n t t o a st r u ct u r e l m ode l?

r e la t ion sh ip be t w e e n t w o cla sse s. 4 . W h a t is a n a ssocia t ion cla ss? Con t r a st t h e follow in g se t s of t e r m s: Pr ope r t y;M e t h od;At t r ibu t e Obj e ct ; Cla ss; I n st a n ce Con cr e t e Cla ss;Abst r a ct Cla ss Su pe r cla ss;Su bcla ss 5 . cla ss dia gr a m ?

on a cla ss dia gr a m . H ow w ou ld t h e y be de n ot e d on t h e

Give t h r e e e x a m ple s of de r ive d a t t r ibu t e s t h a t m a y e x ist p y

  EOC Qu e st ion Ch a pt e r 7 EOC Q t i Ch t 6 . W h a t a r e t h e diffe r e n t t ype s of visibilit y? H ow w ou ld t h e y yp y y

   7 7 . follow in g bu sin e ss r u le s. I n clu de t h e m u lt iplicit ie s for D r a w t h e r e la t ion sh ips t h a t a r e de scr ibe d by t h e be de n ot e d on a cla ss dia gr a m ? e a ch r e la t ion sh ip. h l i h i doct or ca n h a ve on e or m a n y pa t ie n t s. A pa t ie n t m u st be a ssign e d t o on ly on e doct or , a n d a

A m ovie t h e a t e r sh ow s a t le a st on e m ovie , a n d a m ovie

ph on e e x t e n sion is a ssign e d t o a n e m ploye e . An An e m ploye e h a s on e ph on e e x t e n sion , a n d a u n iqu e e m ploye e h a s on e ph on e e x t e n sion a n d a u n iqu e

A m ovie e it h e r h a s on e st a r , t w o co- st a r s, or m or e t h a n

t ow n .

ca n be sh ow n a t u p t o fou r ot h e r m ovie t h e a t e r s a r ou n d ca n be sh ow n a t u p t o fou r ot h e r m ovie t h e a t e r s a r ou n d

on e m ovie .

t e n pe ople st a r r in g t oge t h e r . A st a r m u st be in a t le a st

  EOC Qu e st ion Ch a pt e r 7 EOC Q t i Ch t 8 . H ow do you de sign a t e t h e r e a din g dir e ct ion of a y g g

   7 9 .

For w h a t pu r pose is a n a ssocia t ion cla ss u se d in a cla ss

dia gr a m ? Give a n e x a m ple of a n a ssocia t ion cla ss t h a t

r e la t ion sh ip on a cla ss dia gr a m ? 1 0 .

Give t w o e x a m ple s of a ggr e ga t ion , ge n e r a liz a t ion , a n d

a n d t h e cou r se s t h a t t h e y h a ve t a k e n . m a y be fou d in a cla ss dia gr a m t h a t ca pt u r e s st u de n t s b f d i l di h d de pict e d on a cla ss dia gr a m ? a ssocia t ion r e la t ion sh ips. H ow is e a ch t ype of a ssocia t ion a ssocia t ion r e la t ion sh ips H ow is e a ch t ype of a ssocia t ion

  EOC Qu e st ion Ch a pt e r 7 EOC Q t i Ch t 1 1 . I de n t ify t h e follow in g ope r a t ion s a s con st r u ct or , qu e r y, y g p

   7 , q y, C a lcu la t e e m ploye e r a ise ( r a ise pe r ce n t ) in t h e cla ss r e ct a n gle ? or u pda t e . W h ich ope r a t ion s w ou ld n ot n e e d t o be sh ow n I n cr e m e n t n u m be r of e m ploye e va ca t ion da ys( ) C a lcu la t e sick da ys( ) P la ce r e qu e st for va ca t ion ( va ca t ion da y) L oca t e e m ploye e n a m e ( ) I n se r t e m ploye e ( ) F in d e m ploye e a ddr e ss( ) I n se r t spou se ( ) C h a n ge e m ploye e a ddr e ss( )