180 likes | 261 Views
Systems grenser mot omverdenen Forelesning IN 265 18.3-2003. Are Use Cases necessarily the best start of an OO System Development Process? Basert på artikkel og lysark av Gerhard Skagestein, Universitetet i Oslo. The Unified Modeling Language - UML. Use-Case diagram.
E N D
Systems grenser mot omverdenenForelesning IN 265 18.3-2003 Are Use Cases necessarily the best start of an OO System Development Process? Basert på artikkel og lysark av Gerhard Skagestein, Universitetet i Oslo
The Unified Modeling Language - UML Use-Case diagram Class/object diagram Sequence diagram Collaboration diagram State diagram Activity diagram Component diagram Deployment diagram A set of 8 diagram techniques, established by groups setting the tone within the OO community Use- Case view Logi- cal view Compo- nent view Concur- rency view Deploy- ment view
Recommended sequence by most methods Use-Case diagram Class/object diagram Sequence diagram Collaboration diagram State diagram Activity diagram Component diagram Deployment diagram Start here Use- Case view Logi- cal view Compo- nent view Concur- rency view Deploy- ment view
A Use Case for an Automatic Teller Machine (see IN 102, ch. 9) Automatic Teller Machine • Insert card • Give PIN • Select amount • Remove card • Take money Withdrawcash Show recent transactions Customer Show currency exchange rates
Whats nice with Use Cases • Describe the expected functionality of the system on an appropriate abstraction level • Nice form of requirement specifications • Excellent basis for test-programs • Understandable by the users
What is bad with Use Cases • Use Cases are build on assumptions about the boundary of the system to be used • Responsibilities of users and system are more or less taken for granted • Does not assist in getting new ideas on how to organise things better – on the contrary, they prevent you from getting such ideas
An alternative approach –illustrated by a small example The object-oriented loan loan
The object-oriented loan A loan-object may • Know its own balance, interest rate, installment dates etc. • Calculate its own interests • Ask for instalments • Accept instalments Hello, you should pay the instalment loan
The Person and the Loan –a simple collaboration diagram :Person :Loan askforInstalment Person Loan classes
Allocation of responsibilities :Person :Loan askforInstalment Person Loan classes calculateInterest( ) calculateBalance( ) calculateInstalment( ) askforPayment(amount,date) acceptPayment(amount) askHimforPayment(amount,date) remindHim(amount,date) acceptHisPayment(amount)
The communication between the real and the computerized part Example: remindHim(amount, date) • Send him a typed letter • Send him an e-mail • Ask a clerk to call him • Send a SMS-message to his Mobile Phone the Protocol Person askHimforPayment(amount,date) remindHim(amount,date) acceptHisPayment(amount) 4 different Use Cases!
The harmful boundary Computerized system :object1 :object3 :object2 :object5 :object4 :object6 :object8 :object7 :objectn :object9 Computerized system
The better boundary Computerized system A user interface, may be describedby Use Cases :object1 :object3 :object2 :object5 :object4 :object6 :object8 :object7 :objectn :object9
My message – first part • The boundary between the computerized system and the environment does neither go through messages between objects, nor does it coincide with the interfaces of some objects On the contrary: • The boundary runs right through some objects, splitting them in a real world and a computerized part • The communication between those two parts is governed by a protocol, which may be documented by Use Cases • This protocol may involve communication between objects, but the on a lower abstraction level
My message – second part • A Use Case is a way to document the protocol between a human being (or another system) and a computerized system • It is obviously wrong to lay down this protocol before we have • Decided upon the distribution of responsibilities between the human being and the computerized system • Decided upon the means of communication between the two • Conclusion: Sequence/collaboration diagrams first!
Alternative sequence Use- Case view Logi- cal view Compo- nent view Concur- rency view Deploy- ment view Use-Case diagram Class/object diagram Sequence diagram Collaboration diagram State diagram Activity diagram Component diagram Deployment diagram Start here
Is the alternative method really ”better”? • Difficult to prove empirically –good designers make good systems even with bad methods But: • A method should not be obviously counterproductive in getting new ideas • The basic models should be invariant with regard to organizational and technical solutions
Punchline… • ”A system is an inter-related set of components, with an identifiable boundary, working together for some purpose, and which we choose to regard as a whole” • In other words: We select our systems to fit the purpose. • Before doing so, we should know as much as possible about the purpose!