Simulation of Object Oriented Models using Animation
-
Upload
ian-oliver -
Category
Sports
-
view
213 -
download
0
description
Transcript of Simulation of Object Oriented Models using Animation
1 © NOKIA ESM 02 – 3 June 2002 – Ian Oliver, [email protected] Nokia Internal Use Only
Simulation of Object Oriented Models using Animation
Dr. Ian Oliver
Nokia Research Center
Helsinki, Finland
ESM 02 – 3 June 2002
2 © NOKIA ESM 02 – 3 June 2002 – Ian Oliver, [email protected] Nokia Internal Use Only
What people understand...
• or...the eternal conflict between software engineers’ world and the rest of the worlds’ view of the world...
• For example, developing a (another) library system...
• Analyst understands
• modelling • software • programming • UML • etc, etc, etc...
• Customer understands • books • users • library policy • etc, etc, etc...
3 © NOKIA ESM 02 – 3 June 2002 – Ian Oliver, [email protected] Nokia Internal Use Only
Analyst – Customer Interaction
• Analyst examines the customer’s current system and produces:
• class diagrams • sequence diagrams • business process descriptions • lots of other documentation
• Customer wants the final product
• Analyst checks that the his models are acceptable to the customer by;
• showing the analysis documentation • making presentations • building prototypes for demonstration....
4 © NOKIA ESM 02 – 3 June 2002 – Ian Oliver, [email protected] Nokia Internal Use Only
The prototypes
• The customer sees this...
• and likes what he sees.....the analyst is very happy
5 © NOKIA ESM 02 – 3 June 2002 – Ian Oliver, [email protected] Nokia Internal Use Only
The final product (based upon acceptance of the prototype!)
• Doesn’t quite match the customer’s expectations
• Is more expensive that thought
• Is delivered later than promised
• Functionality doesn’t work in the way the customer
wants nor the way the customer’s business works....
Why..?
6 © NOKIA ESM 02 – 3 June 2002 – Ian Oliver, [email protected] Nokia Internal Use Only
Some problems...
• Prototyping takes time and skill
• Prototyping requires that someone takes the models and accurately translates them into something that the customer can understand.
• Customer may misunderstand the prototypes, for example:
• ”What a nice user-interface....it must be good!” • ”Looks fine....nice colours! Exactly what I wanted!”
• The wrong people might assess the prototype
• The prototype might just be too early....
7 © NOKIA ESM 02 – 3 June 2002 – Ian Oliver, [email protected] Nokia Internal Use Only
Animation
• Animation can be consdered ”early prototyping” where the model itself is executed ... or possible ways in which a contract can be fulfilled.
• No translation to code • No misunderstandings of the requirements • No misleading user-interface issues
• But...in order to work successfully
• The customer and the analyst must work together with the
models and their animations.
8 © NOKIA ESM 02 – 3 June 2002 – Ian Oliver, [email protected] Nokia Internal Use Only
Animation in Context
Proof,
Symbolic Execution Prototyping
Animation
Model based Source code based
Non-Executable
Executable
9 © NOKIA ESM 02 – 3 June 2002 – Ian Oliver, [email protected] Nokia Internal Use Only
Supporting Technologies
• Object Orientation
• Unified Modelling Language
• Design-by-Contract
• Object Constraint Language
10 © NOKIA ESM 02 – 3 June 2002 – Ian Oliver, [email protected] Nokia Internal Use Only
Example (start)
u1:User c1:Copy
context User::loanCopy(c:Copy)
pre: c.onShelf=TRUE
post: u.loans->existsNew(l:Loan | l.copy=c) and
c.onShelf=FALSE and c.onLoan=TRUE.
u1.loanCopy(c1)
onShelf=True
UML Object Diagram:
Action Instance
- to be ”animated” on the starting state.
11 © NOKIA ESM 02 – 3 June 2002 – Ian Oliver, [email protected] Nokia Internal Use Only
Example (middle)
• The animation process
1. Check pre-condition 2. Path generation 3. Generate FSC operators 4. Apply FSC operators 5. Check post-condition 6. Check invariants 7. Present final states to the user
12 © NOKIA ESM 02 – 3 June 2002 – Ian Oliver, [email protected] Nokia Internal Use Only
Example (finish)
u1:User
l1:Loan
c1:Copy
onShelf=False
onLoan=True
This model does indeed satisfy the contract’s post-condition !
13 © NOKIA ESM 02 – 3 June 2002 – Ian Oliver, [email protected] Nokia Internal Use Only
Complications (1)
• Simple animations are reasonably straightforward !
• Animation in the presence of: • Incomplete specification / models • Ambiguous information • Undefinedness
• issorted?() • negation • x>0 – infinite sets • missing information
• Multiple paths • and • or
14 © NOKIA ESM 02 – 3 June 2002 – Ian Oliver, [email protected] Nokia Internal Use Only
• Contract Fulfilment
• Non-Determinancy
• Ambiguous Information
Complications (2)
•Library.publications.copies->existsNew(c:Copy)
•Library.publicationc.copies->excludes(c:Copy)
•User.loans -> select(current) -> size < 5
•Library.publications.copies->isSorted?()
15 © NOKIA ESM 02 – 3 June 2002 – Ian Oliver, [email protected] Nokia Internal Use Only
Complications (3)
• How complete is the model...?
• Rule of circumscription
• How do you cross a river?
• If the animation talks about things that are not present in the model then the starting state is not complete enough
16 © NOKIA ESM 02 – 3 June 2002 – Ian Oliver, [email protected] Nokia Internal Use Only
Complications (4)
• Multiple Paths through Post-Condition
( a=1 and b=2 ) or c=3
• a = 1 ; b = 2 ; c = 3
• b = 2 ; a = 1 ; c = 3
• c = 3
• a = 1 ; b = 2
• b = 2 ; a = 1
• c = 3 ; a = 1 ; b = 2
• c = 3 ; b = 2 ; a = 1
17 © NOKIA ESM 02 – 3 June 2002 – Ian Oliver, [email protected] Nokia Internal Use Only
Heuristics
• Minimum Obligation • includes • excludes • existential quantification • caridinality constriants, eg: size
• Least Interference • model sorting • default ordering
18 © NOKIA ESM 02 – 3 June 2002 – Ian Oliver, [email protected] Nokia Internal Use Only
Towards Simulation...
• Systems don’t just use simple, single operations and simple easy contract specifications unfortunately
• What would happen if... 1. a user loans a book 2. then another user 3. then another user 4. then a book is reserved 5. then another book is reserved 6. a user returns a book 7. a user leaves 8. etc...etc...
• Filmstrips can be used to help visualise this....
19 © NOKIA ESM 02 – 3 June 2002 – Ian Oliver, [email protected] Nokia Internal Use Only
Filmstrips
Time...
a()
b()
b()
c()
c()
c()
What are the possible outcomes if a(), b() and then c() are run on this starting state?
20 © NOKIA ESM 02 – 3 June 2002 – Ian Oliver, [email protected] Nokia Internal Use Only
Proof, Symbolic Execution, Animation and Prototyping
• Proof • can tell us whether a system is consistent, complete
(maybe) • is horribly mathematical
• Symbolic execution • can tell us how a system may look like given certain
constraints • is again too mathematical
• Animation • can visualise particular actions for given states • is limited to particular well chosen cases
• Prototyping • can help visualise the software • can be misunderstood and is quite far removed from the
actual model itself (user-interface syndrome)
21 © NOKIA ESM 02 – 3 June 2002 – Ian Oliver, [email protected] Nokia Internal Use Only
Other Applications
• Acceptance Testing
• Customer can check whether the model does what the customer wants
• Validation of customer requirements
and • Validation of analyst’s interpretation
• As animation is better suited to particular critical cases then these cases become a set of tests to be applied throughout the development process.
22 © NOKIA ESM 02 – 3 June 2002 – Ian Oliver, [email protected] Nokia Internal Use Only
Conclusions
• Not a ”silver bullet”
• Not too mathematical – UML/OCL is ”more readable”
• Brings customer and analyst closer together
• Avoids ”user-interface syndrome”
• Works at the model level early in the development process
• Very good at resolving certain critical issues with regard to the functionality required in the system
• Doesn’t need tool support – works with pen and paper
• Good for teaching design-by-contract principles and rigorous or formal modelling techniques
• Cheap(er)
23 © NOKIA ESM 02 – 3 June 2002 – Ian Oliver, [email protected] Nokia Internal Use Only
The End
Dr. Ian Oliver
Nokia Research Center
Helsinki
Finland