Home Accessibility Courses Twitter The Mouth Facebook Resources Site Map About Us Contact
 
For 2021 - online Python 3 training - see ((here)).

Our plans were to retire in summer 2020 and see the world, but Coronavirus has lead us into a lot of lockdown programming in Python 3 and PHP 7.
We can now offer tailored online training - small groups, real tutors - works really well for groups of 4 to 14 delegates. Anywhere in the world; course language English.

Please ask about private 'maintenance' training for Python 2, Tcl, Perl, PHP, Lua, etc.
Private and Public - and things between

A public train service is one which is available for anyone to travel on; a private one only takes limited passengers as invites / made available by the operator. And there could be intermediate levels too - I understand that at times the British Transport Police protect the last train from Weymouth to Bristol on a Saturday night from the more inebriated members of the public who wish to travel on it. Then you have package trips available - such as [this one] next September, which is open to the public, but only if they join a group.

It gets more interesting when you consider that a public train service can be provided by a private company, and that even within the public accessible railway premises, there are areas which are protected from access from the public and are only available to staff who, however, may not be staff actually employed by the private company that runs the stations and trains.



Why all the rules about who can do what? It would be downright dangerous to allow members of the public, without appropriate health and safety training, do wander around at will even on a publicly owned railway. And if such training was given, and precedents were set, the new system would provide yet another set of rules and regulations that had to be looked after and updated as each new station opened( ;-) ) and each new train type came into service. So the best thing is to allow a single way of doing each operation that's needed by the public user, and then to provide protected or private methods of delivering those requirements.

The first picture illustrate a train at Shiplake, operated by the First group which is private / protected (a plc) but operating a public service from Henly-on-Thames (population 12,000) to Twyford (for London) through village at least once an hour. The second picture illustrates a private railway in a garden in Shiplake. The only trains there are provided and run by the owner for his own use, and it would be an exceptional day indeed if he were to run services for the general public.


Where am I headed? I'm drawing a real life parallel to computer programming, where various elements of a program are often marked "public" or "private", and where there are often levels in between - the most commonly used intermediate word is "protected" and sometimes the word "package" is used too, although each of these words has slightly different meanings depending on the programming language that we're talking about.

Starting with a standard that applies across all languages. If something is described as "public" then it's available to any programmer who wants to use it. And if something is described as "private" then it's available only within the tight area of the programming unit - usually a class - in which it is defined. The public can make use of private elements indirectly, however, by calling up a piece of code marked 'public' within a class which within itself makes a call to a private element.

The beauties of using private members like this are two-fold. Firstly, the private method can be changed later on without the need for the public user to make any changes to allow for it (this is known as encapsulation), and secondly there's only a limited number of facilities that need to be ruggedised and safety audited for use by the public, as private ones have a firm lock on the door!

In PHP, the additional level of "protected" says that a member is available within its own class (so as it would be if it were private), AND within other classes which are derived - either directly or indirectly - from that class. Yesterday, I wrote a new example - a [source code] which included a base class called animal. I extended the animal into a specialized subclass called silentanimal, and then I defined four types more finely - dogs (which bark from time to time, and it depends on the dog how much it barks), sealions (all of which bark 20 times a day), giraffes (which don't bark), and cats (which don't bark either, but which are going to have their names displayed a bit differently). PHP does *not* have an extra package level.

Both C++ and Java also use private, protected and public - and also have a "package" level which is unstated and again comes somewhere in the middle. There's a full set of notes and diagrams that we've provided for Java [here - .pdf file]. And you'll notice that "protected" in Java does not relate to the class inheritance structure, but to Java's packages and subpackages.

In languages such as Perl, it's assumed that the programmer knows what (s)he's doing, and there aren't any of the "private" and "public" words. Which makes for much quicker coding if the assumption is correct, and a nightmare or maintainance if it isn't ...




Public Well House Consultants courses which include Object Orientation:
Perl for Larger Projects
Object Oriented PHP
Python Programming
Learning to program in Python
Ruby Programming
Learning to program in Ruby
Learning to program in Java
Java Bootcamp
Learning to program in C++
C and C++ programming
C++ Programming

