Alan Cameron Wills - Domain Specific Languages

Models, domain-specific languages, code generation, ....

Models and Programs

What’s the word “Model” useful for?  People use it for all sorts of stuff, usually as distinct from “Program”. Here’s some definitions, ending up with the one I like best.

Model = pictures   (my score: 4/10)

  • UML is ‘modeling’ because it’s mostly pictures
  • OCL (the constraint part of UML) isn’t modeling, because it’s text
    • The same goes for ancient specification languages like VDM and Z
  • C# isn’t models, because it’s text

Model = imprecise  (my score: 1/10)

  • Sketches in UML, pseudocode, text descriptions are models
  • Executable UML isn’t models

Model = a processable description (my score: 7/10)

  • UML is models because it’s more exact than natural language
  • Programs is models because they’re exact enough for computers to execute
  • Sketchy drawings and descriptive waffle aren’t models

Model = abstract (i.e., incomplete in relation to some useful criterion) (my score: 8/10)

  • UML is usually models because it’s not complete enough to execute
  • C# is usually not models because if it’s grammatically correct, then it can be executed
  • Test code is in a sense abstract because, in relation to the thing you’re testing, the tests tell you some of what it’s supposed to do, without actually being the implementation; so the tests are an abstract model of the item under test
  • An isolated aspect, partial class, or an abstract class or an interface is a model, because it tells you a bit about things that conform to them
  • Scientific and mathematical models are processable abstract descriptions.

Model = a set of statements in any language that you can infer things from (my score: 9/10)

  • UML aspires to be models because the idea is, you can deduce things from the diagrams
  • Programs is models because they have a clear meaning (set by the compiler)
  • Testsuites are models of the things they’re testing

Model = an underlying set of relations of which you see abstract views (my score: 9/10 – and if combined with the previous, 10/10)

[thanks to Fred Thwaite for prompting me to add this]

  • Serious UML editors have multiple views that are all related together
  • Programs — well, maybe especially if aspect-oriented …