Pattern Best Practices
There are several techniques that can improve the overall pattern development experience.
- Distinguish between view templates, which generate source artifacts (Java, HTML, etc.) and controller
templates, which transform the input DOM and direct the generation of source artifacts.
- In view templates, try to use only the simple merge tags, conditional inclusion tags and iteration tags.
- When using simple merge tags (e.g. <attr>) in view templates, try to insert complete language tokens
like class, variable and method names. Try to avoid building those tokens in the view templates. Instead,
use DOM modification tags (e.g. <setAttr>) to derive new attributes on elements in the DOM and use
those attributes in the view templates.
- Factor out naming convention and derived attribute logic from the primary controller template into included
templates. You can use the naming.pat and derived.pat controller templates created automatically with a new
pattern project. This allows for other pattern developers to override your pattern's naming conventions with their
own while still being able to reuse you view templates.
© Copyright IBM Corporation 2000,
2005. All Rights Reserved.