From: Bob Calco Date: 2002-05-27T14:20:59+09:00 Subject: RE: using test::unit for C++ unit tests % % Bob, % % RuGen sounds really interesting and potentially useful. So let me see if % I understand correctly: you could write some Ruby classes/code % which would % act as an executable spec and then at some point you could translate the % Ruby classes into C++ classes and testcases. If I'm understanding % correctly, this would be a great way to prototype C++ code using Ruby. You do understand correctly. Except it isn't limited to C++, and the point is that by merely specifying another generator, you can have the same design applied (at least in skeletal form) to another language, making it possible to re-implement the same design in a completely different language by changing a single variable in the "spec". :) % So how will you specify types for the C++ side? Ah, that is the kicker. The problem doesn't stop with just types, but also extends to things like standard libraries, framework libraries, and GUI toolkits. The key is to find the right level of abstraction and a "least common denominator" spec, and then let each generator engine specify those things unique to its language, platform, etc, in a more or less standard way. There will be tradeoffs: I don't anticipate being able to cleanly generate partial template specialization or anything from the Alexandrescu book on modern C++ design, at least not in release 1.0. ;) However that isn't to say that the code generated cannot reasonably "depend" upon some custom C++ library (mirrored in Java or any other language) so that the commonalities for advanced code generation can be maximized. That is to say: Some C++ library has to be in place to make various assumptions about the code to be generated easily replicatable by implementing an analogous library in some other target language when somebody wants to port RuGen to that language. Did that make any sense? It places higher demand on the generator-implementor, but hey, somebody's got to write some "real code". ;) If I can just get a basic engine that shows how you can gen a non-trivial Java and a C++ solution from the same spec, with reasonably complete functionality, I'll be happy for starters. The problem has been tackled successfully before: CA's COOL:Gen lets you take the same data model and generate a complete client-server solution with the click of a button in 4 or 5 different languages. The code it gens is really ugly, not at all OO, but it works. It also costs hundreds of thousands of dollars. Rational Rose also does something like this with UML, and it goes for $5K a pop in the Enterprise Edition. RuGen is a little different because it isn't tied to client-server relational database design, as COOL:Gen (now Advantage Gen, technically) is, and it isn't tied to some particular GUI tool, as Rose is. Imagine Ruby as an alternative to UML for design, where the "model" is really a collection of Ruby classes - not prototypes, but real design specs - that really do create both the code and the tests that prove the code works as designed. That's the Vision Thing, anyway. In the short term, I'll be happy just proving that the concept can be implemented - in Ruby. % % Any idea when we might see the inital release of RuGen? In about a month or so. The final, official first release however will probably not be ready until the book is released, only because it will take me that long to get it done. ;) -- Bob. % % Phil %