skip to main content
Skip header Section
Code Generation in ActionJuly 2003
Publisher:
  • Manning Publications Co.
  • 3 Lewis Street Greenwich, CT
  • United States
ISBN:978-1-930110-97-7
Published:01 July 2003
Pages:
368
Skip Bibliometrics Section
Bibliometrics
Skip Abstract Section
Abstract

From the Publisher: Covering techniques and implementation for building code for complex applications frameworks, this book demonstrates how to build high quality output that is consistent and maintainable. Within this framework lessons on abstracting the design of the code so that multiple outputs can be created from a single abstract model of the application functionality is provided. Techniques that range from simple code processors that handle common coding problems to more elaborate and complex generators that maintain entire application tiers are covered. Topics such as building database access, user interface, remote procedure, test cases, and business logic code, as well as code for other system functions are also addressed. Although code generation is an engineering technique it also has an impact at the engineering team and managerial levels. As such, this book covers this non-technical aspect of code generation in depth. About the Author:Jack Herrington is a software engineer who has shipped applications as diverse as scientific real-time applications and web applications for business. He is an expert in the use of code generation techniques from very simple code maintenance to code generators, which build entire tiers of functionality. He lives in Union City, California.

Cited By

  1. Glake D, Weyl J, Dohmen C, Hüning C and Clemen T Modeling through model transformation with MARS 2.0 Proceedings of the Agent-Directed Simulation Symposium, (1-12)
  2. Wang G, Stitt G, Lam H and George A (2016). Core-level modeling and frequency prediction for DSP applications on FPGAs, International Journal of Reconfigurable Computing, 2015, (7-7), Online publication date: 1-Jan-2015.
  3. ACM
    Vilar R, Oliveira D and Almeida H Rendering patterns for enterprise applications Proceedings of the 20th European Conference on Pattern Languages of Programs, (1-17)
  4. ACM
    Arnoldus B, van den Brand M and Serebrenik A (2011). Less is more, ACM SIGPLAN Notices, 47:3, (137-146), Online publication date: 18-Apr-2012.
  5. Zheng Y and Taylor R Enhancing architecture-implementation conformance with change management and support for behavioral mapping Proceedings of the 34th International Conference on Software Engineering, (628-638)
  6. Heradio R, Fernandez-Amoros D, De La Torre L and Abad I (2019). Exemplar driven development of software product lines, Expert Systems with Applications: An International Journal, 39:17, (12885-12896), Online publication date: 1-Dec-2012.
  7. ACM
    Arnoldus B, van den Brand M and Serebrenik A Less is more Proceedings of the 10th ACM international conference on Generative programming and component engineering, (137-146)
  8. ACM
    Tamayo A, Granell C and Huerta J Instance-based XML data binding for mobile devices Proceedings of the Third International Workshop on Middleware for Pervasive Mobile and Embedded Computing, (1-8)
  9. Newburn C, So B, Liu Z, McCool M, Ghuloum A, Toit S, Wang Z, Du Z, Chen Y, Wu G, Guo P, Liu Z and Zhang D Intel's Array Building Blocks Proceedings of the 9th Annual IEEE/ACM International Symposium on Code Generation and Optimization, (224-235)
  10. ACM
    Zheng Y 1.x-Way architecture-implementation mapping Proceedings of the 33rd International Conference on Software Engineering, (1118-1121)
  11. Fertalj K and Brčic M An application generator based on UML specification Proceedings of the 8th conference on Applied computer scince, (379-384)
  12. ACM
    Arnoldus J, Bijpost J and van den Brand M Repleo Proceedings of the 6th international conference on Generative programming and component engineering, (25-32)
  13. Dunkel J and Bruns R Model-driven architecture for mobile applications Proceedings of the 10th international conference on Business information systems, (464-477)
  14. Jansen M and Girardi R GENMADEM Proceedings of the 9th international conference on Reuse of Off-the-Shelf Components, (399-402)
  15. Tobis M (2005). PyNSol, Computing in Science and Engineering, 7:4, (84-91), Online publication date: 1-Jul-2005.
  16. Berzal F, Cubero J, Marin N and Vila M (2005). Lazy Types, IEEE Software, 22:5, (98-106), Online publication date: 1-Sep-2005.
  17. Gruszczynski P, Osinski S and Swedrzynski A Offline business objects Proceedings of the 2005 OTM Confederated international conference on On the Move to Meaningful Internet Systems: CoopIS, COA, and ODBASE - Volume Part II, (960-977)
  18. Chivers H and Paige R XRound Proceedings of the First European conference on Model Driven Architecture: foundations and Applications, (205-219)
  19. Kolovos D, Paige R and Polack F An agile and extensible code generation framework Proceedings of the 6th international conference on Extreme Programming and Agile Processes in Software Engineering, (226-229)
  20. Krahn H and Rumpe B Techniques for lightweight generator refactoring Proceedings of the 2005 international conference on Generative and Transformational Techniques in Software Engineering, (437-446)
  21. ACM
    McCool M, Du Toit S, Popa T, Chan B and Moule K Shader algebra ACM SIGGRAPH 2004 Papers, (787-795)
  22. ACM
    McCool M, Du Toit S, Popa T, Chan B and Moule K (2004). Shader algebra, ACM Transactions on Graphics (TOG), 23:3, (787-795), Online publication date: 1-Aug-2004.
  23. ACM
    Wilson G (2004). Extensible Programming for the 21st Century, Queue, 2:9, (48-57), Online publication date: 1-Dec-2004.
