Many applications contain abstractions that span a technology boundary. The most common case is the data access layer, where part of your abstraction is implemented in a general-purpose programming language, and part of your abstraction is implemented in SQL. This has led to the development of many code generation tools that target this particular problem: defining your object-relational mapping layer in one place, and generating the code and SQL that is required by your application.
However, this is not the only place where you will find these types of cross-technology boundary abstractions. For example, consider
- user interface: mapping user interface definition(s) to a database or application schema
- remoting: mapping the remotable interface of an application to its internal API
- configuration: mapping configuration information (registry, XML, directory service) to its internal API
- security: mapping operating system / runtime security model to application services
Since these mappings are virtually guaranteed to evolve over the lifetime of your application, capturing their definitions in a single place lets you efficiently evolve your application. However, it is not just important to capture their definitions in a single place, it is important to capture how those abstractions are implemented; you need fine-grained control over what code gets generated.
These two elements: capturing abstractions in a single place, and fine-grained control over the generated code are the keys to code generation. My mid-term goal is to catalog and document code generation patterns that arise in different problem domains. The patterns will be documented on this web site, an accompanying newsletter in the near future, and a book once there is a compelling story. If you are actively working in code generation in your existing applications, I’d love to hear from you. I am really interested in hearing about the problems you have run into, and how they fit into my existing catalog of patterns. In return, I’m willing to share any unpublished patterns that might you solve your problem.
If you are in the process of updating an existing application, or are building a new application from scratch, you have an ideal opportunity to introduce code generation into your development organization. I can help make this process considerably less painful for you by helping to sell the concept to management and your development staff. The code generation patterns that I have captured can help you bootstrap the process and reduce the amount of friction that you’ll encounter in the early on. Feel free to contact me at: jlam@iunknown.com.
1 archived reader comment
Alexis Smirnov (2003-04-29)
Don’t have pingback/trackback magic for my wablog, i’ll have to do it the old fashioned way. See comment here: http://radio.weblogs.com/0112946/2003/04/29.html#a146