|
Code Generation in Action Jack Herrington 2003 | 350 pages ISBN: 1930110979 |
|||
![]() |
$22.50 | PDF ebook | |
![]() |
$44.95 | Softbound print book | |
Table of Contents
Contents
preface
acknowledgments
about this book
about the title
about the cover illustration
Part I Code generation fundamentals
- Chapter 1 Overview
- 1.1 A generation case study
- Step 1: generating the database access layer — Step 2: generating the user interface — Step 3: building the client interface — Step 4: building unit tests — Step 5: integrating a technical change — Step 6: integrating a design change — Step 7: building an RPC layer — Step 8: building documentation — Case study conclusions
- 1.2 Benefits of code generation for engineers1
- 1.3 Benefits of code generation for managers
- 1.4 The code generation process
- Assessing the need — Laying down the infrastructure — Documenting it — Deploying it — Maintaining it
- 1.5 The buy/build decision
- 1.6 Code generation at its best
- 1.7 Top ten code-generation rules
- 1.8 Generators you are using today
- 1.9 Summary
- Chapter 2 Code generation basics
- 2.1 The various forms of active code generation
- Code munging — The inline-code expander — Mixed-code generation — Partial-class generation — Tier or layer generation — Full-domain language
- 2.2 Code generation workflow
- Editing generated code
- 2.3 Code generation concerns
- Nobody on my team will accept a generator — Engineers will ignore the “do not edit” comments — If the generator can’t build it, the feature will take weeks to build
- 2.4 Code generation skills
- Using text templates — Writing regular expressions — Parsing XML — File and directory handling — Command-line handling
- 2.5 Choosing a language for your code generator
- Comparing code generator languages — Using Ruby to write code generators
- 2.6 Summary
- Chapter 3 Code generation tools
- 3.1 Building generators with Ruby
- 3.2 Parsing XML with Rexml
- Using Rexml
- 3.3 ERb: a great tool for templates
- Installing and using ERb — ERb templates — Building ASP, JSP, etc. with ERb
- 3.4 Building the language parser toolkit
- Inside the Tokenizers — Inside the LanguageScanners — Language parsing tools
- 3.5 Summary
- Chapter 4 Building simple generators
- 4.1 The code munger generator type
- Uses and example code — Developing the generator
- 4.2 The inline-code expansion generator model Uses and examples
- Developing the generator
- 4.3 The mixed-code generator model
- Uses and examples — Developing the generator
- 4.4 The partial-class generator mode
- Uses and examples — Developing the generator
- 4.5 The tier generator model
- Uses and examples — Developing the generator
- 4.6 Generating for various languages
- C — C++ — C# — Java — Perl — SQL
- 4.7 Summary96
Part II Code generation solutions
- Chapter 5 Generating user interfaces
- 5.1 The big picture
- Why generate the user interface? — Integration with existing tools and other generators
- 5.2 Designing a good interface
- 5.3 Workflow comparison
- 5.4 A case study: generating JSP
- Why generate JSPs? — The role of the generator — The high-level architecture — A table definition file — A form definition file — Processing flow — Designing the generator
- 5.5 Technique: generating Swing dialog boxes
- Generator requirements — Architectural recommendation — Processing flow
- 5.6 Technique: generating MFC dialog boxes
- Generator requirements — Recommended tier generator architecture — Processing flow — Recommended mixed-code generation architecture — Processing flow
- 5.7 Design tips
- 5.8 Tools for generating UIs
- 5.9 Summary
- Chapter 6 Generating documentation
- 6.1 The importance of structured comments
- 6.2 The big picture
- 6.3 A case study: augmented SQL code
- Roles of the generator — Laying out the generator architecture — Processing flow — Building the code for the SQL generator — Performing system tests
- 6.4 Understanding the JavaDoc and the Doclet API
- 6.5 Finding a tool to do it for you
- 6.6 Summary
- Chapter 7 Generating unit tests
- 7.1 The big picture
- 7.2 Preparing for common concerns
- Unit tests won’t be maintained — It’s too hard to make unit tests — Unit tests will limit our flexibility — The interface isn’t ready yet — Unit tests are not worth the time — Adding unit tests to a legacy system is painful — Unit tests can only prove the existence of errors
- 7.3 A case study: augmented C code
- Roles of the generator — Laying out the generator architecture — Processing flow — Building the code for the unit test generator — Finding tools for test cases
- 7.4 Technique: the ordered test generator
- Roles of the generator — Laying out the generator architecture — Processing flow
- 7.5 Technique: the test data generator
- Roles of the generator — Laying out the generator architecture — Processing flow — Using the test data generator and the sequential test generator together
- 7.6 Technique: the test robot generator
- Roles of the generator — Laying out the generator architecture — Processing flow — Generators for robots
- 7.7 Finding a tool to do it for you
- 7.8 Design tips
- 7.9 Summary
- Chapter 8 Embedding SQL with generators
- 8.1 PerlSQL
- 8.2 Preparing for common concerns
- We are creating a new language — Debugging will be a pain — With Perl you could do this within the language
- 8.3 Workflow comparison
- 8.4 A case study: PerlSQL
- Roles of the generator — Laying out the generator architecture — Processing flow — Building the code for the PerlSQL generator — Performing system tests
- 8.5 Finding SQL tools
- 8.6 Summary
- Chapter 9 Handling data
- 9.1 Code generation versus a library
- 9.2 A case study: a simple CSV-reading example
- Roles of the generator — Laying out the generator architecture — Processing flow — Building the code for the CSV reader generator — Performing system tests
- 9.3 Technique: data adapters
- Roles of the generator — Laying out the generator architecture — Processing flow
- 9.4 Technique: binary file reader/writer
- Roles of the generator — Laying out the generator architecture — Implementation recommendations — Processing flow
- 9.5 Finding tools to do it for you
- 9.6 Summary
- Chapter 10 Creating database access generators
- 10.1 Benefits of database access generators
- 10.2 The big picture
- Terminology — Integration with existing tools — Working with other generators
- 10.3 Preparing for common concerns
- The code is going to be out of control — I’m going to be the only one who knows what’s going on — Our application semantics aren’t well defined yet — This is going to take all the joy out of coding — The database design is too complex to be generated — The generated SQL SELECT statements will be rubbish — The up-front development cost is too high — I don’t have all of the prerequisite skills — The information here is centered around web applications; what about client/server? — My application doesn’t use a database
- 10.4 Workflow comparison
- 10.5 A case study: EJB generation
- The architecture of the EJB database access layer — EJB options — The schema — Roles of the generator — Laying out the generator architecture — Processing flow — The schema definition — The extensions definition file — Sample data definition — Implementation — Performing system tests — J2EE developer resources — Generators for J2EE
- 10.6 Technique: generating JDBC
- Roles of the generator — Laying out the generator architecture — Processing flow — JDBC developer resources
- 10.7 Technique: generating database access layers for ASP
- Roles of the generator — Laying out the generator architecture — Processing flow — ASP developer resources
- 10.8 Technique: generating database access layers for ASP.NET
- Roles of the generator — Recommended architecture — Laying out the generator architecture — Processing flow — ASP.NET developer resources — Generators for .NET
- 10.9 Technique: Generating database access classes for Perl DBI
- Roles of the generator — Laying out the generator architecture — Processing flow — Perl/DBI developer resources
- 10.10 Technique: generating database access classes for PHP
- Roles of the generator — Laying out the generator architecture — Processing flow — Generators for PHP — PHP developer resources
- 10.11 Off-the-shelf: AndroMDA
- Roles of the generator — Laying out the generator architecture — Developer resources
- 10.12 Off-the-shelf: XDoclet
- Roles of the generator — Laying out the generator architecture
- 10.13 Design tips
- 10.14 Finding a tool to do it for you
- 10.15 Summary
- Chapter 11 Generating web services layers
- 11.1 The big picture
- Providing security and authentication — Why not use a library?
- 11.2 A case study: generating XML-RPC for Java
- The XML-RPC message flow — Roles of the generator — Laying out the generator architecture — Processing flow — Building the code for the XML-RPC generator — Performing system tests — XML-RPC resources
- 11.3 Technique: generating SOAP
- Roles of the generator — Laying out the generator architecture — Processing flow — SOAP resources
- 11.4 Design tips
- 11.5 Finding a tool to do it for you
- 11.6 Summary
- Chapter 12 Generating business logic
- 12.1 A case study: generating Java business equations
- Roles of the generator — Laying out the generator architecture — Processing flow — Building the code for the equation generator — Performing system tests
- 12.2 A case study: the report logic and interface generator
- Roles of the generator — Laying out the generator architecture — Processing flow — A report logic and interface generator alternative — Report logic generation tools
- 12.3 Summary
- Chapter 13 More generator ideas
- 13.1 Technique: maintaining header files
- Roles of the generator — Laying out the generator architecture — Processing flow — Processing flow
- 13.2 Technique: creating DLL wrappers
- Roles of the generator — Laying out the generator architecture — Processing flow
- 13.3 Technique: creating wrappers for external languages
- Roles of the generator — Laying out the generator architecture — Processing flow
- 13.4 Technique: creating firewall configurations
- Roles of the generator — Laying out the generator architecture — Processing flow
- 13.5 Technique: creating lookup functions
- Roles of the generator — Laying out the generator architecture — Processing flow
- 13.6 Technique: creating macro lookup tables
- Feeding code to the generator — Roles of the generator — Laying out the generator architecture — Processing flow
- 13.7 Summary
- Code generation models
- Practical examples of database access generation
- Architectures for generators for all of today's popular technologies
- Insight into deployment issues
- Senior engineers looking for ways to improve their productivity and the quality of their work.
- Systems architects who want to maintain their design decisions in abstract form and then generate code to match the design.
- Product Managers and Project Managers who wish to understand the desing principles and cultural benefits of code generation techniques
appendix a A brief introduction to Ruby
appendix b The simple system test framework
appendix c EJBGen code and templates
appendix d Integrating code generation into your IDE
appendix e Simple templating
appendix f Patterns for regular expressions
index
DESCRIPTION
Code Generation In Action covers technique and implementation for building high-quality machine-generated code for today's complex applications frameworks. The book includes step-by-step instruction for building dozens of code generators of varying types. These generators build high-quality output that is consistent and maintainable. Code generation abstracts the design of the code so that multiple outputs can be created from a single model of the application functionality, which means development teams can focus on higher-level design work and strategic problems, while still meeting goals for maintaining production applications.. The book covers techniques that range from simple code processors that handle common coding problems to more elaborate and complex generators that maintain entire application tiers.Code Generation In Action covers building database access, user interface, remote procedure, test cases, and business logic code as well as code for other key system functions.
Although code generation is an engineering technique it also has a large impact on the engineering team and management. The book discusses the non-technical justifications for code generation in depth, and offers practical advice for making code generation succeed in any organization.
What's Inside:
Who can benefit from this book:
Direct examples are provided on a variety of platforms. These include Java/J2EE, Microsoft¹s ASP and ASP.NET, as well as Open Source solutions such as Perl, Python and PHP.
The support site for the book, the Code Generation Network is already open for business with articles and interviews on code generation topics.
WHAT THE READERS SAY ABOUT THIS BOOK...
"...an excellent book if you are developing code generation tools, are
interested in code generation, or are skeptical about code generation....fascinating and
easy to read and understand... I can definitely see where I can use the ideas in my
day to day development and design tasks.
-- A reader at Amazon.com
"...will prove itself an excellent and motivating guide, compass, and even
dictionary, allowing software engineers, software architects, and managers
to get the best value out of code generation techniques..."
-- A reader

