Hey John, On Tue, Sep 4, 2012 at 11:22 AM, John Napiorkowski <jjn1...@yahoo.com>wrote:
> I've done this a lot in the past, as well as a few other approaches. In > the end I've come to the conclusion that although off the top it seems like > a nice interface, it doesn't grow old well and can be confusing to people > trying to read your code. I now tend to think that a consuming class > should only build its objects when and if it needs some way to influence > how they are built. Otherwise over the long term you end up with a > confusing interface with a lot of stuff completely unrelated to the actual > functioning of the class. And it harder to test correctly. > So, instead of consuming a role that has a schema attribute AND attributes to support a _build_schema, use a separate class that builds a schema, and then constructs the original class and returns that? I'm not sure what a better approach could be, but lately I've been taking > the idea of having dedicated builder classes. I know that sounds heavy > handed, but at least it has the upside that my concerns are more carefully > separated. Are you returning an instance of the original class or an instance of the builder (sub) class? Do you have a simple example of your builder? Thanks, -- Bill Moseley mose...@hank.org