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))

Well House Consultants
You are on the site of Well House Consultants who provide Open Source Training Courses and business hotel accommodation. You are welcome to browse and use our resources subject to our copyright statement and to add in links from your pages to ours.
Other subject areas - resources
Java Resources
Well House Manor Resources
Perl Resources
Python Resources
PHP Resources
Object Orientation and General topics
MySQL Resources
Linux / LAMP / Tomcat Resources
Well House Consultants Resources
Extras Resources
C and C++ Resources
Ruby Resources
Tcl/Tk Resources
Web and Intranet Resources
Object Orientation and General technical topics module Q907
Object Orientation: Design Techniques
Exercises, examples and other material relating to training module Q907. This topic is presented on public courses Learning to program in Python, Learning to Program in Java, Learning to program in Ruby, Learning to program in C and C++, Object Oriented Programming in PHP, Python Programming, Perl for Larger Projects, C++ for C Programmers, C and C++ Programming, Java Bootcamp, Ruby Programming, Java Programming for the Web, Deploying Java Applications on Linux / Unix, Intermediate Python, Learning to program in C and C++, C and C++ Programming

This is the third and final module that introduces object orientation, and is applicable to any language with OO support. It is vital that applications are correctly designed from the beginning. Starting from first principles, we take students through the steps of modelling a system using informal methods, and we also introduce more formal methods such as UML.

Related technical and longer articles
Mapping database rows to objects in a class