Object Oriented techniques, and how they're implemented in each of the languages above, are also covered if required on private (single company) courses which can be run for you at our training centre, or at your offices.


[incr-Tcl] is an Object Oriented extension to Tcl, and we can cover it on private Tcl courses; if you're on either of our public Tcl courses and would like the subject added in, please let the tutor know and he'll be happy to add an extra hour or two before or after lessons on the final day of the course (no extra charge!).

Lua is not strictly an object oriented language, but its metatables provide something that's very close and with the same philosophy; we cover them on our public Lua courses, and they'll usually be covered on private courses too (subject to tailoring - very occasionally they won't be required)
(written 2011-01-22, updated 2011-01-25)

 
Associated topics are indexed as below, or enter http://melksh.am/nnnn for individual articles
U107 - Object Orientation - the Lua way
  [1692] Towards Object Oriented Programming in Lua - (2008-06-30)
  [1699] If you are learning Lua, here are some more examples - (2008-07-06)
  [1743] First class functions in Lua lead to powerful OO facilities - (2008-08-07)
  [1819] Calling base class constructors - (2008-10-03)
  [2318] For Lua Programmers AND for Town Planners - (2009-08-02)
  [2359] A fresh example - objects the Lua way - (2009-08-13)
  [2455] Lua examples - coroutines, error handling, objects, etc - (2009-10-15)
  [2701] Is Lua an Object Oriented language? - (2010-04-01)
  [2703] Lua Metatables - (2010-04-02)
  [2710] __index and __newindex in Lua - metatable methods - (2010-04-05)
  [3396] Tables as Objects in Lua - a gentle introduction to data driven programming - (2011-08-17)
  [3524] Metaclasses (Python) and Metatables (Lua) - (2011-11-17)
  [3683] Weak references in Lua - what are they, and why use them? - (2012-04-04)
  [3694] Special __ methods you can use in Lua metatables - (2012-04-12)
  [3727] Using Lua tables as objects - (2012-05-11)
  [3730] What is a metatable? How do I set one up? How do I use them? Lua - (2012-05-12)
  [4117] Is Lua an Object Oriented language? - (2013-06-15)
  [4248] Metatables, Metamethods, classes and objects in Lua - (2014-03-18)
  [4273] Dot or Colon separator between table name and member in Lua - what is the difference? - (2014-05-06)
  [4572] Tables with values and code in Lua - looks like an object? - (2015-11-05)
  [4573] Classic style OO code - in Lua - (2015-11-05)
  [4753] Lua, Tcl, Python, C and C++ courses - at our Melksham HQ or on your site - forward from July 2017 - (2017-07-02)

T245 - Tcl/Tk - [incr-Tcl]
  [290] Object Orientation in Tcl - [incr-Tcl] - (2005-04-24)
  [656] Think about your design even if you don't use full UML - (2006-03-24)
  [1528] Object Oriented Tcl - (2008-02-02)
  [1925] Introduction to Object Oriented Programming - (2008-12-06)
  [4456] Objects in Tcl - iTcl - updated first steps example - (2015-03-11)
  [4460] Using Object Oriented Tcl and the Tk toolkit together - real life example - (2015-03-12)

R108 - Ruby - More Classes and Objects
  [184] MTBF of coffee machines - (2005-01-20)
  [1217] What are factory and singleton classes? - (2007-06-04)
  [1587] Some Ruby programming examples from our course - (2008-03-21)
  [2292] Object Orientation in Ruby - intermediate examples - (2009-07-16)
  [2601] Ruby - is_a? v instance_of? - what is the difference? - (2010-01-27)
  [2603] Ruby objects - a primer - (2010-01-29)
  [2604] Tips for writing a test program (Ruby / Python / Java) - (2010-01-29)
  [2616] Defining a static method - Java, Python and Ruby - (2010-02-01)
  [2620] Direct access to object variable (attributes) in Ruby - (2010-02-02)
  [2623] Object Oriented Ruby - new examples - (2010-02-03)
  [2717] The Multiple Inheritance Conundrum, interfaces and mixins - (2010-04-11)
  [2977] What is a factory method and why use one? - Example in Ruby - (2010-09-30)
  [2980] Ruby - examples of regular expressions, inheritance and polymorphism - (2010-10-02)
  [3154] Changing a class later on - Ruby - (2011-02-02)
  [3158] Ruby training - some fresh examples for string handling applications - (2011-02-05)
  [3260] Ruby - a training example that puts many language elements together to demonstrate the whole - (2011-04-23)
  [3760] Why you should use objects even for short data manipulation programs in Ruby - (2012-06-10)
  [3781] Private, Protected, Public in Ruby. What about interfaces and abstract classes in Ruby? - (2012-06-23)
  [3782] Standard methods available on all objects in Ruby - (2012-06-23)
  [4366] Changing what operators do on objects - a comparison across different programming languages - (2014-12-26)
  [4504] Where does Ruby load modules from, and how to load from current directory - (2015-06-03)
  [4550] Build up classes into applications sharing data types in Ruby - (2015-10-23)
  [4551] Testing your new class - first steps with cucumber - (2015-10-23)

Q909 - Object Orientation and General technical topics - Object Orientation: Composite Objects
  [477] Class, static and unbound variables - (2005-10-25)
  [592] NOT Gone phishing - (2006-02-05)
  [1345] Perl and Shell coding standards / costs of an IT project - (2007-09-11)
  [1348] Screw it or Glue it? Access to Object variables - a warning - (2007-09-12)
  [2170] Designing a heirarcy of classes - getting inheritance right - (2009-05-11)
  [2641] Object Oriented Programming in PHP - (2010-02-19)
  [2865] Relationships between Java classes - inheritance, packaging and others - (2010-07-10)
  [2922] Getting the OO design write - with PHP a example - (2010-08-14)
  [3152] Jargon busting - (2011-01-30)
  [3251] C++ - objects that are based on other objects, saving coding and adding robustness - (2011-04-17)
  [3609] How do classes relate to each other? Associated Classes - (2012-02-12)
  [3979] Extended and Associated objects - what is the difference - C++ example - (2013-01-18)
  [4377] Designing a base class and subclasses, and their extension, in C++ - (2015-01-01)
  [4394] Philosophy behind object design - and how I applied in to a Java example - (2015-01-14)
  [4450] Deciding whether to use parameters, conditional statements or subclasses - (2015-03-05)

J709 - Java - Class Access
  [874] Who can use which access door? - (2006-09-21)
  [2419] Where is my Java class? - (2009-09-24)
  [2535] When should I use Java, Perl, PHP, or Python? - (2009-12-13)
  [3047] What is a universal superclass? Java / Perl / Python / Other OO languages - (2010-11-13)
  [4398] Accessing variables across subroutine boundaries - Perl, Python, Java and Tcl - (2015-01-18)

H108 - Objects in PHP
  [67] Object Oriented Programming in PHP - (2004-09-29)
  [124] PHP v Java - (2004-11-20)
  [205] PHP5 lets you say no - (2005-02-07)
  [343] Should I use structured or object oriented? - (2005-06-10)
  [421] Don't repeat code - use loops or functions - (2005-08-21)
  [485] North, Norther and Northest - PHP 5 Objects - (2005-11-04)
  [720] Planning a hotel refurb - an example of a Gant chart in PHP - (2006-05-14)
  [836] Build on what you already have with OO - (2006-08-17)
  [1027] Cue the music, I'm happy. - (2007-01-09)
  [1153] Object Oriented Model - a summary of changes from PHP4 to PHP5 - (2007-04-18)
  [1535] OO PHP demonstration - comparing objects and more - (2008-02-08)
  [1682] Accounts in PHP - an OO demo - (2008-06-19)
  [1820] Sorting objects in PHP - (2008-10-04)
  [2160] PHP - getclass v instanceof - (2009-05-07)
  [2169] When should I use OO techniques? - (2009-05-11)
  [2171] Cleaning up redundant objects - (2009-05-11)
  [2172] PHP4 v PHP5 - Object Model Difference - (2009-05-11)
  [2380] Object Oriented programming - a practical design example - (2009-08-27)
  [2434] Abstract classes, Interfaces, PHP and Java - (2009-10-03)
  [2435] Serialization - storing and reloading objects - (2009-10-04)
  [2632] Shipping a test harness with your class in PHP - (2010-02-12)
  [2680] Static class members in PHP - a documented example - (2010-03-16)
  [2741] What is a factory? - (2010-04-26)
  [2774] PHP - Object Oriented Design in use - (2010-05-21)
  [2921] Does copying a variable duplicate the contents? - (2010-08-14)
  [3210] Catchable fatal error in PHP ... How to catch, and alternative solutions such as JSON - (2011-03-22)
  [3211] Computer Graphics in PHP - World (incoming data) to Pixel (screen) conversion - (2011-03-24)
  [3607] Designing your application - using UML techniques - (2012-02-11)
  [3608] Design Patterns - what are they? Why use them? - (2012-02-12)
  [3840] Autoload in PHP - (2012-08-17)
  [3841] Copying, duplicating, cloning an object in PHP - (2012-08-18)
  [3843] Caching Design Patterns - (2012-08-20)
  [3953] Objects in PHP - Revision - (2012-12-16)
  [4057] stdClass in PHP - using an object rather than an associative array - (2013-04-02)
  [4073] Learning about Object Orientation in PHP - a new set of examples - (2013-04-28)
  [4356] Object factories in C++, Python, PHP and Perl - (2014-12-19)
  [4626] Singleton design pattern - examples and uses - (2016-01-20)
  [4627] Caching results in an object for efficiency - avoiding re-calculation - (2016-01-20)
  [4628] Associative objects - one object within another. - (2016-01-20)

C233 - C and C based languages - OO in C++ - beyond the basics
  [798] References and Pointers in C++ - (2006-07-10)
  [801] Simple polymorphism example - C++ - (2006-07-14)
  [831] Comparison of Object Oriented Philosophy - Python, Java, C++, Perl - (2006-08-13)
  [925] C++ - just beyond the basics. More you can do - (2006-11-14)
  [1572] C - structs and unions, C++ classes and polymorphism - (2008-03-13)
  [1674] What a lot of files! (C++ / Polymorphism demo) - (2008-06-12)
  [2577] Complete teaching example - C++, inheritance, polymorphism - (2010-01-15)
  [2845] Objects and Inheritance in C++ - an easy start - (2010-07-01)
  [3056] C++ - a complete example with polymorphism, and how to split it into project files - (2010-11-16)
  [3123] C++ objects - some short, single file demonstrations - (2011-01-07)
  [3124] C++ - putting the language elements together into a program - (2011-01-08)
  [3244] C and C++ - preprocess, compile, load, run - what each step is for - (2011-04-12)
  [3508] Destructor methods in C++ - a primer - (2011-11-05)
  [3811] Associated Classes - using objects of one class within another - (2012-07-21)
  [4375] Final examples for 2014 - and a look at our 2015 training course options - (2014-12-31)
  [4559] When do I use the this keyword in C++? - (2015-10-29)
  [4560] Variables, Pointers and References - C and C++ - (2015-10-29)


Back to
Wiltshire Rail services - a golden opportunity
Previous and next
or
Horse's mouth home
Forward to
On time
Some other Articles
Strings in C
Structures v Structure Pointers in C. How, which, why.
Setting up arrays in C - fixed size at compile time, or dynamic
On time
Private and Public - and things between
Wiltshire Rail services - a golden opportunity
Django - separating the HTML from the view / model
Steering our Python courses towards wxPython, SQLite and Django
Django - adding your own views, and then templating your views.
Training Classes - should the training company provide a system for each delegate to use?
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., 2021: 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/3142_Pri ... tween.html • PAGE BUILT: Sun Oct 11 16:07:41 2020 • BUILD SYSTEM: JelliaJamb