News for hackers. Stuff that matters.
Re:Fear and Loathing in Programming La La Land (2012) by estebank on Monday July 15, 2013 @06:11PM (#6048876)
> Also, any api/library that lets you create an object that is > unusable because specific methods to set up values haven't > been called yet is very error prone.

That's what the Builder pattern[1] is for, avoiding the instantiation of incomplete objects.

I've thought about the appropriateness of that pattern to Python, and so far what I've come up with is merely to use optional named parameters for private/simple classes and Builder classes for public/brittle/robust classes/APIs.

[1]: http://en.wikipedia.org/wiki/Builder_pattern

There are no comments on this comment yet.