O'Reilly logo

Component Development for the Java™ Platform by Stuart Dabbs Halloway

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

7.2. Why Generate Code with Java?

Since the principles of generative programming apply to other languages as well, why use Java? One could argue that Java is not particularly well suited to code generation. After all, C++ has built-in support for code generation with macros and templates. Scripting languages like Perl are very good with string operations and might be better suited for writing generators. Despite these valid objections, Java is particularly suited to GP for five reasons:

  1. High quality type information acts as a valuable implicit specification document.

  2. Flexible class loading supports any combination of binding times and binding modes.

  3. Java source files are simple to read and generate.

  4. Java bytecode files are simple to read and generate. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required