Code Generation in Action

Free Download

Authors:

Edition: Revised

ISBN: 9781930110977, 1930110979

Size: 14 MB (15049175 bytes)

Pages: 372/372

File format:

Language:

Publishing Year:

Category:

Jack Herrington9781930110977, 1930110979

This book shows how to use code generation (CG) to reduce programming repetition and error, and increase consistency and maintainability when writing in any computer language. Targeting both beginner and advanced programmers, the book demonstrates how to build and use programs to write other programs, offering example code generators for user interfaces, database access, remote procedure access, business logic, data translation, documentation, and unit testing. Herrington, a software developer, covers CG techniques and best practices, patterns of CG design, and how to deploy generators. Though the text centers on Java, it provides information for Perl, Python, C, and C++.

Table of contents :
13 More generator ideas264……Page 10
Code generation fundamentals……Page 30
Overview……Page 32
1.1 A generation case study……Page 33
1.2 Benefits of code generation for engineers……Page 44
1.3 Benefits of code generation for managers……Page 45
1.4 The code generation process……Page 46
1.5 The buy/build decision……Page 52
1.7 Top ten code-generation rules……Page 54
1.9 Summary……Page 56
Code generation basics……Page 57
2.1 The various forms of active code generation……Page 58
2.2 Code generation workflow……Page 63
2.3 Code generation concerns……Page 64
2.4 Code generation skills……Page 67
2.5 Choosing a language for your code generator……Page 69
2.6 Summary……Page 71
3.1 Building generators with Ruby……Page 72
3.2 Parsing XML with Rexml……Page 73
3.3 ERb: a great tool for templates……Page 75
3.4 Building the language parser toolkit……Page 78
3.5 Summary……Page 89
Building simple generators……Page 90
4.1 The code munger generator type……Page 91
4.2 The inline-code expansion generator model……Page 107
4.3 The mixed-code generator model……Page 111
4.4 The partial-class generator model……Page 116
4.5 The tier generator model……Page 119
4.6 Generating for various languages……Page 123
4.7 Summary……Page 125
Code generation solutions……Page 126
Generating user interfaces……Page 128
5.1 The big picture……Page 129
5.2 Designing a good interface……Page 131
5.4 A case study: generating JSP……Page 134
5.5 Technique: generating Swing dialog boxes……Page 148
5.6 Technique: generating MFC dialog boxes……Page 150
5.7 Design tips……Page 154
5.9 Summary……Page 155
Generating documentation……Page 156
6.1 The importance of structured comments……Page 157
6.3 A case study: augmented SQL code……Page 158
6.5 Finding a tool to do it for you……Page 166
6.6 Summary……Page 167
Generating unit tests……Page 168
7.1 The big picture……Page 169
7.2 Preparing for common concerns……Page 170
7.3 A case study: augmented C code……Page 172
7.4 Technique: the ordered test generator……Page 179
7.5 Technique: the test data generator……Page 181
7.6 Technique: the test robot generator……Page 183
7.7 Finding a tool to do it for you……Page 186
7.9 Summary……Page 187
Embedding SQL with generators……Page 188
8.1 PerlSQL……Page 189
8.2 Preparing for common concerns……Page 190
8.4 A case study: PerlSQL……Page 191
8.6 Summary……Page 200
9.1 Code generation versus a library……Page 201
9.2 A case study: a simple CSV-reading example……Page 202
9.3 Technique: data adapters……Page 215
9.4 Technique: binary file reader/writer……Page 216
9.6 Summary……Page 218
Creating database access generators……Page 219
10.1 Benefits of database access generators……Page 220
10.2 The big picture……Page 221
10.3 Preparing for common concerns……Page 224
10.4 Workflow comparison……Page 227
10.5 A case study: EJB generation……Page 228
10.6 Technique: generating JDBC……Page 241
10.7 Technique: generating database access layers for ASP……Page 244
10.8 Technique: generating database access layers for ASP.NET……Page 247
10.9 Technique: Generating database access classes for Perl DBI……Page 249
10.10 Technique: generating database access classes for PHP……Page 252
10.11 Off-the-shelf: AndroMDA……Page 255
10.12 Off-the-shelf: XDoclet……Page 256
10.13 Design tips……Page 257
10.15 Summary……Page 258
11.1 The big picture……Page 259
11.2 A case study: generating XML-RPC for Java……Page 262
11.3 Technique: generating SOAP……Page 277
11.4 Design tips……Page 278
11.6 Summary……Page 279
12.1 A case study: generating Java business equations……Page 280
12.2 A case study: the report logic and interface generator……Page 289
12.3 Summary……Page 292
13.1 Technique: maintaining header files……Page 293
13.2 Technique: creating DLL wrappers……Page 295
13.3 Technique: creating wrappers for external languages……Page 297
13.4 Technique: creating firewall configurations……Page 298
13.5 Technique: creating lookup functions……Page 300
13.6 Technique: creating macro lookup tables……Page 302
13.7 Summary……Page 304
A brief introduction to Ruby……Page 306
A.1 Ruby fundamentals……Page 307
A.2 An advanced Ruby primer……Page 312
A.3 Learning more about Ruby……Page 314
B.1 The basic design……Page 315
C.1 The generator code……Page 320
C.2 The entity templates……Page 332
C.3 The JSP templates……Page 337
C.4 The deployment descriptor templates……Page 339
C.5 The SQL template……Page 340
D.1 Integration methods……Page 343
D.2 MSDEV from Microsoft……Page 346
D.3 Eclipse from IBM……Page 348
D.5 Komodo from ActiveState……Page 349
D.7 Emacs……Page 351
E.1 String formatting……Page 352
E.2 Regular expression templates……Page 353
F.1 The examples……Page 354

Reviews

There are no reviews yet.

Be the first to review “Code Generation in Action”
Shopping Cart
Scroll to Top