GCO4020/CSC428 - Advanced Object Oriented Techniques In C++
Course guide

 

GCO4020/CSC428
Advanced Object Oriented Techniques In C++

Introduction

Learning the syntax and semantics of a programming language is less than half the battle. Most of the power to be gained from a particular language derives from the "idioms" (programming techniques) it makes possible.

This course aims to give students an overview of some of the less obvious, but more powerful idioms that the C++ programming language supports.


Synopsis


What are Idioms?

Programming language idioms (sometimes also known as "patterns") are techniques for combining the components of a programming language in useful ways. Using a particular idiom tends to be the answer to questions which begin "How can I...?". For example, the answer to the question "How can I make an container class{{GREF http://www.cs.monash.edu.au/~damian/Idioms/General/html/glossary.html#container_class}} call different functions when elements are read and written?" is "Use the Proxy{{GREF http://www.cs.monash.edu.au/~damian/Idioms/General/html/glossary.html#proxy}} idiom" (see {{REF}} "Proxies".)

Broadly speaking idioms fall into three categories: "interface{{GREF http://www.cs.monash.edu.au/~damian/Idioms/General/html/glossary.html#interface}} idioms", "implementation{{GREF http://www.cs.monash.edu.au/~damian/Idioms/General/html/glossary.html#implementation}} techniques", and "language extensions".

