1. Trang chủ
  2. » Công Nghệ Thông Tin

Software Engineering (phần 10) pptx

40 348 0
Tài liệu đã được kiểm tra trùng lặp

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 40
Dung lượng 2,41 MB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

Now Figure 1 1 6 the doors close, and the elevator starts : Returning to the state diagram of Figure 12.6, consider what happens when the.. Send message to Floor Bu/on to turn on button

Trang 1

: i : :

'

In contrast, the representation of a UM L state diagram is somew hat Iess formal ' l

The three aspects of a state machine (state,event,and predicate)are distributed overthe !UML diagram For example, the state Go in'o W oii Sto'e in Figure 12.6 is entered j

if t he present stat e is El evotor Even, toop and the predicate ë el evator st opped, j 1

no r equest s pendi ngl i s t rue ( UML predi cat es or ' ' guar ds' ' appear n bracket s as j 1 I l

shown in Fi gure 12 6) When the state Go i ne W ci , Sioie has been entered action

l

Cl ose el evai or doors cher timeout is to be canied out.current versions of O OA i !'

di agram accordingly is no probl em However, when the object-ori ented paradigm

matures, itis likely that more formal versions willbe developed and the correspondingdynamic m odels w ill be som ewhat closer to finite state machines r

To see the equivalence of the state diagram of Figure 1 2.6 and the STDS of Figures j

1 l14 through 1 l 16, consider various scenarios For exam ple consider the hrst part '

the elevator goes i nto state S(U, 3), that is, i t stops at fl oor 3, about to go up (Because l ithe sim plifying assum ption has been m ade of only one elevator, the argument e in j

i Figure l l I6 is suppressed here).From Figure 1 l 5, when the elevator arrives, the ; i.i

floor button is turned off Now (Figure 1 1 6) the doors close, and the elevator starts :

Returning to the state diagram of Figure 12.6, consider what happens when the

elevator nears floor 3 Because the elevator is in motion, the next state entered is :

' Dei ermine I f S'op Reques/d The requests are checked and, because User A has ' i

!'

requested t he el evator to st op there, the next st at e is Stop oi Fl oor The elevator stops j t

at oor 3 and t he door s open The el evat or but t on f or oor 3 has not been pressed so 1 ' 1

User A enters and presses the elevator button for floor 7 Therefore, the next !

has st opped and t wo r equest s ar e pendi ng, so st at e Cl ose El evoi or Doors next and , ! 1

. t the doors close after a ti meout.The floor button at floor 3 w as pressed by U ser A , t

Protess Nexl Requesl is next and the elevator starts to move toward floor 4 The j

relevant aspects of the corresponding diagrams clearly are equivalent w ith respect to 'this scenario', you may w ish to consider other scenarios as well y !

I

From the preceding discussion. it should com e as no surprise to learn that Figure :

I12

.6 was constructed from the scenarios M ore precisely, the specific events of the !scenarios w ere generalized For example, consider the first event of the scenario of f '

Fi gure l 2 2, User A presses t he Up fl oor butt on at fl oor 3 This specihc event i s generali zed to an arbit rary butt on being pushed Then there are two possi bi lit ies : j

l @' j

;

Trang 2

t 3V% < H A p T E R IQ * Obiee-ori en#ed Anol ysis Phose

i

! Either the button already is Iit (in which case nothing happens) or the button is unlit

1

i case of an al ready Ii t butt on is model ed by the do-nothing loop with guard (but t on

@ pushed, buf t on l i f) in the top l eft-hand corner of Fi gure 12 6 The other case, an unli t

E button, i s model ed by the arrow labeled wi th t he guard Ibuf t on pushed, buft on unl i

' leading to state Protess Request From event 2 of the scenario it is clear that the action

E Turn on butt on i s needed in this state.Furthermore, the purpose of the user's action

'

of pressing an arbitrary but ton is to request an el evator, so aetion Updot e request s

also m ust be carried out in the state Protess Request

Now consi der event 3 of the scenario, An el evat or arri ves at fl oor 3 Thi s

!

) was generalized to the concept of an arbitrary elevator m oving between Qoors The

moti on of the el evat or i s modeled by the guard Iel evat or moving i n di rect i on d,

