OO design
Chris Smith
smitty_one_each at bigfoot.com
Tue Jul 19 06:56:17 EDT 2005
>>>>> "chris" == chris <cf_1957 at hotmail.com> writes:
chris> I have no problem writing bits of functional code to do any
chris> of the above. But for the life of me I can't see how I can
chris> hook them altogether in an OO based framework that I can
chris> build and extend (with more data formats, manipulations,
chris> GUI etc).
Chris,
I echo your sentiment.
My little pet project has recently grown to include a bit of an object
hierarchy. I've always felt that the Java-esque byzantine pedigree
for everything last class a trifle over-done.
What I used to trigger factorization was whether or not I needed to
branch based on data type:
if input_data.type == "this":
do_this()
else:
do_that()
meant I should factor my code to:
class input_data_base()
pass
class input_data_this(input_data_base)
pass
class input_data_that(input_data_base)
pass
With this, my project has a modest number of sensible inheritance
hierarchies (two) and the code that wouldn't benefit from such retains
its procedural character.
OO is a great organizer, but every paradigm runs afoul of Sturgeons
Law if over-driven.
HTH,
Chris
More information about the Python-list
mailing list