Women in Technology

Hear us Roar



Article:
  Code-Generation Techniques for Java
Subject:   Subclass the business logic
Date:   2003-09-11 06:02:34
From:   anonymous2
One way to allow for regeneration of code without losing any hand-coding already accomplished is through the use of subclassing. Torque (a DAO layer from apache: http://db.apache.org/torque) generates data access classes off of an XML schema; the resulting "bean" class has two parts - a base class and an empty shell subclass. Developers are encouraged to add methods to the subclass, which is then not overwritten in any subsequent regeneration. I've found it to be quite a useful technique for mixing generated and hand-coded logic.