On Thu, 2007-09-06 at 08:41 +0100, Martin Ritchie wrote:
> I was going to mention this early but it must have slipped my mind.
> 
> Just wondered why we are now using ruby to generate the framing?
> 
> Were the xslt, python or java approaches too complicated, inflexible
> or is ruby a better dependency to have?

Mea culpa, here's why I did it:

The pre-velocity java generator was too complicated and inflexible. Main
problems:
 - primitive templates required changing the generator itself for most
non-trivial changes to the generated code.  
 - ability to create "multi-version" classes, which is not required by C
++, made the generator extremely complex and difficult to modify.

I introduced the ruby generator because it was taking way to long to get
the Java generator to generate what I needed. I am confident that
writing the generator + creating new templates (and porting old ones)
took less time than trying to hack the Java generator to do the job.
Everyone who has used the new generator (i.e. Myself & Gordon) agrees
that it is a major improvement in productivity.

On ruby vs. python: there's probably no strong non-religious reason to
prefer one over the other. I use ruby because I had already done some
tinkering in ruby and I needed a solution quickly. I accept that python
might have been a better choice, if someone is willing to port the ruby
generator and templates to python I'll be happy to switch.

(Aside on multi-version: In C++ we will not generate multi-version
classes. Rather we will generate a single-version class for each version
and construct instances of the appropriate class family during
connection negotiation.)

> if indeed it is really work writing a
> generator in the first place. 
> The amount of effort we have expended in
> creating generators we must have been better just writing it by hand.

It is worth it when it saves time. I have no doubt that both the old
java generator and the new ruby generator have saved  us a lot of time
and will continue to do so. 

> The framing has only significantly changed once in the last year but
> we have had at least 4 generators!

The generators generate code from the XML classes/methods, not the
framing rules. They have changed rapidly and significantly over the last
year and I'm quite confident that we would have had a _much_ harder time
dealing with that if all the generated code was hand-written.

Cheers,
Alan.

Reply via email to