Read Best Practices for Model-Driven Software Development.
Best practices covered include:
- Separate the generated and manual code from each other
- Don't check-in generated code
- Integrate the generator into the build process
- Use the resources of the target platform
- Generate clean code
- Use the complier
- Talk in Metamodelese
- Develop DSLs iteratively
- Develop model-validation iteratively
- Test the generator using a reference model
- Select suitable technology
- Use textual syntax correctly
- Use Configuration By Exception
- Teamwork loves textual DSLs
- Use model-transformation to reduce complexity
- Generate towards a comprehensive platform
DSLs and code generators can, when used appropriately, be an immensely useful tool. But the focus should always be the problem to be solved. In many cases, it makes sense to describe certain, but not all, aspects using DSLs. Projects which decide from the get-go to follow a model-driven approach are ignoring this last piece of advice.Are you doing MDD? What have been your experiences?