June 21, 2005
OCL Tools For LearningIt's nigh on impossible to learn a new language without getting some realistic practice. the best way to learn French or Spanish is to speak French and Spanish - ideally, to French and Spanish speakers.
Similarly, the best way to learn OCL is to practice saying things in the language with a tool that is fluent in OCL, and can tell you when you've got it wrong.
Here's a list of tools that you can download for free. Some are better than others, and - if I'm being honest - none are what you'd call "industrial strength" yet. But it's early days, and if you're interested in adopting the OMG's Model-driven Architecture in years to come, practical experience of OCL will stand you in good stead. If you're just looking to use a light sprinkling of OCL in your analysis models - perhaps done on a whiteboard or just using a text editor - then practice is even more essential, and you'll be trying to write meaningful and well-formed OCL expressions without the aid of a syntax checker.
C#/OCL Compiler allows you to embed OCL expressions in C# code and to evaluate those expressions at runtime (e.g., in unit tests). The author warns us not to use the tool in production code, and I would tend to agree. But it's not bad at all, and the OCL syntax has been "tweaked" to accomodate .NET. It's pretty simple and intuitive and sits nicely inside your IDE. If it were ever to become production qualty, I would probably find it useful for being able to directly map OCL constraints in high-level analysis models into my code. Now that's what I call a rules engine!
Dresden OCL Toolkit has been around for a few years, and has matured considerably in that time. Aimed at Java developers, it has that hobbyist feel to it. It's more of a kit than an out-of-the-box experience. The OCL 2.0 parser is spot on, though.
Octopus is an Eclipse plug-in from Klasse Objecten, the home of OCL, so you'd expect it to be a pretty decent tool. Nice idea, but it falls far short of its ambitions. As you'd expect, compliance to the OCL 2.0 language specification is very good, which is the tools saving grace.
USE is a "UML-based Specification Environment" that led the pack in 2001, but has come on little since then. It's cool to watch your scenarios played out with object animations, and to be able to evaluate OCL expressions against snapshots dynamically, but you have to do a lot of leg work to get to that point. I have fond memories of it as a teaching tool - especially its quirky interpretation of the OCL syntax - but I wouldn't recommend it now.
OCL Environment (OCLE) is one of my favourites for teaching. It's a stand-alone modeling tool that's designed specifically for OCL specification, with the lovely syntax-directed code editing features you'd expect from any IDE, plus simple class diagram modeling. The XMI import actually works, too! Again, the bias is towards Java developers, but I've seen C# developers get mileage out of it, too. Like all the tools listed here, you won't get production-quality code out of this tool - but for learning purposes, that's fine.
Posted 15 years, 7 months ago on June 21, 2005