FlazX | Browse Computer Book | Community Board | Links | Blog | Login


Code Generation in Action



eBook Information




Code Generation in Action
ISBN  1930110979
Release Date  01 July 2003
Page  368
Category  Programming
This book @Amazon  View

Google Search
Google
Web flazx.com


Developers using code generation are producing higher quality code faster than their hand-coding counterparts. And, they enjoy other advantages like maintainability, consistency and abstraction. Using the new CG methods they can make a change in one place, avoiding multiple synchronized changes you must make by hand.

Code Generation in Action shows you the techniques of building and using programs to write other programs. It shows how to avoid repetition and error to produce consistent, high quality code, and how to maintain it more easily. It demonstrates code generators for user interfaces, database access, remote procedure access, and much more.

Code Generation in Action is an A-to-Z guide covering building, buying, deploying and using code generators. If you are a software engineer-whether beginner or advanced-eager to become the `ideas person,` the mover-and-shaker on your development team, you should learn CG techniques. This book will help you master them.

What's Inside: Code generation basics CG techniques and best practices Patterns of CG design How to deploy generators Many example generators Includes generators for: Database access RPC Unit tests Documentation Business logic Data translation Over his twenty years of development experience, Jack Herrington has shipped many software applications helped by code generation techniques. He runs the Code Generation Network.

User review
Useless
Two problems with this book:

1. The language -- Ruby -- is a strange choice. I've been writing and using code generators, in some form, for decades; I've used mmm,,. let's see: dBase, C, C++, awk, and perl, alone and/or in combination. These, I believe, are the more-or-less mainstream languages that could be appropriate as a platform for a book on code generation (and text processing in general). But Ruby? Life's short! One has to prioritize, ruthlessly sometimes: -- I don't know Ruby, I don't need Ruby, and don't want to waste my time on learning it just for the sake of reading this book. And, consider this: for every person knowing Ruby, there's gotta be at least a thousand knowing perl, so: Why Not Perl?

2. Code generation cases the author demonstrates are, w/o exception, way too primitive and inadequate for typical real-life needs (for example, in the unit-test section he generates tests for something like funcAdd( addend1, addend2 ) should be equal addend1+addend2; is that practical, useful? It's easy to test, yes, but that's not what we, the silent majority, tend to be writing -- and how do you generate unit tests for something more realistic? The author demonstrates solutions to far-fetched and unrealistically primitive cases, while skirting the real issue of unit-testing in a realistic context. Can you automate testing of anything more involved than 2+2 must be = 4? Studied silence on that, I still don't know, testing 2+2 does not lend itself to easy extention into higher semantic complexity,,,, so what use is this book?

Bottom line: Good topic; audacious promise; no delivery. Thumbs down, not recommended.

User review
Reader with another perspective
Prospective buyers that are discouraged by some of the negative reviews may be encouraged by a perspective I have gained from writing code that writes code:

--I find it usually does not matter as much how fast a code generation tool performs, but rather that the code it generates has good performance (with exceptions of course).

--Since I'm writing a tool to save time, and often for `internal` use, I tend to prefer using one or more simple, expressive languages for the job, and Ruby is one such language.

--Whether the book's examples suit real life situations is arguable and I don't care so much either way, but if you instead view the book as an opportunity to see more creative approaches to solving problems by writing tools to solve your problems, I find that mindset to be valuable.

User review
Excellent for Java Developers!
This is the first book I found that looked worth purchasing on the topic of Code Generation. I live and breathe in the Java World, and this particular subject is increasingly interesting when designing complex applications for long-term scalability and maintainablility.

The author presents this subject cleanly from very simple beginnings to more complex solutions that really made me rethink the subject and left me with a much clearer idea about how to proceed in the future. I am now looking very hard at Ruby! It's by my desk now until I can get it memorized!

User review
Poor choice of tools; code not very useful
I have been doing language parsing and generation in C for several years: English, French, Japanese, Chinese, Korean. Still, I hoped to learn something new from CGIA for Java. I was disappointed. I think the book misdirects the reader away from more effective solutions into less productive paths.

The book suffers from two problems. (1) the regular expression technology proposed is inappropriate (2) the exercises provided are not rich enough to be useful.

I have no objection to scripting languages. I have happily used bash, gawk, python/Jpython and php. I avoided perl because I was struck by its lack of readability and writability. Ruby is no better and no worse than many scripting languages, but the documentation and error messages leave very much to be desired. CGIA offers almost nothing in the way of real help with the language. It took me some time to figure out how to install the libraries properly and debugging was a nightmare! Ruby's regular expression language is yet another variation in the regex language Babel. This is not something I would foist on developers in my organization. Especially when there are much better alternatives.

For years I have been using lex (flex actually) in C for code generation and human language processing. (I have never had much use for YACC/Bison.) When I switched to Java, I found an excellent flex equivalent called JFlex (http://jflex.de/).
JFlex.jar is around 240K. The regular expression language for JFlex is extremely close to that of lex and gawk. It is much more readable and modular than that of ruby, perl, etc. Your Java programmers and maintainers need not learn a new language or download/install/configure an additional 28 MB of libraries. Even better, they can use JFlex in runtime production code, since it produces compiled FSA's which are orders of magnitude faster than an interpreted regex processor like ruby.

Additionally, you can get with lex/flex/JFlex full grammars for C++ and Java, not the superficial variable reader that came with CGIA. And the debugging mode, while not perfect, is quite usable. (There are commercial visual tools for debugging flex grammars, if you need and can afford them.)

From the code point of view, I found nothing usable in CGIA. In my judgment most of the examples were more suited to the classroom than to work, and the solutions presented were often not competitive with alternatives. On the theory/fundamentals side the book does not contribute much to the the understanding of language parsing or generation issues.

The arguments for using code generation are cogent. But if you want to use a more useful, popular, constantly evolving (but equally poorly documented) code generation system, go for XDoclet.

My recommendation: skip CGIA. Spend your time and money learning flex/JFlex for parsing and XDoclet for generating and you will be much better off. If you want theory, sink your teeth into something like the `Dragon` classic (Aho & Ullman).

User review
The Code Generation Bible
Essential reading for anyone interested in learning about code generation - written by one of the world's leading code generation gurus.







Resources
FlazX 100 Newest Books  Top 100 Search Keywords  Last 100 Search Keywords  Community Edition 


Google Talk : admin-at-flazx-dot-us


eXTReMe Tracker