Main Content
Build on what you already have with OO Archive - Originally posted on "The Horse's Mouth" - 2006-08-17 08:29:57 - Graham Ellis
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.
Some other articles
Y116 - Applying OO design techniques and best practise Defining an object that is a modified standard type in Python How to avoid too many recalculations within an object We not only teach PHP and Python - we teach good PHP and Python Practice! Really Simple Class and Inheritance example in Python Inheritance, Composition and Associated objects - when to use which - Python example Tips for writing a test program (Ruby / Python / Java) Plan your application before you start How do I set up a constant in Python? Testing code in Python - doctest, unittest and others Alpaca Case or Camel Case Good Programming practise - where to initialise variables Code quality counts This article Python - block insets help with documentation Think about your design even if you don't use full UML Code and code maintainance efficiency Q907 - Object Orientation: Design Techniques Associative objects - one object within another. Spike solution, refactoring into encapsulated object methods - good design practise The spirit of Java - delegating to classes Test driven development, and class design, from first principles (using C++) Using object orientation for non-physical objects Teaching OO - how to avoid lots of window switching early on Storing your intermediate data - what format should you you choose? Inheritance, Composition and Associated objects - when to use which - Python example From Structured to Object Oriented Programming. Rooms ready for guests - each time, every time, thanks to good system design When you should use Object Orientation even in a short program - Python example Spike solutions and refactoring - a Python example Why you should use objects even for short data manipulation programs in Ruby Designing your application - using UML techniques Your PHP website - how to factor and refactor to reduce growing pains Ruby - a training example that puts many language elements together to demonstrate the whole Object Oriented Programming for Structured Programmers - conversion training Comments in and on Perl - a case for extreme OO programming What is a factory method and why use one? - Example in Ruby Turning an exercise into the real thing with extreme programming Should Python classes each be in their own file? Program for reliability and efficiency - do not duplicate, but rather share and re-use Relationships between Java classes - inheritance, packaging and others The Light bulb moment when people see how Object Orientation works in real use Containment, Associative Objects, Inheritance, packages and modules What is a factory? The Multiple Inheritance Conundrum, interfaces and mixins Plan your application before you start Simples Object Oriented programming - a practical design example Planning! Designing a heirarcy of classes - getting inheritance right When should I use OO techniques? Teaching Object Oriented Java with Students and Ice Cream Object Oriented Tcl Object Oriented Programming in Perl - Course Object Relation Mapping (ORM) What are factory and singleton classes? Maintainable code - some positive advice This article Comparison of Object Oriented Philosophy - Python, Java, C++, Perl The Fag Packet Design Methodology Think about your design even if you don't use full UML Design - one name, one action Introduction to Object Oriented Programming Tapping in on resources OO - real benefits P704 - Managing Perl Projects Designing your data structures for a robust Perl application Converting to Perl - the sort of programs you will write Dont just convert to Perl - re-engineer! This article J715 - Putting the Java Language Together The spirit of Java - delegating to classes Learning to program - comments, documentation and test code Type checking, Java arrays and collections Good Programming practise - where to initialise variables This article H108 - Objects in PHP Associative objects - one object within another. Caching results in an object for efficiency - avoiding re-calculation Singleton design pattern - examples and uses Changing what operators do on objects - a comparison across different programming languages Object factories in C++, Python, PHP and Perl Learning about Object Orientation in PHP - a new set of examples stdClass in PHP - using an object rather than an associative array Objects in PHP - Revision Caching Design Patterns Copying, duplicating, cloning an object in PHP Autoload in PHP How do classes relate to each other? Associated Classes Design Patterns - what are they? Why use them? Designing your application - using UML techniques Computer Graphics in PHP - World (incoming data) to Pixel (screen) conversion Catchable fatal error in PHP ... How to catch, and alternative solutions such as JSON Private and Public - and things between Getting the OO design write - with PHP a example Does copying a variable duplicate the contents? PHP - Object Oriented Design in use What is a factory? The Multiple Inheritance Conundrum, interfaces and mixins Static class members in PHP - a documented example Object Oriented Programming in PHP Shipping a test harness with your class in PHP Serialization - storing and reloading objects Abstract classes, Interfaces, PHP and Java Object Oriented programming - a practical design example PHP4 v PHP5 - Object Model Difference Cleaning up redundant objects When should I use OO techniques? PHP - getclass v instanceof Introduction to Object Oriented Programming Sorting objects in PHP Calling base class constructors Accounts in PHP - an OO demo OO PHP demonstration - comparing objects and more What are factory and singleton classes? Object Oriented Model - a summary of changes from PHP4 to PHP5 Cue the music, I'm happy. This article Planning a hotel refurb - an example of a Gant chart in PHP Think about your design even if you don't use full UML North, Norther and Northest - PHP 5 Objects Don't repeat code - use loops or functions Should I use structured or object oriented? PHP5 lets you say no PHP v Java Object Oriented Programming in PHP C239 - Putting it all together When do I use the this keyword in C++? Test driven development, and class design, from first principles (using C++) Learning to program - comments, documentation and test code Reading files, and using factories to create vectors of objects from the data in C++ C++ - unknown array size, unknown object type. Help! Strings, Garbage Collection and Variable Scope in C++ Using C and C++ functions in the same program - how to do it Further C++ material - view new or old Make and makefiles - a commented example to help you learn Multiple Inheritance in C++ - a complete example Compile but do not run PHP - syntax check only Good Programming practise - where to initialise variables Code quality counts C++ - just beyond the basics. More you can do This article