python without OO

Nick Coghlan ncoghlan at iinet.net.au
Wed Jan 26 02:17:48 EST 2005


Davor wrote:
> thanks for the link
> 
> 
>>know what's funny: in the Lua mailing list there is currently a
>>discussion about adding OO to Lua.
> 
> 
> I guess most of these newer languages have no choice but to support OO
> if they want to attract a larger user base :-(...

Tell me, have you ever defined a C structure, and then written various functions 
to operate on that structure (i.e. taking a pointer to the structure as their
first argument)?

Have you then put both the structure definition and the function prototypes into 
a single header file and used that header file from other code?

That's OO programming: associating several pieces of information as an 'object', 
and associating various methods to operate on instances of those objects.

Everything else is optional.

Problems with OO design generally result from violations of the KISS principle, 
not from OO itself (although languages like Java and C++ make it hard to avoid 
violating KISS, since they make you jump through so many hoops to get anything 
to work at all). KISS (and the XP mantra "Do the simplest thing that could 
possibly work") are the best means to fight off overengineering, rather than a 
blanket ban on OO techniques.

Jeremy's "Bower's Law" page really does provide a good perspective on the 
benefits of judicious use of OO techniques 
(http://www.jerf.org/writings/bowersLaw.html).

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at email.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://boredomandlaziness.skystorm.net



More information about the Python-list mailing list