Well House Consultants
You are on the site of
Well House Consultants
Open Source Training Courses
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
Well House Manor Resources
Object Orientation and General topics
Linux / LAMP / Tomcat Resources
Well House Consultants Resources
C and C++ Resources
Web and Intranet Resources
Object Orientation and General technical topics module Q908
Object Orientation: Design Patterns
Exercises, examples and other material relating to training module Q908. This topic is presented on public courses Learning to program in Python
, Object Oriented Programming in PHP
, Python Programming
, Intermediate Python
Design patterns are the way you apply Object Oriented code in a standardised
way to common techniques across a wide range of different data types.
|Articles and tips on this subject||updated|
|4096||Perl design patterns example|
For short programs, just a few lines of code in a single block do an excellent job. As the program size increases, some sort of structure such as named blocks of code (sub, def, function, proc, lambda etc) becomes logical. And as the code grows further, you should consider splitting out logic relating ...
|4098||Using 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 - ...
|4021||Spike solution, refactored and reusable, Python - Example|
The other day, we suffered a gap in service from one of our dedicated hosts and after the event I wanted to go through the server logs to find how long the gap was, and whether there was any unusual activity prior to the outage. Problem was - I was looking in a 60 Mbyte log file with ovr 200,000 records ...
|3843||Caching Design Patterns|
We run a hotel, and sometimes we have a quandry when it comes to room changeover.
Scenario: John Smith checks out of room 4 at 8 a.m. on Thursday, and looking at our booking system, we see that the room's not been booked out again until Saturday evening, as a twin room, for Deborah Williams ...
|3810||Reading files, and using factories to create vectors of objects from the data in C++|
On our C++ courses, we concentrate on objects and object design. But we also take a wider look at topics such as references and templates that go to making the complete language, with sections covering changes to things like file handling from the underlying C language.
I've just added a new example ...
|3716||Learning C++ - a design pattern for your first class|
From today's C++ Course - a new, clear example of a design pattern for a simple class, its headers, and a test harness - [here].
When using an Object Oriented language, design patterns are really useful. Essentially, they're a known and standard way of combining the features of the language in a convenstional ...
|3608||Design Patterns - what are they? Why use them?|
Object orientation provides a wonderful bag of components, but they need to be linked together to provide a full set of facilities for data handling. And very often that linking together is in a way which can be standardised - along the lines of "you normally do it this way". Such standardised methodologies ...
|2977||What 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:
and that call creates an object ...
Whilst you can create ...
|485||North, Norther and Northest - PHP 5 Objects|
Here's a PHP example of calls to PHP methods to return the Longitude North of a place, the more northerly of two objects via an object (dynamic) method, and the most northerly of a whole array of objects via a static function.
$north = $ilike->getlong();
$norther = $ilike->northof($ilike);
|2741||What 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 ...
|2322||Looking for a practical standards course|
I'm a great believer in coding standards. In well commented code. In a good choice of variable names, of code re-use, and of thinking before you write. There are points which I stress on every course, even if the majority of the time I spend is on the actual language. So I should not have been surprised ...
|1224||Object 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.
Examples from our training material
|Validate.pm|| Validation of parameters object|
|demo1.php|| caching design pattern|
|pages.py|| Factory for webpage objects|
|runners|| Full OO example / various design patterns in Perl|
|uml2.php|| Factory, Comparator, Object Sort routine|
|umli.php|| Code to illustrate UML examples|
|valerie|| Test and demonstration for Validate.pm|
Some modules are available for download
as a sample of our material or under an Open Training Notes License
for free download from http://www.training-notes.co.uk
Topics covered in this module
What are design patterns?
Attributes, properties and accessors.
Factory methods, Comparators, etc.
Printing and serialising.
If you are looking for a complete course and not just a information on a single subject, visit our Listing and schedule
Well House Consultants specialise in training courses in
. We run
throughout the UK (and beyond for longer courses), and
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. Also
available is the Opentalk
Forum for discussion of technical questions.