The Artima Developer Community
Sponsored Link

Agile Buzz Forum
Teaching DSM by example

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Steven Kelly

Posts: 294
Nickname: stevek
Registered: Jul, 2005

Steven Kelly is CTO at MetaCase and lead developer of the MetaEdit+ Domain-Specific Modeling tool
Teaching DSM by example Posted: Aug 14, 2007 7:33 AM
Reply to this message Reply

This post originated from an RSS feed registered with Agile Buzz by Steven Kelly.
Original Post: Teaching DSM by example
Feed Title: Steven Kelly on DSM
Feed URL: http://www.metacase.com/blogs/stevek/stevek-rss.xml
Feed Description: Domain-Specific Modeling: A Toolmaker Perspective
Latest Agile Buzz Posts
Latest Agile Buzz Posts by Steven Kelly
Latest Posts From Steven Kelly on DSM

Advertisement

Anders Norås has some fairly sharp criticism of the Microsoft DSL book and tools:

Just like with the software factories provided by the Patterns and Practices team, the examples in the book are bad examples of what you should use a visual DSL for. ... The lead role in the story is played by Devika, a lead programmer at CJKW. ... The code generated by Devika's DSL is similar to the manual hacks CJKW had done to satisfy their clients before they discovered DSLs[:] procedural and repetitive.
In my rant on software factories I stated that we should prefer frameworks over code generation, and whenever we see a reoccurring problem we should try to commoditize it via a framework rather than through code generation to improve maintainability.

I'd tend to agree that I find many of the ways Microsoft suggest using their DSL Tools to be odd, and not really good examples of how or where to apply Domain-Specific Modeling. There are however two things to bear in mind before criticising the book too heavily.

Firstly, as I mention in my own mini-review of the book, the purpose of the book is primarily to teach DSL Tools. The examples may therefore be simplified, even to the point of being poor DSM practice, to keep them simple enough that the main focus is on the tools.

Secondly, it's often vital to the acceptance of a DSL that it generate code that looks the same as existing code. The normal pattern for moving to DSM is straight coding => components => framework => textual DSL or XML => visual DSM language. There's a nice picture of that development by Don Roberts and Ralph Johnson (see Fig 1 in the PDF link at top right here). With that history, the code to be generated tends to be pretty well refactored already -- so hopefully rather better than the code in the example!

In our experience at MetaCase of over a decade of helping people apply DSM, the best initial step is to generate the same code as their developers are currently writing by hand. That helps their developers to "get it", and removes many fears and prejudices caused by the appalling mess most fixed code generators lead to. After that, when some models have already been made, it is easy to improve the generator to produce better code. For instance, generating a subclass for each state, as Anders wants, would be a simple task in our MetaEdit+ (but IIRC considerably harder in DSL Tools, since they don't deal well with a single generator producing multiple files). Obviously, it's then much easier to change every developer's code to the new format by regenerating, rather than by sending them a memo!

Code generation is only really palatable when you never have to edit the generated code, best if you never look at it. That way, you really are raising the level of abstraction, rather than just saving some keystrokes now but risking trouble later. If you want to see some real examples of DSM -- ones that work in the real world -- take a look at the cases on the DSM Forum, particularly the Sample DSM models.

Read: Teaching DSM by example

Topic: Meeting 16 - The Goal Previous Topic   Next Topic Topic: Dolphin Smalltalk Discontinued

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use