oor fs next) and the stat e Delermi ne i f Slop Requesled But there again are two

l possibilities.Ei ther there is a request to stop at floorf or no such request ln the former

;

i case con- espondi ng t o guar d ( no r equest o st op at oor , he el evat or si mpl y mus t

onl inue Moving one more floor i n direction d In t he latter case (correspondi ng t o

t 7 ! g uard (user I ncs requested stop ct fl oor f!) from t he scenari o of Figure l 2 2 it is dear

j ! t ha t t s ne c es s r y t St op el evat or f om e ve nt 3) , an d t hen Open door s an d s or f

timer (from events 5 and 6) Also, similar to the case of the Protess Requesi state,

it becomes apparent that i t i s necessary to Updat e request s in state Slop G Fl oor.

!

. :1 Finally, generalizing event 4 of the scenario leads to the realization that the elevator '

i

i: button has to be turned off if it is Iit.This is modeled by stat e El evolor Bu/on 0: ,

r (the st ate on t he bottom l eft of Figure l 2 6), together wit h the two guards above t ll

'

Doors', generalizing event 10 yields the state Process Next Requesi However, the(

:

: need for the state Go inlo W oif Stote and guard (no request s pendi ng, doors cl osedl

is deduced by generalizing an eventof a different scenario, one in which the user exit

The state diagrams for the other classes are relatively straightforward and t

here-: fore left as an exercise (Problem l2.)

g as suggested in Section l 2.4.2, is to use CRC cards

Trang 3

1 :k

'

@ j:

t

.

: i'

7 O pen elevator doors and storttimer i

s CRC card highli ghts t wo majorprobl ems wit h the hrst terati on of t he object- ; '

i t ed anal ysi s Fi rst consi der es ponsi bi l y 1 Tur n on el evat or bueon Thi s com- ! l

responsible for turning themsel ves on or off Also, from the viewpoi nt of informa- : l

t on hi di ng ( Sect i on 7 6) ,he El evot or Conl rol l er s houl d not have t he knowl edge of l

c han ges ar e ne ede d t br es pons i bi l i es hr ou gh n Fi gur e 1 2 7 The s i cor r ec - t

ti ons are refl ected in Figure l 2 8 the second i teration of the CRC card for the El evoe r

i e

,

v A second problem is that a class has been overlooked Consider the responsibility I

jr ' The attributes of a class sometim es are termed state variables The reason for this ; !

1 - '' t erminol ogy i s that, in most object-oriented implement ations, the state of the product

i d termined by the val ues of the attri butes of the various component objects The I e s e

: ! i r

!

: rl'j

Trang 4

1 aao t u A p T : R lx obi eu-ori en'ed Anol ysis phose

! 1 send message to Elevo'or Bu/on to turn on button

1 2 send message to Elevofor Bu/on to turn off button

3 Send message to Floor Bu/on to turn on button

4 Send message to Floor Bu/on to turn off bufton

5 Send message to Elevolor to move up one floor

4 6 send message to Elevador to move down one floor

1 ylgvee 1Q.@ second iteration ofCRC card for the class

i is not surprisi ng t hat the concept of t he state plays an important rol e i n t he

object-oriented paradigm This concept can be used to help determ ine whether a componentshould be m odeled as a class lf the component in question possesses a state that

i will be changed during execution of the im plem entation, then it probably should be

i m odeled as a class.Cl earl y, the doors of the elevator possess a state (open or cl osed),

-i oriented paradigm al lows the st ate to be hidden wit hin an object and hence protected

1 from unauthorized change.lf there is an El evoi or Doors object, the only way that the

f j

' '

' I Doors object Serious acci dents can be caused by opening or closing the doors of an

I I el evat or at t he wr ong t me' , see t he Jus tn Case You Want ed t o Know Box on page

j

1 1 38 l.Therefore, for certain types of products, safety considerations should be added '

' 1 , to the other advantages of objects Iist ed i n chapters 7 and 8.

; 12.7 need to be changed analogously to responsibilities l through 6 That is,m essages

.Responsibil ity 7 is Open el evat or doors and st art ti mer.

Trang 5

l '

J us' I N G s: You W ANTZP To Kwow q j

. Some years ago I was on the 10th floor of a building, Perhaps if that elevator control system had been

:. w aiIstartting ied tm patientlo step forw ary for d- only no elan elevator.The doors opened,evator was there. develappropriate oped using the object-oriented paradiopening of the doors on the 10th gm,floor the in-m ight l!

.

l What aved me was he ot al bl acknes s aw as was ha ve been avoi ded

about to st ep into the el evat or shaft and l i nsti ncti vel y j j !

'

j I

-.( p

'

1 i

1 -Thi

s must be s pl i i nt o t wo s eparat e r es ponsi bi l i es A message i ndeed must be s ent ë i

t o t he El evuù or Door s t o open.However. t he timer is part of the El evcior Conl rol l er,

l The second it erati on of the CRC card for t he El evoior Control l er cl ass (Figure 12.8) q r , hows that t his separation of responsi bili ti es has been achieved satisfactoril y ( k 1 s

In additi on to the two major problems highl ighted by the CRC card of Figure , I 12.7 responsibil ities Check requesis and Updat e request s of El evol or Coniroll er

requests are dehned simply to be of type requestType; a data structure for requests , : .

: i

The corrected class diagram is shown in Figure 12.9 Having modified the class r !

'

diagram the use-case and state diagram s m ust be reexam ined to see if they,too need i ' '

! IIi

! 1 !

!!

1

Trang 6

1 2 The floor button informs the elevator controller that the floor button has been pushed.

1 3 Tie elevator controller sends a message to the Up floor button to turn itselfon

! h Ievator controller sends a series of messages to the elevator to move itself up .

! to floor 3 The elevatorcontains User B, who has entered the elevator ctfloor 1 and

P

5 The elevator controller sends a messoge to the Up floor button to turn itselfoff

E 6 The elevator controller sends a message to the elevator doors to open themselves 'i

( Z The elevatorcontrol starts the timer

User A enters the elevator

:

8 User A presses elevotor button for floor 7

9 The elevator button informs the elevator controller that the elevator button has been

. 10 The elevatorcontroller sends a messcge to the elevator button for floor 7 to turn itself on

i 1 1 The elevatorcontroller sends c message to the elevator doors to close themselves oher o

' 1 4 The el evot or conf r ol l er ends a mess age t o t e el evat or door s o open t hems el ves

: j

cllow UserA to exit from the elevator

15 The elevotor controller starts the timer '(

' User A exits from ihe elevator

Flgvee 1Q.1@ Second iteration of u normal scenario

furtherrelinement The use-case diagram clearly stillis adequate However,the actions

in the state diagram of Figure l2.6 must be m odified to reiect the responsibilities of

1 i teration) Also, the set of st at e diagrams must be extended to include the additi onal (

k 1 class The scenarios need to be to updated to reiectthese changes', Figure 12.10 shows

ê

!: been made and checked (including the modified CRC cards), it still may be necessary

# ' 5 duri ng t he object- or i ent ed desi gn phase t o r et ur n t o t he object - ori ent ed anal ysi s and 2 l

to that of A ppendix E O nce approved, the specilication document is handed to the

j design team , together with the various U M L diagram s

Trang 7

' ! -

1 l

i l

l2.e AIR G OURMET CASE STUDY: O BJK T-O RIENTID A NAW SIS a@a 1,

!

! k

1Q.y QA SK Toots FoR TH: @ BJE<T-@ RIKNTEP ' j l

I

l1B

earing in mind the role pl ayed by diagrams i n object-oriented analysi s, it is not I surpri sing that a number of CASE tools have been devel oped t o support object- ( I

1oriented analysis ln its basic form , such a tool essentially is a drawing tool that : t

k es eas y t per f or m e ch of he mo del i ng s eps Mor e i mp or t nt t s a mpl er ' 1 j ma

to modify a diagram constructed with a drawing tool than to attem pt to change a 2

!hand-draw n figure Thuss a CASE tool of this type supports the graphical aspects of ;

object-oriented analysi s In additi on, some t ool s of this type not only draw all the I I ë

1 levant diagram s but CRC cards as well A strength of these tools is that a change to 7

:l

; the underlying m odel is reoected autom atically in aIl the affected diagram s', after all, )

the various diagram s are m erely different views of the underlying m odel '

'

, a considerable portion ot the rest of the object-oriented li fe cycle as wel l Nowadays 1 1

Is support UML (Rumbaugh, Jacobson and Booch, 19991 : i 1 virtually al1 of these too

j I r

? : Object-ori ent ed analysi s consi sts of three steps: use-case modeling, class model-

ing, and dynam ic modeling These steps are canied out iteratively, starting w ith the :

first step, use-case modeling The main menu of the Air Gourmet rapid prototype

( Appendi x C or D) yi el ds a l i st of use cas es These al s o coul d have been deduced j

C wi th considerably more effort di rectly from the requirements of Section 1 0 14 j 1 ' T

The use case for m aking a reservation is shown in Figure l2 l Normal and E '.I)exception scenarios are needed for this use-case diagram One approach is to con- I '

! I

struct separate normaland exception scenarios', this was done for the elevator problem (

l

( Fi gures l 2 2 and l 2 3) For he Ai r Gourmet probl em, we use a sl i ght l y di f erent or- 4 j

m alism , an extended scenario that retlects possible alternatives.A n extended scenario '

Figure l2.2 was constructed from the prototype (Appendix C or D) Choosing 'Ent er a Res er vat i on f rom t he mai n menu (r epr esent ed by event l of Fi gur e 1 2 2) 1 t i

and 9), special meals information (events 6 and 7), and passenger information (events )

2 and 3) It was quickly realized that the rapid prototype solicits information in the ' '

wrong order, and that the paym ent for the reservation had been om itted Rearranging k ,

1I 'the requests and adding the payment portion yielded events 1 through l 1 of Figure j: 12 l2 The last three events of the scenario w ere added to com plete the normal part ' l

Trang 8

2 Tlae Phone Operaàor requesfs àlne name and address of àlne Passenger.

1 3 The Possenger provides fhe requested information

1 zt The Phone Operatorasks the Fassenger the date ofthe flightand the flight number

j ! 7 The P os s enger ct es whot n d of peci al meal , f any , i s des i ed.

'' 8 The Phone Operoforasks the Fossenger for his or her seating preference.

: 9 The Fassenger provides his or her seofing preference

; ' 1 0 The Fhone Operctor requests payment information

, I

1 1 The Possenger provides o volîd credif cord number

;

! 1 2 The Fhone Operator commits the reservation to the Air Gourmet database.

1 1 3 The Air Gourmet datobase issues the reservation ID to the Phone Operator.

t 1z1' The Fhone Operator gives the reservation ID to the Passenger and informs the

C The Fassenger has an unusuol meol requestthatAir Gourmet cannot fulf

D There are problems with the creditcard number provided by the Fassenger,(

! Flgvze 12.12 Extended scenario corresponding to Figure 1.1 1 1

j corresponding extended scenario is shown in Figure l2 14 Event 3 of this scenalio

was obtai ned from the scon post card porti on of the rapi d prot otype Events 1 and

2 then were added to com plete the scenario As with the previous scenarios the four

.

1 possible alternatives were deduced while working on the normal events

7/

!

1

Trang 9

return/scan postcard

2 : l

; 1' j j

l

1

l

t o t he Passenger who recei ved a speci al meal

2 The Fassenger receives the postcard, rates the meal, and mail the postcard back to Air j )

3 The Air Gourmet Staff Member receives the postcard and updates the appropriote flight 1

r ecor d i t Ai r Gour met dat cbas e t o r ecor d t e Fas s en ger ' r espons e ! 1I

'

k l P

i IA

IB

' C The F as s enger mar ks he post c ar d er r oneous l y; or exompl e, by pr ovi di ng an ans wer ; : I

outside the ronge ofvalid values ' !i

D A Fassenger who did not requesta special meal receives the postcard and mails it bock i 1

:: ! ï

Flgvre 1Q.1* Extended scenario corresponding to Figure 12 3 ' i

l

:

The other use cases (create and shade a special meals list, transport special j '

meals, view é'low sodium '' report view E'percentage statistics'' report, view çtm eals I ' l )

! '

not loaded''report, and view ûçpoor quality'' report) are sim ilar as are their respective I I i

find their attributes,and determine their interrelati onshi ps and interactions This was l j

performed using the three-stage noun extraction method of Section l2.4, rather than p, k

scenarios or CRC cards Stage 1 is to define the product as briefly and concisely as l

'

A computeri zed system is needed t o provi de i ntorma

I :

ln stage 2 an inform al strategy is draw n up, preferably in a single paragraph l

II àO

!R

eport s are to be generat ed to document the eff icacy of the speci al meals program ' 1

. The reports concern m eals Ioaded on flights, llights boarded by passengers nam es ' !

d ddresses of passengers, meal qualitys and Iow-sodium meal quality ! l

Trang 10

1 ln stage 3 the nouns in this paragraph are identified, yielding

Reports are to be generated to document t he effi cacy of t he special meals pr ogr om.

i

i ' rhe reporf s concern percent oges of meal s l oaded on fl i ght s and boording of f ght s

,meal qualis and Iow-sodium

; by passengers, names and a resses o p

!

'

, The nouns are report , effi cacy, program, percentage meal fl i ght boarding,

passenger, name, oddress, and qual i ty Effi cacy, progrom, percent oge, boording, C

' and qual i yare abstractnouns and therefore unlikely to beclasses Nameandaddress ;

clearly are attributes of passenger The presence or absence of a special meal on a

i ven flight is a central issue W hat i s l ess cl ear is whether the meal itsel f or the

lirst iteration This left two nouns and, thercfore, two candidate classes: Report and

j Possenger The resulting first iteration ofthe class diagram is shown in Figure l2.15

i This hgure reflects the two candidate classes, plus four subclasses. one for each of the

i

. j and ending date Each subclass com prises the lields specific to that report

! There are a number of problem s with this class diagram '

Trang 11

, onboard the flight for which they ordered a special m eal, the data have to be é

j2

. Each report has to access multi pl e fli ght records, and each ii ght has multi ple 4 j

Section 10.14 specifies four num bered reports,as reflected in Figure 12.15 How- 1

3.

!2

ever, the f irst numbered report actually consi sts of three separat e report s There- 1

,the class diagram should reqect six (and not four) subclasses of Report j

$ These events are rectiied in the class diagram of Figure l2.16 There are in- '

t ' deed now six subclasses of Report Furtherm ore there is a one-to-m any relationship I E.) (Section 1 1 5) between Repod and Fl ighl Record, rel lecti ng that each report con- t I

, t ains information from many qights Fi nall y the open diamond next to Fl igl / Retord , l i

!

l a one-to-m any relationship.That is, each llight record comprises many passenger , ',

ds These records could have been modeled as components of the Fl i ghl Reeord : !

) I nst ead, f or si mpl i ci t y and cl ar i y, t he Pcssenger cl ass i s t r eat ed as a separat e en- E j

candidate class As previously pointed out, it is easy to add classes but m uch harder ( ;

t wo candi dat e cl ass es or he i ni t al t erat i on ' j

lt i s less easy to justify t he decision to i ncorporate only four repol t subclasses. ' !

I IAfter all.the rapi d prototype (Appendix C or Appendix D) cont ains six reports On ' l

(

. be better to note the ease with which the second iteration was produced, once it was ) t

he passengers on those Pights ln other words, iterati on is intri nsic t o the object- i ' 1

)

oriented paradigm in general and object-oriented anal ysis in part icular lteration does l I

discarding an artifact w hen a fault is detected, but rather modifying that : ''

J not mea n

m ifact stepwise to correct the fault II 'i

The thi rd st ep in object-oriented anal ysis is dynami c modeli ng A1l t he scenari os ( !

flected in the state diagram of Figure l2 7 for the com plete product Strictly lare re

i

speaking, a state di agram appertains to a class not the product as a whol e, but because j i

l asses of the Air Gourmet product do not move from state to state, a di agram ' ' ( j the c

The object-oriented analysis appears compl ete lt t herefore should be revi ewed ! q

.Neither the client nor the development team should be w illing to accept the set

. of UM L diagram s as an adequate specification document A fter all, as pointed out in r: Section 1 l the specihcation docum ent is a contract between client and developers ' '

Accordingly, after the OOA is hnished, a m ore conventional speciEcation docum ent yhas to be drawn up Because that docum ent would be so sim ilar to m uch of the m aterial

Trang 12

!

.) aea t u A p 4 R 42 @ O bleu -o rien'ed Anolysis Phose

meal Iooded : Boolean oddress 2 : string

!

.

'

onboord : Boolean city : strins

E perc meal quoliy : int state/province : string

f l

' Ioaded as specifed,

Trang 13

'

k j

q

2 l

! ' I

A2.* A1 R GOURMET CM E STUDY: OBJECT-O RIENTED ANAWSIS 3@@ l

i (

iMake Reservation Order Special Meal

1

Store reservation in Air Create Iistor caterers : 1. !

(ake-offtime - 1 hrS check-in time < take-off time - 10 min) ;

i i

E1 Passenger Check-in

-) )

c

l

j ) '

Scan postcard

:data complete

- - j :

ê l 2

1 , (.

1

Get st ar t end dat es @ j p

j '

i .

I (i 1.t

l ) :

Trang 14

1 Just as w hen the structured paradigm was used for the specihcation of the Air

1 Gourmet product (Sect ion 1 1 5), at thi s poi nt the software project management pl an

l

i is drawn up Appendix F contai ns a software project management plan for develop- E

i Object-ori ent ed analysis is a specihc approach to the specifi cation phase,so the

gen-1 l challenges of the specihcation phase described in Section 1 l

g ;' Recal l that, as described i n Secti on l 6, the transiti on from object-oriented anal

-' ysis to object-oriented design is far smoother than the transition in the classi cal

l paradigm from the specification phase to the design phase In the classical paradigm,

i an initial task of the design phase is to decompose the product into modules In

con-' trast, the classes, the i t modul es' ' of the object -oriented design phase are extracted

h

during the object-orient ed analysis phase, ready for refinement during t he object t

-r oriented design phase The presence of classes from early in the OOA phase means

that the tem ptation to carry the OOA too far can be extremely strong

5

For example, eonsider the issue of allocation of m ethods to elasses One task

of the classical specihcation phase is to determ ine the data and actions of the target

r product How ever, allocation of the various actions to specihc modules should be

delayed until the design phase, because as pointed out in Section 1 l 16, we first have

' i At each step of the O OA process it is a good idea to m inim ize the information

' èi that would have to be reorganized during iteration.Therefore, allocation of methods

; to classes should wait until the design phase, no matter how tem pting it m ay be to go

just a li ttle further during the object-ori ented anal ysis phase.

Trang 15

ar e di scus sed i n Sect i on 12 7 The chapt erconcl udes wi t h t he ob ject - ori ent ed anal ys i i J '

of the Air Gourmet case study (Section 12.8) and a discussion of the challenges of 1,

t he object -oriented analysis phase (Secti on l 2 9) I 1 j

!

j 'p5 : I

1 1

ly books descri bi ng different versions of object-ori ented analysis include îcoad l

Ea r

and Yourdon, l 99 la; Rumbaugh et a1 , 199 l ; Shl aer and M ellor, l 992 , and Booch, I I !

19941 As mentioned in the chapter, these techni ques (and others not li sted here) are i 1

I ib

Objectory ( Jacobson, Christ erson Jonsson and Overgaard, l 9921 The Unif ied Soft- y ,

:

cobson, Booch, and Rumbaugh, 1 9991 Catalysis is another important object-ori ented : ,

ROOM is an object-oriented methodology for real -time software gsel ic, ) )

I

l 1 i Gull ekson

,and W ard 19951 Further i nformation on real -ti me object-oriented tech- I I j !

( '

and Rumbaugh, Jacobson, and Booch, 19991 The October 1999 issue of Communi- ! jcati ons ofthe ACM contai ns a broad variet y of papers on the use of UML 1

'

The noun-extraction technique used i n this chapter to extract candidate classes i s l

, : j formalized in t lurist o

'

I p

r

-good source of information on CRC cards i t

ber of articles on object-oriented analysis Several eomparisons of object-ori ented ' !

: l isons of object-ori ent ed and structured analysis t echni ques appears i n gFi chman and . r

j

: 1

Trang 16

i f scenarios to assist wi th object-oriented analysi s.

i I

, ; object-oriented anal ysi s?

f 1 2 4 Use object-ori ent ed analysis to specify the software for controlli ng the ATM of

Prob-E lem 8.9 There is no need to consider the details of the constituent hardware

compo-nents such as the card reader, printer, and cash dispenser lnstead, sim ply assum e that

be introduced wi thout adversel y atfecti ng t he project?

1 Q.6 W hat is the earli est point i n the object-oriented paradigm at which cl asses can be

m eaningfully introduced?

i

! 1Q.7' ls it possible to represent the dynamic m odel using a form alism other than the statel

! diagram described in this chapter? Explain your answ er

1 Q.8 W hy do you think that the attributes of the classes but not the methods are determined

during object-ori ent ed anal ysis?

i 1 2.@ (Term Project) Use object-ori ent ed analysis to specify the Broadlands Area Chi ldren' s i

Hospit al product descri bed in Appendix A.

I )

! j

Trang 17

, ,1

l '- I

I - h 1

j j

wi th the object-ori ent ed analysis of Section l 2.8 ' 1

j

! ! )

; !

I

11

Technologyjbr Real-lime Svstems, Prentice Hall, Upper Saddle River, NJs l996 I I y

Beck and Cunni ngham, 19891 K BECK AND W CUNNINGHAM, G A Labor atory for Teaching k 1

, ( j ,

(Bellinzona, Fugini and Pernici, 19951 R BELLINZONA, M G FIJGINI, AND B PERNICI, ! I 1 '

' 'Reusing Specifications in 0 0 Applications, ,,IEEE Sojtware 12 (M arch 1995) ; 1 '

pp.656-75.

' h 4 I i cat i ons, 2nd ed , l ( Booch, 1 9941 G Booci l Ob ject - or i nt e dAnal ysi s and Desi gn w? / pp

(Booch, Rumbaugh, and Jacobson, 19991 G Boocu, J RUMBAUGH, AND 1 JACOBSON, The !

UM L Users G uide, A ddison W esley, Reading, M As 1999 8

' (Coad an d Yourdon, 199 1al P COAD ANt) E YOURDON, Object-oriented Analyxiy 2nd ed., l t ''

,j Y

ourdon Press, Englewood Cliffs, NJ, 199 1 ( ! t '(Coleman, Hayes, and Bear, 19921 D COLEMAN, F HAYES, AND S BEAR, ttlntroducing i j

'

:Jn Software Engineering 18 (January 1992), pp 9- I8 '

(Coleman et al., 19941 D COLEMAN, P ARNOI-D, S BODOFF, C DOLLIN, l1 GILCHRIST, (t *

F HAYES, AND P JEREMAES, Object-oriented Development The Fusion M ethod, ! '

$ j

!de Champeaux and Faure, l9921 D DE CHAMPEAIJX ANo P FAURE, ''A Comparative Study ' L

(Embley Jackson, and W oodfield, 19951 D W EMBI.EY, R B JAclksoN ANI) 1

S N W OODFIEI-D, 00 Systems Analysis: Is lt or Isn t It? IEEE s'q/rktlre 12 (July : j .

Fowlers 1997b1 M FOWLER WITH K SCOTT, UM L Distilled, Addison-Wesley, Reading, M A, 1

g

-lareland Gery, 19971 D HAREL AND E GERY, ''Executable Object Modeling with ' 1

Statecharts

(acobson, Booch, and Rumbaugh, l999) J RUMBAIJGH, G Boocll, AND 1 JACOBSON, The

Unfi ed Soft ware Devel opment #mc

Trang 18

' !

l '

e n > * e < $ l I !

l (

!i

: j)j '

i .

,m any have been used only by their authors Som e I

design strategies particularly those developed by academics have a lirm theoretical basis Others includingmanv draw n uo bv academ ics, are more praem atic in nature', thev were put forward because their authors E ,

; found that they worked well in practice M ost design techniques are m anual, but automation increasingly is ' ,

' becoming an im portant aspect of design, if only to assistn the management of documentation ! 1

1 1

' Notwit hstandi ng t hi s pl ethora of desi gn techniques, there is a certain underlying pattern A major t heme j j ,

j 'j

of this book is that two essential aspects of a product are its actions and the data on which the actions operate I

'

I jfirst

A weakness of action-oriented design techniques is that they concentrate on the actions', the data are of : 1

I 1 only secondary im portance Data-oriented design techniques sim ilarly emphasize the data, to the detrim ent of I

j ' the actions.The solution is to use object-ori ented techniques, which gi ve equal wei ght to actions and data ln ! 'rthis chapter, acti on- and data-ori ent ed desi gn are described first, then object-ori ented desi gn i s described Just 1 q I

as an object i ncorporat es both acti on and data, so object-ori ent ed design combi nes features of acti on-oriented I '

and dat a- or i ent ed desi gn Ther efor e, a basi c unders t andi ng of act i on- and dat a- ori ent ed des i gn i s needed t o I L 1 '

( get a full understanding of object-oriented design ( 1

:?Before specilic design techniques are exam ined, some general rem arks m ust be m ade regarding the !. ,

1

i ''design phase

; I

J -

-:

I '

The software design phase consists of three activities: architectural design, detail- :

ed design, and design testing The input to the design process is the specihcation I '

;

I '

h j ' '

I t I

:

Trang 19

i descripti on of what the product is to do

.The output is the design document, a

docu-1

ment, a description of how the product is to achieve this

t During architectural design (also known as general design,Iogical design, or

j high-level design) a modular decomposition of the product is developed That i

! the specifications are analyzed carefully, and a m odule structure that has the desired' functionality is produced The output from this activity is a list of the modules and a

deseription of how they are to be interconnected From the viewpoint of abstraction,during architectural design, the existence of certain modules is assumed', the design

during the object -oriented analysis phase (Chapt er 12) This is because the hrst step

in OOA is to determ ine the classes Because a class is a type of module, some of themodular decom position has been perform ed during the analysis phase

The next activity is detailed design, also known as modular design, physical

s two-stage process is typical of abstraction as described in Chapter 7 First,

) exist Then each m odule is designed in turn, w ithout regard to its being a com ponent

E j

. j lt was stated previously thatthe design phase has three activities and thatthe third

i activity is testing The word activity was used, rather than stage or step, to emphasize

j that testing is an integral part of design, just as it i s an int egral part of t he enti re

software development and m aintenance process Testing is not something performedonly after the architectural design and detailed design have been com pleted

A variety of different design techniques now are described, hrst action-oriented

techni ques, then data-oriented techniques, and final ly object-ori ent ed techni ques.

: j

mod-1 ules with high cohesion and low coupling.W e now describe two practi cal techniques

' j

for achi eving t hi s design objecti ve, data f low analysis (Secti on 13 3) and

transac-. (

i the specihcations can be represented by a data flow diagram, and because (at least

;: t in theory) every product can be represented by a DFD, data flow analysis is uni-

) i processi ng products (Transaction analysi s, described in Secti on 13 4, is a good way

f of decom posing transaction processing products into modules.) i

'

j

1

Trang 20

' j:i1

1 i

I I

Data flow analysis (DFA) is a design technique for achieving modules with high

h i on I t can be used i n conjunct i on wi t h most s peci hcat i on t echni ques Her e 1

i (Sect i on l l 3) The ë I DFA ipr es ent ed i n con junct i on wi t h st r uct ured syst ems anal ys

' :input tothe technique is adataqow diagram.A key pointis that,oncethe D FD has been

com pleted, the softw are designer has precise and complete infbrm ation regarding the 1 ;

s :input to and output from the product.

Consider the flow of data in the product represented by the DFD of Figure 13.1 j .

point in the flow of data at which the output can be identified as such rather than as '

Using the points ot

posed into t hree modules: the i nput modul e transform modul e, and output modul e !

i: Now each m odule is taken in turn, its points of highest abstraction found, and the !

d l es decomposed agai n Thi s pr ocedur e iconti nued s epwi s e unt ieach modul e 1

1 In tai-rness it s ou h ld be pointed out that m inor m oditications might have to be 1; l ,

: made to the decom position to achieve the lowestpossible coupling Data flow analysis r' is a way of achieving high cohesion The aim of com posite-structured design is high

cohesion butalso low coupling.To achieve the latter, isometimes is necessaryto m ake !

1

gure laa Dof a f l ow di agram showi ng fl ow of dat o and act i ons of product j ,

j , '

Ngày đăng: 07/07/2014, 06:20

TỪ KHÓA LIÊN QUAN