I've been programming for many years; I started off with languages like Fortran and quickly learned that it's a good idea to split the code into named chunks - which were known as FUNCTIONs and SUBROUTINEs. This means that parts of a program can be tested named chunk by named chunk, that chunks can be re-used, and can be shared between programs. And that's a good system for medium sized programs, but as they grow further (especially where a program has to cope with numerous similar data types), it begins to creak a bit, with lots of "if, elseif, elseif, elseif, else" type structures and large numbers of named blocks of code with similar names that will find the capacity of ... a sphere, a cube, a jug, a cup ... and woe betide you if you call the wrong named block of code in the wrong circumstances.
Of course, us "old programmers" are very much aware of these issues, and we design and code defensively to deal with them. But - for the larger programs, and for programs that handle lots of similar data types - there is a better approach. And that's Object Oriented programming. But it's a big step from "structured coding" to "Object Oriented Programming" and for the old hacks it means stepping back to school and learning new techniques. And the introduction to the new world of OO isn't helped by the most enormous heap of new jargon that's been introduced with it to represent some of the concepts and implementation elements.
One of the most rewarding single-day courses that we give is Object Oriented Programming in PHP
course - and it's so rewarding because we help some very
smart and very
experienced programmers make the crossing from structured coding to OO coding - something that many of them have struggled with for a very long time. Having - at one time - been a pure structured programmer myself, I have "been there" and I have "worn the T Shirt" so I know exactly the issues that need to be addressed, and we address them without initial reference to all the jargon that accompanies OO. After the initial session, we'll say "this is a class ... this is an object" so that delegates do leave with a good appreciation of the new lingo - but they've had it gently introduced to them, not rammed down their throats from the start.
Object Orientation is applicable in many languages these days. So when I got a request "can you help me pick up the principles of OO" general terms, I jumped at the opportunity. I chose Python as my main language of demonstration; experienced programmers can pick up the basics of variable, conditionals and loops very quickly, and the OO demonstrattions during the day can be neatly written in just one or two files (in contrast to the much higher number I would have used in a language such as C++)
Outcome of day? A great success!
Demonstrations from the day
... two types of thing and a list that contains a mixture of them ... [source]
... two types again, but this time sharing a whole lot of common logic rather than having it repeated ... [source]
... how to compare two things - which is 'greater'? ... [source]
... comparing whole lists of things - which is 'greatest'? ... [source]
I was also asked to write a program using the structured idiom [in Python] and convert it to an object oriented idiom. I kinda refused - it's NOT a question of converting, but of starting from the beginning, and designing the application differently. But I did let myself write the code twice - once each way.
The data is [here]
- it's railway stock on the British network, with diesel and electrical multiple units each listed carriage by carriage, individual locomotive hauled carriages listed one per line, and coaches for high speed trains done in the same way. Then there are some 'specials' - the flywheel powered cars on the Stourbridge Town line, and the Isle of Wight trains, which don't quite conform to standard rules. ((I do have the complete file if you come on the course - ALL the stock - but can't publish it here because of copyright issues!))
... the sample codes, structured ... [source]
... sample code, using an OO approach ... [source]
Object Oriented princiles REALLY need to be taught ... the examples above may show you a little, but you will learn 50 times more if you let me show you how these examples are written - the logic behind the logic. Please get in touch via our [help page] and we can set up a one-on-one day (for just a regular course price!) or come out on site if there's a large group of you.
The language I'll use won't necessarily be Python - if you know Perl already, we'll use that; for C programmers, we'll look at OO via C++, and so on.
Outline of the day
Prerequisites (which can be covered in an extra 90 minute session the previous evening for experienced programmers in other languages):
To know a little about in the target language ...
functions (definition and use)
Input and output
How to add comments to a program
How to run a program
On the day:
"Single Block, Structured, Object Oriented"
Then ... an explanation of OO, and of how you do a job in an OO way. The tutor will NOT start by using all these words that are part of the OO Jargon, but by the end of the day you'll see where each of them fits in.
Class, Object, Method
Properties or Attributes
Static and Dynamic
Muttable and Immutable
Subclasses, Base classes and Extended Classes
Overloading and overriding; Polymorphism
Public, Protected, Package, Private
Multiple Inheritance, Interfaces and Mixins
Transient and Serialisation
The demonstration will be done by taking some example data, and handling it using the approach of Object Orientation. A second demonstration will use a signifcant file of real data, showing the delegates how the principles demonstrated earlier make for real gains as the data volume and complexity increases, but you do not want to program to have a similar increase in its complexity.
Philosophy of OO Design
Unified Modelling Language
What makes a programming language OO?
Things from some other code that should not happen in OO:
"What is this"
Wrong sort of operation / wrong sort of data
Cardinal Values (written 2010-12-14, updated 2010-12-15)
Associated topics are indexed underQ907 - Object Orientation and General technical topics - Object Orientation: Design Techniques 
Teaching OO - how to avoid lots of window switching early on - (2013-01-17) 
Storing your intermediate data - what format should you you choose? - (2012-11-20) 
Inheritance, Composition and Associated objects - when to use which - Python example - (2012-10-10) 
From Structured to Object Oriented Programming. - (2012-10-02) 
Rooms ready for guests - each time, every time, thanks to good system design - (2012-08-20) 
When you should use Object Orientation even in a short program - Python example - (2012-07-06) 
Spike solutions and refactoring - a Python example - (2012-06-13) 
Why you should use objects even for short data manipulation programs in Ruby - (2012-06-10) 
Designing your application - using UML techniques - (2012-02-11) 
Your PHP website - how to factor and refactor to reduce growing pains - (2011-09-24) 
Ruby - a training example that puts many language elements together to demonstrate the whole - (2011-04-23) 
Comments in and on Perl - a case for extreme OO programming - (2010-11-21) 
What is a factory method and why use one? - Example in Ruby - (2010-09-30) 
Turning an exercise into the real thing with extreme programming - (2010-09-11) 
Should Python classes each be in their own file? - (2010-07-27) 
Program for reliability and efficiency - do not duplicate, but rather share and re-use - (2010-07-19) 
Relationships between Java classes - inheritance, packaging and others - (2010-07-10) 
The Light bulb moment when people see how Object Orientation works in real use - (2010-05-28) 
Containment, Associative Objects, Inheritance, packages and modules - (2010-04-30) 
What is a factory? - (2010-04-26) 
The Multiple Inheritance Conundrum, interfaces and mixins - (2010-04-11) 
Plan your application before you start - (2009-12-02) 
Simples - (2009-11-12) 
Object Oriented programming - a practical design example - (2009-08-27) 
Planning! - (2009-08-08) 
Designing a heirarcy of classes - getting inheritance right - (2009-05-11) 
When should I use OO techniques? - (2009-05-11) 
Teaching Object Oriented Java with Students and Ice Cream - (2008-02-12) 
Object Oriented Tcl - (2008-02-02) 
Object Oriented Programming in Perl - Course - (2007-11-18) 
Object Relation Mapping (ORM) - (2007-06-09) 
What are factory and singleton classes? - (2007-06-04) 
Maintainable code - some positive advice - (2007-01-21) 
Build on what you already have with OO - (2006-08-17) 
Comparison of Object Oriented Philosophy - Python, Java, C++, Perl - (2006-08-13) 
The Fag Packet Design Methodology - (2006-06-06) 
Think about your design even if you don't use full UML - (2006-03-24) 
Design - one name, one action - (2005-12-19) 
Introduction to Object Oriented Programming - (2005-11-27) 
Tapping in on resources - (2005-03-05) 
OO - real benefits - (2004-10-09)Y106 - Object Oriented Python 
Really Simple Class and Inheritance example in Python - (2013-03-04) 
Spike solution, refactored and reusable, Python - Example - (2013-02-28) 
this or self - what are they, and what is the difference? (Python) - (2012-12-08) 
Object oriented or structured - a comparison in Python. Also writing clean regular expressions - (2012-03-26) 
Moving from scripting to Object Orientation in Python - (2011-09-13) 
From fish, loaves and apples to money, plastic cards and BACS (Perl references explained) - (2011-08-20) 
Tips for writing a test program (Ruby / Python / Java) - (2010-01-29) 
Python - a truly dynamic language - (2009-01-30) 
Introduction to Object Oriented Programming - (2008-12-06) 
Screw it or Glue it? Access to Object variables - a warning - (2007-09-12) 
Python class rattling around - (2007-08-16) 
Python - function v method - (2006-10-20) 
Python makes University Challenge - (2006-08-15) 
Class, static and unbound variables - (2005-10-25)A401 - Web Application Deployment - Structured Code and Object Orientation 
Q - Should I use Perl or Python? - (2008-07-23) 
Should I use structured or object oriented? - (2005-06-10)
Some other Articles
Python regular expressions - repeating, splitting, lookahead and lookbehindMelksham - two many councils?Making the most of critical emails - reading behind the sceneSizers (geometry control) in a wxPython GUI - a first exampleObject Oriented Programming for Structured Programmers - conversion trainingCan you trust the big brand names? Python - fresh examples from recent coursesXML handling in Python - SAX, DOM and XSLT exampleswxPython - simple example to add GUI to a server log file analysisSanta Special - rather more special than usual - December 2010