Interface{{GREF http://www.cs.monash.edu.au/~damian/Idioms/General/html/glossary.html#interface}} idioms are those which concern the way an object-oriented class interacts with the remainder of a program. They include programming techniques which allow code to behave in unusual (but intuitive) ways. Examples of interface{{GREF http://www.cs.monash.edu.au/~damian/Idioms/General/html/glossary.html#interface}} idioms can be found in {{REF}} 'Map Interfaces' and {{REF}} 'Functors I'.

Implementation{{GREF http://www.cs.monash.edu.au/~damian/Idioms/General/html/glossary.html#implementation}} techniques deal with how specific classes (or class hierarchies) achieve their behaviour internally. Examples of implementation{{GREF http://www.cs.monash.edu.au/~damian/Idioms/General/html/glossary.html#implementation}} techniques can be found in {{REF}} 'Implementing an Array class' and {{REF}} 'Hiding Implementation Details'.

Language extensions provide methods of overcoming limitations in the C++ language itself. Most language extension idioms could also be categorized as either interface{{GREF http://www.cs.monash.edu.au/~damian/Idioms/General/html/glossary.html#interface}}- or implementation{{GREF http://www.cs.monash.edu.au/~damian/Idioms/General/html/glossary.html#implementation}}-related, but are classified separately because they tend to operate at a lower level of abstraction, more widely applicable and less "problem-dependent" than other idioms Examples of language extension idioms can be found in {{REF}} 'Template Constraints' and {{REF}} 'Lazy Evaluation'.


How the Course is Structured

The course consists of 24 lectures, presenting a range of specialized object-oriented programming techniques, to extend your C++ repertoire.

This web site provides all the lecture materials, which are divided into 24 compulsory topics (topics 1 to 24) and 12 "sidebars" (a sidebar is a non-assessable "mini-topic", usually demonstrating a simple practical C++ programming trick).

In order to complete each topic, you should read through the online material (and follow up any references) and then complete the accompanying exercises. Alternatively, you may prefer to start by looking through (trying out, experimenting with, tracing, etc.) the code examples provided for each topic, and then read through the material in detail.

Over 100 exercises are provided (almost all of which have sample solutions). The exercises are designed to enhance your understanding of the topic being covered and to provoke you to "think beyond" the material, by considering its implications and alternatives. Many of the solutions offered illustrate the ways in which the various topics are interconnected and a few also provide small additional techniques not covered in the main presentation. Although the exercises are not assessed in any way, you are strongly encouraged to attempt them all, as "doing" is the best way to learn.

The {{REF}} 'course guide' provides a suggested sequence of study for the material. The material may, however, be studied in any sensible sequence. The only requirement is that the assignments (which rely on material in the order suggested) must be handed in by the end of the specified weeks.

There is also an {{REF}} 'detailed course guide', useful for searching for particular subtopics.


Assessment

Two assignments constitute the entire assessment for the course course. They are summarized in the {{REF}} 'Assessment Overview'.


Recommended Reading

There is no prescribed textbook for the course - all of the necessary material is available through these web pages.

Students will also find access to the recommended reading list (see the {{REF}} 'bibliography') to be valuable. In particular, many students will find {{REF}} (Gamma), and the two Meyers books - {{REF}}(Meyers 1992) and {{REF}}(Meyers 1996) - especially useful.


Frequently Asked Questions

Before asking for help, you should check the on-line {{REF}} "Frequently Asked Questions" list. The list covers common questions related to both the course material and organization and is updated frequently.


Staff Assistance

All questions regarding the course material and assessment should be emailed to gco4020-tutor@cs.monash.edu.au. All other questions related to the course should be emailed to gco4020-coord@cs.monash.edu.au.

Turnaround on most content-related questions should be within 24 hours (although this may not be possible at times of peak demand, such as immediately prior to assignment deadlines). Non-content-related questions will be dealt with as soon as practicable.


Related Newsgroups

General announcements, feedback and other discussion about the course will be broadcast through the WebFace newsgroups:

        classes.c2000.sem1.gco.gco4020.notices
        classes.c2000.sem1.gco.gco4020.general
        classes.c2000.sem1.gco.gco4020.assignments

and also via the USENET newsgroup monash.csse.gco4020 .

Subject headers will indicate announcements ([ANN]), feedback ([FBK]), discussion ([DIS]), and answers to common questions ([FAQ]).

If you are interested in the ways C++ can be used you may like to subscribe to the USENET newsgroup comp.lang.c++.moderated (don't bother with comp.lang.c++ - the signal-to-noise ratio is too low!)

If you are interested in discussions regarding the soon-to-appear ANSI/ISO C++ standard, you may wish to read the USENET comp.std.c++ newsgroup.


Other Online Resources

Apart from the course-related {{REF}} "Frequently Asked Questions" list there are a number of other relevant FAQ lists on-line, including:

If you feel your basic C++ is a little rusty, you may like to brush up with the online introductory C++ course from the State University of Groningen, or the accelerated tutorial from Iftech.

Sean Corfield provides an excellent and up-to-date reference for the new features of C++ .

If you want to see full chapter-and-verse on what is and isn't legal C++, you'll need to look up the Draft ANSI/ISO C++ Standard .

The Standard Template Library{{GREF http://www.cs.monash.edu.au/~damian/Idioms/General/html/glossary.html#standard_template_library}} occupies ten chapters of the ANSI/ISO C++ Standard and is occasionally referred to (and used) in this course. Silicon Graphics provides a public domain implementation{{GREF http://www.cs.monash.edu.au/~damian/Idioms/General/html/glossary.html#implementation}} with comprehensive documentation .

If you're sufficiently technically minded you can download the latest version of g++ (you'll actually need to download the gcc distribution, which now incorporates g++).

For those using DOS there's a useful site that can help you set things up more easily.

Cetus Links is a vast collection of hyperlinks covering all aspects of object-oriented programming, including C++ and Design Patterns (Idioms).

Another valuable "jump station" (one which is specifically tuned to C++) is Robert Davies' excellent Internet sites list.

Finally, the Yahoo index has numerous C++-related links of varying relevance.


A Note Regarding The Course Glossary

Through-out the course material terms with special meanings (such as vector{{GREF http://www.cs.monash.edu.au/~damian/Idioms/General/html/glossary.html#vector}}, polymorphism{{GREF http://www.cs.monash.edu.au/~damian/Idioms/General/html/glossary.html#polymorphism}}, accessor function{{GREF http://www.cs.monash.edu.au/~damian/Idioms/General/html/glossary.html#accessor_function}}, etc) will be encountered. Wherever these terms are used they will appear with a special character after them (just as they do in the previous sentence). Clicking on that character will take you to the relevant definition in the course glossary.


A Note Regarding Code Examples

Except where specifically indicated (by a comment at the start of the code), all code examples are written in (draft) ANSI/ISO C++ and are designed to compile under GNU g++ (version 2.8.0 or later).

Code which demonstrates features not yet supported by g++ is indicated by the following comment at the beginning of the code:

        // WARNING: Does not compile under g++ (2.8.0 or earlier)

In particular, code which uses exceptions (and which will compile under g++ but will only execute correctly on a limited number of platforms) is indicated by the following comment at the beginning of the code:

        // WARNING: Requires exceptions

In addition, code which uses run-time type information (and which may require the -frtti flag under some versions of g++) is indicated by the following comment at the beginning of the code:

        // WARNING: Requires RTTI

Code which is non-ANSI is indicated by the following comment at the beginning of the code:

        // WARNING: Non-ANSI C++


Getting to the Course Material

The course material can be accessed via the links on {{REF}} "course guide" page.

 


This material is part of the GCO4020/CSC428 - Advanced Object Oriented Techniques In C++ course.
Copyright © Damian Conway, 1997. All rights reserved.

Last updated: Thu May 3 06:12:30 2001