advertisement
Premier Club Log In/Registration
  Include Code  Search Tips
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   SKILLBUILDING  |   TIP BANK  |   SOURCEBANK  |   FORUMS  |   NEWSLETTERS
Browse DevX
Download the code for this article
XSLT Generation Pros and Cons
XSLT Reference Books
Partners & Affiliates
advertisement
advertisement
Average Rating: 4.6/5 | Rate this item | 5 users have rated this item.
 Print Print
 
Creating Portable Applications with Code Generation
You can use off-the-shelf, open source tools to build a code generator that will port your application design to multiple technologies and languages.  

advertisement
don't know about you but when I think about writing applications I think about all of the things I want the application to do for myself or for the customer. What I don't think about is all of the little details that turn an elegant design into a workable implementation, because so often the beauty of the design gets lost during the implementation process.


Alleviating this loss of design integrity is the main reason I'm so enamored with code generation. By using a program to translate an abstract model of my design into code I can maintain the design and also gain a measure of portability that no single implementation language can provide. While code generation provides many benefits, it's the portability aspect that I want to analyze in this article.

For those not familiar with the software engineering technique of code generation, I'll run through a brief introduction. Code generation is the technique of using a program to write production code for you. There are many models of code generator. The example in this article uses an abstract model of the design as input, and it outputs one or more implementation files.

There are four primary benefits to code generation; quality, consistency, productivity, and abstraction. Generated code is of high quality because it is being built using a set of templates. When bugs are found the templates are modified and the bugs are fixed across all of the generated code. Because it uses templates, generated code has consistent naming conventions across all of the output. The technique increases productivity by letting developers spend more of their time on the design and the unique aspects of the code.
Part of the design of the application is abstracted into the generator's input files; this abstract model can then be ported to other platforms and technologies simply by altering the templates of the code generator.

But it's the abstraction benefit that is the primary focus of this article, because abstraction is what gives our applications portability. Part of the design of the application is abstracted into the generator's input files; this abstract model can then be ported to other platforms and technologies simply by altering the templates of the code generator.

To demonstrate this I will use a code generator to build the data access layer of an application with two very different implementation technologies. I'll begin by defining the design of the database that I am going to generate.

Page 1 of 3


advertisement
  Next Page: The Book Database
Page 1: IntroductionPage 3: SQL Generation
Page 2: The Book Database  
advertisement
Advertising Info  |   Member Services  |   Permissions  |   Contact Us  |   Help  |   Feedback  |   Site Map  |   Network Map  |   About


JupiterOnlineMedia

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

Solutions
Whitepapers and eBooks
Microsoft Article: HyperV-The Killer Feature in WinServer ‘08
Avaya Article: How to Feed Data into the Avaya Event Processor
Microsoft Article: Install What You Need with Win Server ‘08
HP eBook: Putting the Green into IT
Whitepaper: HP Integrated Citrix XenServer for HP ProLiant Servers
Intel Go Parallel Portal: Interview with C++ Guru Herb Sutter, Part 1
Intel Go Parallel Portal: Interview with C++ Guru Herb Sutter, Part 2--The Future of Concurrency
Avaya Article: Setting Up a SIP A/S Development Environment
IBM Article: How Cool Is Your Data Center?
Microsoft Article: Managing Virtual Machines with Microsoft System Center
HP eBook: Storage Networking , Part 1
Microsoft Article: Solving Data Center Complexity with Microsoft System Center Configuration Manager 2007
MORE WHITEPAPERS, EBOOKS, AND ARTICLES
Webcasts
Intel Video: Are Multi-core Processors Here to Stay?
On-Demand Webcast: Five Virtualization Trends to Watch
HP Video: Page Cost Calculator
Intel Video: APIs for Parallel Programming
HP Webcast: Storage Is Changing Fast - Be Ready or Be Left Behind
Microsoft Silverlight Video: Creating Fading Controls with Expression Design and Expression Blend 2
MORE WEBCASTS, PODCASTS, AND VIDEOS
Downloads and eKits
Sun Download: Solaris 8 Migration Assistant
Sybase Download: SQL Anywhere Developer Edition
Red Gate Download: SQL Backup Pro and free DBA Best Practices eBook
Red Gate Download: SQL Compare Pro 6
Iron Speed Designer Application Generator
MORE DOWNLOADS, EKITS, AND FREE TRIALS
Tutorials and Demos
How-to-Article: Preparing for Hyper-Threading Technology and Dual Core Technology
eTouch PDF: Conquering the Tyranny of E-Mail and Word Processors
IBM Article: Collaborating in the High-Performance Workplace
HP Demo: StorageWorks EVA4400
Intel Featured Algorhythm: Intel Threading Building Blocks--The Pipeline Class
Microsoft How-to Article: Get Going with Silverlight and Windows Live
MORE TUTORIALS, DEMOS AND STEP-BY-STEP GUIDES