Home Accessibility Courses Twitter The Mouth Facebook Resources Site Map About Us Contact
For 2023 (and 2024 ...) - we are now fully retired from IT training.
We have made many, many friends over 25 years of teaching about Python, Tcl, Perl, PHP, Lua, Java, C and C++ - and MySQL, Linux and Solaris/SunOS too. Our training notes are now very much out of date, but due to upward compatability most of our examples remain operational and even relevant ad you are welcome to make us if them "as seen" and at your own risk.

Lisa and I (Graham) now live in what was our training centre in Melksham - happy to meet with former delegates here - but do check ahead before coming round. We are far from inactive - rather, enjoying the times that we are retired but still healthy enough in mind and body to be active!

I am also active in many other area and still look after a lot of web sites - you can find an index ((here))
Object Oriented Programming for Structured Programmers - conversion training

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
Constructor, Destructor
Properties or Attributes
Static and Dynamic
Muttable and Immutable
Associated Objects
Subclasses, Base classes and Extended Classes
Overloading and overriding; Polymorphism
Overloading Operators
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
Design Patterns
Singleton Pattern
Factory Methods
Unified Modelling Language
Extreme Programming

What makes a programming language OO?

Things from some other code that should not happen in OO:

"What is this"
Direct access
Wrong sort of operation / wrong sort of data
Repeated code
Cardinal Values
(written 2010-12-14, updated 2010-12-15)

Associated topics are indexed as below, or enter http://melksh.am/nnnn for individual articles
Y106 - Object Oriented Python
  [477] Class, static and unbound variables - (2005-10-25)
  [834] Python makes University Challenge - (2006-08-15)
  [900] Python - function v method - (2006-10-20)
  [1306] Python class rattling around - (2007-08-16)
  [1348] Screw it or Glue it? Access to Object variables - a warning - (2007-09-12)
  [1925] Introduction to Object Oriented Programming - (2008-12-06)
  [2017] Python - a truly dynamic language - (2009-01-30)
  [2169] When should I use OO techniques? - (2009-05-11)
  [2604] Tips for writing a test program (Ruby / Python / Java) - (2010-01-29)
  [3399] From fish, loaves and apples to money, plastic cards and BACS (Perl references explained) - (2011-08-20)
  [3436] Moving from scripting to Object Orientation in Python - (2011-09-13)
  [3673] Object oriented or structured - a comparison in Python. Also writing clean regular expressions - (2012-03-26)
  [3878] From Structured to Object Oriented Programming. - (2012-10-02)
  [3947] this or self - what are they, and what is the difference? (Python) - (2012-12-08)
  [4021] Spike solution, refactored and reusable, Python - Example - (2013-02-28)
  [4028] Really Simple Class and Inheritance example in Python - (2013-03-04)
  [4129] Simple OO demonstration in C++, comparison to Python - (2013-07-01)
  [4448] What is the difference between a function and a method? - (2015-03-04)
  [4591] From single block to structure and object oriented programming - (2015-12-02)
  [4650] Why populate object with values as you construct them? - (2016-02-18)
  [4721] When to check an object type - Python isinstance example - (2016-11-03)