Articles and tips on this subjectupdated
4628Associative objects - one object within another.
A new demonstration of the use of objects within objects - [here] from today's PHP course. Faced with a class of public transport departure times (as strings) and run times (in pinutes), I added a class of time objects so that I could encapsulate the calculations of time into their own class. It's ...
4449Spike solution, refactoring into encapsulated object methods - good design practise
Initial test code on new data sets - your research work - will most likely take place in smaller chunks of code while you work out just how the data flows and what you need from it (and you are remembering to read documentation supplied by the data originator, aren't you??). But having done that initial ...
4430The spirit of Java - delegating to classes
Building up towards the end of a Java course, I've been very much teaching the spirit of Java where code is delegated to classes and leaves the main application as a few short method calls, making it readable in its own right, and allowing code that uses the same data type to be shared between programs. ...
4374Test driven development, and class design, from first principles (using C++)
I'm teaching OO / class design from first principles today ... in stages. The chosen source language is C++, but the principles are well applied across other OO languages too. Stage 1 - write your test program to make sure it works for your customers want to do. Remember that the "customer is king" ...
2169When should I use OO techniques?
We have two friends. They're married. She's a keen advocate of Object Oriented Programming and he can't stand the approach. So take them to the pub, buy them a couple of drinks each, mention OO programming and watch the feathers fly ;-) Seriously, Object Oriented Programming has its place - and there ...
4098Using object orientation for non-physical objects
A table, a flower, a dog, a train and the second hand on a clock are all physical objects. And when teaching people about Object Oriented programming, using such things as examples is a real help in getting the concepts across an showing how they're implemented. But objects to further than that too - ...
3978Teaching OO - how to avoid lots of window switching early on
One of the major benefits of Object Oriented programming is the clear and sharp dividing lines it provides between the different sections of logic - where code dealing with one type of data is specified, written, stored and tested in different files to the code dealing with other types of data (or code ...
3928Storing your intermediate data - what format should you you choose?
Many applications require data to be held at intermediate stages - stored. What format should be used? ... HUGE subject. 1. If there is already an industry standard / draft standard way of doing it, think very carefully before going for anything else. The standard will have been designed with ease ...
3887Inheritance, Composition and Associated objects - when to use which - Python example
• Inheritance is where one object is based on another. • Composition is where one object contains another. Question: Which should I use? Answer: Probably BOTH! On yesterday's Python course, the question came up, and I wrote an illustrative answer - source code [here]. The scenario we ...
3878 From Structured to Object Oriented Programming.
Background A frequent comment - "I'm very used to conventional / structured programming, but I'm now trying to learn about Object Orientation and I don't understand the idea and I get baffled by all the buzzwords I hear". And a request "Can you help me?" Yes - I can help you. If you come on a course ...
3844Rooms ready for guests - each time, every time, thanks to good system design
It's no accident that your room's ready for you when you check in at Well House Manor, and that the bathroom is sparkling. And it's no accident that the bed has been remade during the day while you're attending your course or you're out at work or seeing the sights. Our online systems keep a record ...
3798When you should use Object Orientation even in a short program - Python example
I was training earlier this week in a room with a view - a view of a major link road towards Cambridge City centre, and I was struck by the very different mix of vehicles travelling along the road compared to what I would expect to see in Wiltshire. And - ever keen to have new, relevant data sets available ...
3763Spike solutions and refactoring - a Python example
Refactoring - taking a program that works (as far as it goes) and restructuring it so that it can go much further - that its code can be reusable, that it's more robust, that it can be updated to do more, and so on. Spike Solution - an answer to a problem that can go no further, and perhaps ignores ...
3760Why you should use objects even for short data manipulation programs in Ruby
It's so easy to take the "Bull at a gate" approach - to start writing code to do the job in hand without giving thought to code-reuse later on, or indeed to how the work can be used again later. And it's double easy to, for me to take the bull approach during a course, where I'm writing a short demonstration ...
3607Designing your application - using UML techniques
When you're planning to write an application, you shouldn't just start writing code - you should think about what you're going to do and plan ahead. But how do you plan ahead? How do you ensure that you've thought of things from various angles? UML (Unified Modeling Language) is a way of drawing (modeling) ...
3454Your PHP website - how to factor and refactor to reduce growing pains
As your project grows ... what do you change? In an ideal world, you would know exactly what you were coding before you started, and write the full job to spec to last for many years. This isn't an ideal world, though. Our web site has changed over the years - we now have "version 8" (See [here] to ...
3260Ruby - a training example that puts many language elements together to demonstrate the whole
Towards the end of our programming language training courses, we pull together all the various strands into a worked example that shows how they go together. I've just posted such an example from last week's Ruby Programming Course ... [here]. Let's have a look at some of the things in the example ...
3085Object 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 ...
3063Comments in and on Perl - a case for extreme OO programming
"The only thing that will interpret Perl is a Perl interpreter" ... how those words rang in my ears this morning as I was writing some code to highlight source code comments in a different colour in our web site examples. The words were spoken by Larry Wall ... I think it was 10 years ago, so I may ...
2977What is a factory method and why use one? - Example in Ruby
How do you create an object? By calling a constructor method, of course. But ... actually ... there's no "of course" about it. Here's a piece of code from an example I wrote yesterday:   sageroll.push Transact::factory(current) and that call creates an object ... Whilst you can create ...
2953Turning an exercise into the real thing with extreme programming
Should a private course that's being booked run for 2 days or 3? Or on a longer subject for 5 days or 4? I'm often left having to make a recommendation. Budget constraints, and more critically the constraints on the length of time that people can be released from their other tasks, favor a shorter ...
2878Program for reliability and efficiency - do not duplicate, but rather share and re-use
When you're writing a new piece of code - especially if you're also quite new to programming - you'll be concentrating so much on getting it to work that you may not be giving too much thought to making it easy look after your code later on (maintainance), nor to sharing a piece of code between programs. ...
2889Should Python classes each be in their own file?
Should classes each be defined in a file of their own? In Java, unless you're making a use of inner classes, you're coerced into writing one class per file. In C++, you'll typically have the code for a class in one source file and the headers in another, as other schemes are impractical to use and ...
2865Relationships between Java classes - inheritance, packaging and others
When you're designing classes in Java, you need to consider their relationship with one another in various ways. • You need to consider class INHERITANCE - which classes are based on which other classes. For example, a Pet could be based on (i.e. extended from) an Animal. • You need to consider ...
2785The Light bulb moment when people see how Object Orientation works in real use
A big "light bulb" moment for many customers is when they "get" object inheritance. And one of the best ways of explaining it is by writing an example. On Wednesday, I wrote an example during our Python Course - taking a customer of Well House Consultants as my base class, then defining two extended ...
2747Containment, Associative Objects, Inheritance, packages and modules
Containment is where one object contains other objects - and it happens all over the place. A "town" object may, in a program, contain a number of "hotel" objects, a "location" object, zero or more "leisure" objects, "public transport hub" objects and so on. Containment is different to inheritance ...
2741What is a factory?
A Factory is somewhere that takes raw material, and converts into objects of some value. And so it is in Object Oriented Programming, where a "factory method" takes a chunk of raw material and makes an object out of it. It may differ from a constructor in that we may not know what type of object ...
2717The Multiple Inheritance Conundrum, interfaces and mixins
Should an OO programming language support "multiple inheritance"? Let's define multiple inheritance first - starting from simple (single?) inheritance. (Single) Inheritance. I don't want to have to define each type of thing ("class of object") from scratch, so I'll define once class as being based ...
2523Plan your application before you start
Planning your project / application ahead of time can save you so much heartache and wasted time that it's untrue - but there is still a tendency for people to jump right into to coding without thinking "how will this work". And you should think "How will this work" in many ways. These seven diagram ...
So said one of my delegates on todays course - pronounced with a long "I" - "Seemples". And we knew he was impersonating one of those meerkats here. One of the classics of modern advertising along with the Cadbury's Gorilla. Object Oriented Programming is one of those subjects that many people find ...
2380Object Oriented programming - a practical design example
Object Oriented coding makes enormous sense when you're looking at a medium sized or larger application - but it's a complete change of thought process for the traditional structured programmer. We ran an Object Oriented Programming in PHP course today, and the course concluded with me taking some sample ...
When I travelled from home to Saudi Arabia in May, 2006, I planned ahead. Flights were booked, course manuals printed, Visa obtained, contacts established, deposit paid (to us for courses), travel insurance in place before I even left home. "Of Course" or "Prudent", I expect you'll say. And I agree ...
2170Designing a heirarcy of classes - getting inheritance right
You friend Will has written a class to handle management information about articles. It's great as far as it goes, but you want to add extra stuff to it, so you persuade Will to give you a copy. He's a nice guy, he does so ... but then a month later he tells you he's added a lot more code and you're ...
1538Teaching Object Oriented Java with Students and Ice Cream
"I'm getting tired of students. Can we do something else". So said my delegates at Cardiff University today. So we did Ice Cream and other deserts! Perhaps I had better explain. I'm running a Java Course there, and looking for examples of classes and objects to write about. At the start of the course, ...
1528Object Oriented Tcl
Object Oriented Tcl ([incr-Tcl]) is darned good - but it's only a requirement in a small proportion of the Tcl Training Courses that I give. So it was with real pleasure that I spent some time yesterday writing an example in front of my class in the Nottingham area to show them just how fabulous it ...
1435Object Oriented Programming in Perl - Course
Perl Review (module P251) Subroutines in Perl (module P209) More than Simple Lists and Hashes! (module P217) Object Orientation: Individual Objects (module Q906) Creating your own Classes (module P213) Object Orientation: Composite Objects (module Q909) More Objects (module P218) Object Orientation: ...
1224Object Relation Mapping (ORM)
Another technical term? Yes - this one is a formal name for how you convert a database into Objects - applicable to any OO language (Perl, Python, PHP, Java ...) Let's reduce it to basics. * SQL Tables become object classes * Table rows each become individual objects * Individual columns become attributes. OK ...
1217What are factory and singleton classes?
Do you find some of the OO terminolgy baffling? Once you've learnt about constructors and methods, inheritance, overloading and polymorphism and statics, you might think you're there. Then someone mentions a "factory class" or a "singleton" ... Fear not - factory and singleton classes are posh names ...
1047Maintainable code - some positive advice
Don't ask what class an object belongs to Don't enquire where your cursor is Don't do two things in a call Don't duplicate data or code Don't put two or more values in the same cell There's lots of different ways of coding - from "dog's dinner" to "Picasso". The dog's dinner looks a mess and is very ...
836Build 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 ...
831Comparison of Object Oriented Philosophy - Python, Java, C++, Perl
There are two different philosophies that have been adopted by the authors of Object Oriented languages. The first approach is to set the thing up in such a way that a programmer who uses someone else's code as the basis for his isn't going to be trusted to use that other person's code in a sensible ...
747The Fag Packet Design Methodology
Old fashioned engineering - in the Midlands of England. Imagine the scene as some widget or other was designed at the turn on the last century. Chimneys belching smoke out over the "Black Country", and workers belching smoke out from their Players, Marlboro or Senior Service. I've oft heard the term ...
80OO - real benefits
I was reminded of the real power of OO based systems and good object design yesterday. Taking a whole series of already-written classes, I was able to bolt together a new application based on the same data in just a few lines of code and get it running on a website too. The real saving comes not in ...
Examples from our training material
Hotel001.cpp   Designing and implementing a class - stage 1, test program
Hotel002.cpp   Designing and implementing a class - C++ - stage 2 - add API definition
Hotel003.cpp   Designing and implementing a class - C++ - stage 3 - define methods
Hotel004.cpp   Designing and implementing a class - C++ - stage 4 - initial test reporting
Hotel005.cpp   Designing and implementing a class - C++ - stage 5 - functional test reporting
Hotel005a.cpp   Designing and implementing a class - C++ - stage 5a - adding another accessor method
Hotel006.cpp   Designing and implementing a class - C++ - stage 6 - test pattern object
Hotel007.cpp   Designing and implementing a class - C++ - stage 7 - separate files
HotelRoomBooking.cpp   Function definitions for class being developed
HotelRoomBooking.h   Headers for main class being developed
TestPattern.cpp   Function definitions for Test Pattern Class
TestPattern.h   Headers for test pattern
bobclass   Moving detail into classes
da.txt   Data for rail stock demo
nr301   Associative class example - log file analysis - Ruby
oo1.py   First Class definitions and use
oo2.py   Muliple classes / inheritance / polymorphism
oo3.py   Comparator across multiple classes
oo4.py   high, higher, highest (static method)
poc.pm   Perl Module - for poctest demo
poc1   Piece of Content - encapsulation in a package
poc2   Piece of Content - encapsulate logic in package
poc3   Piece of Content - using Perl's OO features
poc4   Piece of Content - add a catch-all AUTOLOAD
poc5   Piece of Content - a list of objects
poc6   Piece of content - setters and getters
poc7   Piece of Content - extended class and inheritance
poctest   Piece of Content - main program to use poc.pm module
railstock.oo   Rail stock demonstration - Object Oriented
railstock.structured   Rail Stock Demonstration - structured
Class design in Perl
Background information
Some modules are available for download as a sample of our material or under an Open Training Notes License for free download from [here].
Topics covered in this module
OO Design - some basics.
Start with a good understanding of OO.
And also a good understanding of the buzz words and design cycle..
Informal Techniques.
Micro or Macro?.
Specifying classes and methods.
Specifying extended classes.
Clusters of classes.
Generalise it out.
Programming and method standards.
Formal Methods.
Unified Modelling Language (UML).
Model Elements.
UML Summary.
Project management and design issues.
Complete learning
If you are looking for a complete course and not just a information on a single subject, visit our Listing and schedule page.

Well House Consultants specialise in training courses in Ruby, Lua, Python, Perl, PHP, and MySQL. We run Private Courses throughout the UK (and beyond for longer courses), and Public Courses at our training centre in Melksham, Wiltshire, England. It's surprisingly cost effective to come on our public courses - even if you live in a different country or continent to us.

We have a technical library of over 700 books on the subjects on which we teach. These books are available for reference at our training centre.

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.info/resources/Q907.html • PAGE BUILT: Sun Oct 11 14:50:09 2020 • BUILD SYSTEM: JelliaJamb