Contributors

Index Terms

  1. Code Generation in Action

    Recommendations

    Reviews

    Fernando Berzal

    Code generation (CG) is the result of applying the old "work smarter, not harder" adage to software development. Even though wizards have used passive code generation for a long time, the adoption of active code generation has not yet become mainstream. Active code generators are responsible for the maintenance of the source code of (part of) your application: you do not modify the generator output; you tweak and refine its input, in order to produce your desired output, in a model-driven way. In fact, model-driven software development initiatives, such as the Object Management Group's (OMG's) Model Driven Architecture (MDA), make heavy use of code generators to raise the abstraction level in software development. This book reveals the fundamentals behind the design and implementation of code generators, instead of the particulars of existing commercial products. Reading it, you will learn how to build different kinds of generators, and many of their potential applications in common software development tasks, from database access layers to user interfaces. Basically, code generators can take source code or abstract definition files as input. JavaDoc-like documentation tools, and utilities to embed structured query language (SQL) into your source code, belong to the first category. They can save you a lot of time when used appropriately in repetitive tasks. The second category of code generation tools, those that take abstract definition files as input, are essential for model-driven software development, since they can be readily modified to target different programming platforms. The book does an excellent job of presenting the potential benefits of CG, and showing readers how to smooth CG adoption. Not only does it vividly illustrate the improvements CG can induce in source code consistency and maintainability (with a bit of hype, to be honest), but it also addresses the concerns other people may express when introducing code generation into an organization. Although the hypothetical case study at the beginning of the book smells like snake oil to all of us who know that there are no silver bullets, the author acknowledges that application generators are ongoing projects that require constant maintenance (and, hence, hidden costs he does not mention). The book also addresses the skills and tools you will need to make the most out of code generation. Herrington puts a special emphasis on the use of text templates, regular expressions, and language parsing tools. He also discusses the importance of testing code generators (a test utility is included), and the suitability of handwriting the code in the first place, in order to fully understand your framework before generating any code. As all of the books in Manning's "In Action" series are, this book is example-driven. You will find plenty of examples demonstrating the potential of code generation in a wide variety of development tasks. You will find almost anything, from simple pretty printers, header file generators, and small systems, to automatically building the glue code between subsystems, to complete tier generators that build a part of your applications. Obviously, EJBs are ideal for code generation, since they involve a lot of mechanical and repetitive work. CG is particularly suited for generating database access code, be it Java Database Connectivity (JDBC), ADO .NET, Perl database interface module (DBI), or PHP: hypertext preprocessor (PHP) extension and application repository (PEAR). As the author states, "If you generate only one section of code in your application, it should be the database code." Less repetitious tasks, however, are not as easily amenable to code generation. For instance, user interface development requires a higher level of sophistication, which is not present in the book examples. This might need a whole book of its own, actually. In any case, this book presents evidence of the likely benefits of code generation, even in this area, which requires modeling the users' workflow, breaking down the interface into different interaction models, and identifying exception cases that might need to be hand-coded (login forms, for instance). Some may argue that the author's selection of tools might not be appropriate for every developer. He has chosen Ruby, an object-oriented scripting language, to develop all of the examples in his book. The rationale to justify this decision is certainly biased, and does not offer concluding facts. However, the truth is that the examples throughout the book show how Ruby can be used for developing compact code snippets that clearly convey the author's intentions. This makes Ruby ideal for this book, even though it might not be the best option in a production environment. In the worst case, this book can also teach you a new programming language. After that, you can apply what you learn about code generation in your language of choice. An appendix provides the information you may need. Online Computing Reviews Service

    Access critical reviews of Computing literature here

    Become a reviewer for Computing Reviews.