« Python - when to use the in operator | Main | Tomcat - Shutdown port »

August 17, 2006

Build on what you already have with OO

If I start recalling a "Goons" sketch, then I'll show my age .... but never mind. It was a RERUN that I saw ;-)

Spike Milligan is counting votes at an election. "Two thousand, six hundred and forty two". "Two thousand, six hundred and forty three". "Two thousand, six hundred and forty four" ...

"Would you like a cup of tea" - a pleasant young gent walks up. "Thank you" says Spike. Sound effect - tea slurping.

"Two thousand, six hundred and .....". "Two thousand and .....". Pause. "One". "Two". "Three" ...

It's a classic, and we all laughed. And yet, when we're programming, it's so tempting to develop code from scratch - not to build on existing logic but to redevelop something that's already been redeveloped. And that's why the Object Oriented principle of inheritance is so brilliant and efficient. Taking one class defeinition, you define a new class ... not from scratch, but rather in terms of specifying only those things that are added or changed.

If Spike had jotted down the number he was at on a piece of paper, he could have carried on so easily after his cuppa. Of course, it wouldn't have been funny, but then programming isn't funny.

Posted by gje at August 17, 2006 08:29 AM

Comments

Post a comment




Remember Me?


Well House Consultants Ltd. Copyright 2008