Jason Gorman (email@example.com)
Fri, 29 Dec 2000 13:05:30 -0000
There is a book entitled "Design Patterns with Contracts" which uses Eiffel assertions to model the constraints. I think it would be quite simple to convert these into OCL. You would notice, however, when you read the book that the contracts do NOT constitute a complete behavioural specification. I am also working on this problem for an article that I never seem to get around to completing! Another area where contracts would be very useful is in the W3C DOM specifications for XML and HTML. Having just given a course in the W3C DOM, using IBM and Microsoft implementations in the exercises, I've picked up on some differences in their interpretation of correct behaviour. Since the W3C has given no precise behavioural specification this is bound to happen - yet another unique selling point for OCL! More often than not, when I apply contracts to well-known interfaces I find design flaws! I am currently proposing that any W3C standard should employ precise behavioural specifications in future. I would welcome any back-up on that... Cheers Jason Gorman firstname.lastname@example.org http://www.xml-objects.com -----Original Message----- From: email@example.com [mailto:firstname.lastname@example.org]On Behalf Of stuart kent Sent: 28 December 2000 21:35 To: email@example.com Subject: Re: Can OCL assist in describing Design Pattern? Yang Shunxiang Yang wrote: > > Hi, > > Is there any feasible way to describe Design Pattern both with ease and accuracy? I have an idea, but I do not know whether it's feasible or not. Here it is: > 1. model the design patterns using UML. > 2. add necessary description for the constraints in Design Patterns uing OCL or something like this. This is necessary because UML model is far from enough to describe a design pattern. > 3. record these 2 in a pattern lib. > 4. user can select a 'pattern' from the pattern lib, and when CASE tool trying to instantiate a design pattern, it refer both to the UML model and the OCL description. > > But there're some problems: > 1. Is there any extension of UML that support design pattern description? > 2. Is OCL ideal for this task? Or just a subset of it is enough? How to apply OCL description to the UML model of design pattern? for example, how to describe Abstract Factory in GoF pattern book? > 3. Is there any way to use OCL visually? See http://www.cs.ukc.ac.uk/people/staff/sjhk/cds.html > 4. Is there any other way to realize the goal I described above? > > I put forward this question in order to get the solution for this problem: Currently, the CASE tools supporting design patterns are hard to extend. For example, togetherJ is a nice UML tool supporting Design pattern. But to add new patterns to the pattern lib, users have to program in java. If togetherJ can support the way I described above, it will be much more convinient for users to add his/her new patterns to the pattern lib, and reuse them later. I'm in the process of writing a paper on this. I don't know if it is the same idea as you have above (it depends what you mean by "model the design patterns using UML" - what do you think the model would look like?). I'd be happy to send you a copy of the paper as soon as it is written (mid Jan I hope) - abstract factory is indeed one of the examples I use. You might also like to look at http://www.cs.concordia.ca/~faculty/eden/lepus/ for another approach to formalising design patterns, though I suspect it is not what you are after. Stuart -- ukc home - http://www.cs.ukc.ac.uk/people/staff/sjhk uml'2000 - http://www.cs.york.ac.uk/uml2000 puml group - http://www.puml.org/ To remove yourself from this list please mail firstname.lastname@example.org with a message containing the word "unsubscribe".