[Uml-devel] The best tool ever for modelling/validating for both developers and customers
Rafael Fernández López
ereslibre at kde.org
Sat Jan 26 08:12:07 UTC 2008
Hi,
> What do you mean by "query"?
> By "object diagram", do you mean class diagram?
> Umbrello already has an option for displaying the methods in the
> class boxes on a class diagram.
Hehe, I'm glad you ask me this. No, I'm going to go a bit further:
On the class diagram, you model:
class Person
Attributes: age:int
Methods: isOld()
context Person::isOld():bool
pre true
body self.age > 70
post true
So, now we have a class with one attribute and one method written in OCL
language. This code can actually be executed before going to the code itself
in C++ (or any other implementation), so the customer could be able to do
something like this:
- The customer creates an object diagram, in order to check if the program
does what they actually expect in some corner cases. The object diagram has
_instances_ of the classes, and you can actually query to the methods of
those instances, so the customer could do:
Object p1:Person
age = 70
And now ask, p1.isOld(). The system should return false. Nice ! the
implementation works as the customer expected. If it returned true because
the developer wrote "body self.age >= 70", the customer should save this
object diagram and tell the developer the problematic case.
On this line, you can do plenty of things, like for example (if we had a more
complex structure):
self.isParentOf(p2.siblings()->select(s1,s2|s1<>s2 implies
p2.siblings().......
Something like that, if for example our Person class had "isParentOf",
and "siblings" methods (just an example). This is plain OCL, but it can be
executed directly if we had the infraestructure for this.
The step from OCL code to actual code (C++ and the rest) is trivial, and you
could have generated a pretty good part of your application, and of course in
theory that part autogenerated should be almost perfect because the corner
cases were tested by the customer.
Bye,
Rafael Fernández López
GPG Fingerprint: B9F4 4730 43F8 FFDD CC5E BA8E 724E 406E 3F01 D070
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/umbrello-devel/attachments/20080126/c095975a/attachment.sig>
More information about the umbrello-devel
mailing list