Q907 - Object Orientation and General technical topics - Object Orientation: Design Techniques
  [80] OO - real benefits - (2004-10-09)
  [236] Tapping in on resources - (2005-03-05)
  [507] Introduction to Object Oriented Programming - (2005-11-27)
  [534] Design - one name, one action - (2005-12-19)
  [656] Think about your design even if you don't use full UML - (2006-03-24)
  [747] The Fag Packet Design Methodology - (2006-06-06)
  [831] Comparison of Object Oriented Philosophy - Python, Java, C++, Perl - (2006-08-13)
  [836] Build on what you already have with OO - (2006-08-17)
  [1047] Maintainable code - some positive advice - (2007-01-21)
  [1217] What are factory and singleton classes? - (2007-06-04)
  [1224] Object Relation Mapping (ORM) - (2007-06-09)
  [1435] Object Oriented Programming in Perl - Course - (2007-11-18)
  [1528] Object Oriented Tcl - (2008-02-02)
  [1538] Teaching Object Oriented Java with Students and Ice Cream - (2008-02-12)
  [2170] Designing a heirarcy of classes - getting inheritance right - (2009-05-11)
  [2327] Planning! - (2009-08-08)
  [2380] Object Oriented programming - a practical design example - (2009-08-27)
  [2501] Simples - (2009-11-12)
  [2523] Plan your application before you start - (2009-12-02)
  [2717] The Multiple Inheritance Conundrum, interfaces and mixins - (2010-04-11)
  [2741] What is a factory? - (2010-04-26)
  [2747] Containment, Associative Objects, Inheritance, packages and modules - (2010-04-30)
  [2785] The Light bulb moment when people see how Object Orientation works in real use - (2010-05-28)
  [2865] Relationships between Java classes - inheritance, packaging and others - (2010-07-10)
  [2878] Program for reliability and efficiency - do not duplicate, but rather share and re-use - (2010-07-19)
  [2889] Should Python classes each be in their own file? - (2010-07-27)
  [2953] Turning an exercise into the real thing with extreme programming - (2010-09-11)
  [2977] What is a factory method and why use one? - Example in Ruby - (2010-09-30)
  [3063] Comments in and on Perl - a case for extreme OO programming - (2010-11-21)
  [3260] Ruby - a training example that puts many language elements together to demonstrate the whole - (2011-04-23)
  [3454] Your PHP website - how to factor and refactor to reduce growing pains - (2011-09-24)
  [3607] Designing your application - using UML techniques - (2012-02-11)
  [3760] Why you should use objects even for short data manipulation programs in Ruby - (2012-06-10)
  [3763] Spike solutions and refactoring - a Python example - (2012-06-13)
  [3798] When you should use Object Orientation even in a short program - Python example - (2012-07-06)
  [3844] Rooms ready for guests - each time, every time, thanks to good system design - (2012-08-20)
  [3887] Inheritance, Composition and Associated objects - when to use which - Python example - (2012-10-10)
  [3928] Storing your intermediate data - what format should you you choose? - (2012-11-20)
  [3978] Teaching OO - how to avoid lots of window switching early on - (2013-01-17)
  [4098] Using object orientation for non-physical objects - (2013-05-22)
  [4374] Test driven development, and class design, from first principles (using C++) - (2014-12-30)
  [4430] The spirit of Java - delegating to classes - (2015-02-18)
  [4449] Spike solution, refactoring into encapsulated object methods - good design practise - (2015-03-05)
  [4628] Associative objects - one object within another. - (2016-01-20)

A401 - Web Application Deployment - Structured Code and Object Orientation
  [343] Should I use structured or object oriented? - (2005-06-10)
  [1717] Q - Should I use Perl or Python? - (2008-07-23)

Back to
Can you trust the big brand names?
Previous and next
Horse's mouth home
Forward to
Sizers (geometry control) in a wxPython GUI - a first example
Some other Articles
Python regular expressions - repeating, splitting, lookahead and lookbehind
Melksham - two many councils?
Making the most of critical emails - reading behind the scene
Sizers (geometry control) in a wxPython GUI - a first example
Object Oriented Programming for Structured Programmers - conversion training
Can you trust the big brand names?
Python - fresh examples from recent courses
XML handling in Python - SAX, DOM and XSLT examples
wxPython - simple example to add GUI to a server log file analysis
Santa Special - rather more special than usual - December 2010
4759 posts, page by page
Link to page ... 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96 at 50 posts per page

This is a page archived from The Horse's Mouth at http://www.wellho.net/horse/ - the diary and writings of Graham Ellis. Every attempt was made to provide current information at the time the page was written, but things do move forward in our business - new software releases, price changes, new techniques. Please check back via our main site for current courses, prices, versions, etc - any mention of a price in "The Horse's Mouth" cannot be taken as an offer to supply at that price.

Link to Ezine home page (for reading).
Link to Blogging home page (to add comments).

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2024: 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho

PAGE: http://www.wellho.net/mouth/3085_Obj ... ining.html • PAGE BUILT: Sun Oct 11 16:07:41 2020 • BUILD SYSTEM: JelliaJamb