This post originated from an RSS feed registered with Java Buzz
by Chris Winters.
Original Post: Partial classes and code generation
Feed Title: cwinters.com
Feed URL: http://www.cwinters.com/search/registrar.php?domain=jroller.com®istrar=sedopark
Feed Description: Chris Winters on Java, programming and technology, usually in that order.
Ted Neward has an intriguing post about "partial" classes in C#. Splitting a class into multiple files is a fantastic idea because it gets around one of the main problems with code generation systems -- how to modify or add to the generated code. My non-optimal solution has been to create an abstract parent of the generated class and implement the custom functionality there, and at gentime the code generator looks for a class conforming to a naming convention and if its found, subclases it. This gets around the necessity of the instantiator of the class needing to know if it's customized, but it's still a bit ugly. I could (and probably will eventually) get around this with a factory, a more decoupled solution. But there you are...