Home Accessibility Courses Twitter The Mouth Facebook Resources Site Map About Us Contact
 
Python and Tcl - public course schedule [here]
Private courses on your site - see [here]
Please ask about maintenance training for Perl, PHP, Lua, etc
 
C++ - how we teach the language and the concepts behind the language

When I'm teaching an object oriented language such as C++, I like to write code and demonstrate from scratch to my class, getting them to 'feed' me with application data and information so that I can show them how programs are really developed using the OO approach - both in general, and in the specific language. To teach someone how to code without teaching them how to design would be like teaching someone how to operate a car, without teaching them the rules of the road.

Much of OO design is about keeping the data and code that are specific to a particular type of thing you're writing code about ("particular class of object") in its own code area and segment so that it can be specified, written, tested, maintained and later altered with ease, and without having to modify the overarching applications. Which normally means that all the "class stuff" would go into separate files, to be looked after independently and called into multiple applications. However, for a first demonstration I usually choose to write it all into one file - it helps get the concepts across, and it avoids having lots of source code windows to manage while teaching. See [here] for such a first demonstration.

In my second example on this course - source code [here] - I then start to extend the envelope. On the recent course, I chose to introduce the fact that you can have several methods of the same name in the same class in C++ (the compiler and loaded tell them apart by the number and type of parameters), and to demonstrate that a constructor can do more than simply save values that are passed in. The example also introduced the word "this" to allow the program to use the same word for a parameter and a variable within an object.

The third example in this series introduces an internal (private) method - such methods are very commonly used to share code between a group of user-callable methods which need to share logic. In this example, that sharing is of the setup code for two different constructors. Within the main application of this demosntration we've moved forward too - the example now has a whole array of objects of class "Train", so that the code can remain essentially the same if it's being run with 1 or 2 objects ... or if we've increased it to a complete fleet of trains. The source code is [here]. We've also defined the array on the heap rather than the stack - that makes a significant difference to the dynamics of the program (i.e. how flexible it can be at runtime, and also how long the objects exist for).

There comes a point as I'm writing demonstrations that I "refactor" - revise and refresh the work. This is helpful for delegates as by the time I've taken a short program and added all sorts of demonstration pieces to it, it's getting a bit unwieldy. So when I came to taka about creating new types (classes) of objects that were based on other more fundamental objects, I started a fresh set of examples. Probably a good point to start a new posting and chapter here, then!




We offer three different public C++ courses - and they're so popular that we've just added extra dates. The courses are:

• Learning to program in C++ (for delegates who are new to programming) - see [here]

• C and C++ Programming (for delegates who have programmed before, but NOT in C) - see [here]

• C++ Programming (for delegates who have programmed in C before and want to add C++ skills) - see [here]

Public courses run at our Melksham, Wiltshire, England training centre - see [here] for course details. We also have accommodation available for delegates (and non-delegates are welcome to stay too), which makes us into a hotel. The hotel website is [here].
(written 2011-04-17)

 
Associated topics are indexed as below, or enter http://melksh.am/nnnn for individual articles
C051 - C and C based languages - C++ - General
  [4355] C++ in 2 days - (2014-12-18)
  [4335] Flexible public courses - residential or commuting, programming newcomer or experienced, C or C++ - (2014-11-30)
  [3809] Dwarf Exception Unwind Info - (2012-07-20)
  [3587] C++ Courses - do I get official certification at the end of my Well House course? - (2012-01-20)
  [3155] Rake - a build system using code written in Ruby - (2011-02-03)
  [3129] Extra courses - C and C++ - (2011-01-12)
  [3067] Using C and C++ functions in the same program - how to do it - (2010-11-24)
  [3052] Getting your C++ program to run - (2010-11-15)
  [2851] Further C++ material - view new or old - (2010-07-04)
  [2763] Our C and C++ training course are on Open Source platforms - (2010-05-13)
  [2577] Complete teaching example - C++, inheritance, polymorphism - (2010-01-15)
  [2536] All the Cs ... and Java too - (2009-12-13)
  [2504] Learning to program in ... - (2009-11-15)
  [2370] C++, Python, and other training - do we use an IDE - (2009-08-21)

C231 - C and C based languages - Introduction to C++
  [4562] Left shift operator on an output stream object - C++ - (2015-10-30)
  [4561] Hello World in C++ - a first program, with the process explained - (2015-10-30)
  [4466] Moving from C to C++ - Structured to Object Oriented - a lesson for engineers - (2015-03-28)
  [3069] Strings, Garbage Collection and Variable Scope in C++ - (2010-11-25)
  [3053] Make - automating the commands for building and installing - (2010-11-16)
  [2845] Objects and Inheritance in C++ - an easy start - (2010-07-01)
  [2169] When should I use OO techniques? - (2009-05-11)
  [2004] Variable Scope in C++ - (2009-01-22)
  [928] C++ and Perl - why did they do it THAT way? - (2006-11-16)
  [336] Targetted Advertising - (2005-06-05)
  [318] Choosing a theme - (2005-05-20)
  [317] Programming languages - a comparison - (2005-05-20)

C232 - C and C based languages - Defining and using classes in C++
  [4565] Allocation of memory for objects in C++ - Stack v Heap - (2015-10-31)
  [4372] Template / design pattern for C++ constructor and accessors - (2014-12-29)
  [4129] Simple OO demonstration in C++, comparison to Python - (2013-07-01)
  [3978] Teaching OO - how to avoid lots of window switching early on - (2013-01-17)
  [3810] Reading files, and using factories to create vectors of objects from the data in C++ - (2012-07-21)
  [3721] Naming blocks of code, structures and Object Orientation - efficient coding in manageable chunks - (2012-05-06)
  [3716] Learning C++ - a design pattern for your first class - (2012-05-02)
  [2579] Creating, setting up and using objects in C++ - (2010-01-16)
  [2578] Where are your objects stored in C++? - (2010-01-16)
  [1925] Introduction to Object Oriented Programming - (2008-12-06)


Back to
Events - Spring and Early Summer 2011 in Melksham
Previous and next
or
Horse's mouth home
Forward to
C++ - objects that are based on other objects, saving coding and adding robustness
Some other Articles
Multiple inputs, multiple out, ruby functions
Is this number between? Does this list include? - Ruby
C++ - unknown array size, unknown object type. Help!
C++ - objects that are based on other objects, saving coding and adding robustness
C++ - how we teach the language and the concepts behind the language
Events - Spring and Early Summer 2011 in Melksham
What have these pictures in common?
Light and dark at Green Park
Melksham - the way forward. 26th April, Well House Manor
Collections in C and C++ - arrays, vectors and heap memory blocks
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., 2019: 404 The Spa • Melksham, Wiltshire • United Kingdom • SN12 6QL
PH: 01225 708225 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho

PAGE: http://www.wellho.net/mouth/3250_C-h ... guage.html • PAGE BUILT: Sat May 27 16:49:10 2017 • BUILD SYSTEM: WomanWithCat