Setup C++ courses
About the courses about the C/C++ Programming Language
The
ANSI-C++ standard has both standardized and
extended the
C++ language. The extension resulted in a change of setup
of the
C/C++ lectures since the academic year 1998-1999. The course
changed its organization again in the academic year 2003-2004, and another
minor modification was introduced in 2005-2006. The new C++0x standard started
to find its way in the 2009-2010 edition of this course. More changes are
expected as compilers implement more and more elements of the new standard.
The original `introductory and advanced courses on the C/C++
language' have been integrated into one single set of lectures,
divided over three organizational units (the C++ course parts
I, II and III). Attending only the first part is like walking on one leg. It
hardly gets you where you want to be. Part II is strongly advised, and part
III is for those who are really interested in the language. To paraphrase
Colin Fletcher (the Complete Walker, Knopf, 1978): it turns you from an
insecure biped to a confident triped (p. 49).
Below you'll find an overview of the setup of the lectures. All in,
about 25 lectures are organized.
The Software
Participants are free to select the software they want to use during these
courses. In particular: one is free to select one's favorite
compiler. However, not every compiler supports every part of the
C++
standard equally well.
Using a developmental environment is discouraged for this course,
as such an environment often results in a reduction of `insight' and easily
promotes questionable programming techniques.
Participants are strongly advised to use the GNU g++
compiler, which is available on both Unix operating systems and
Windows products. The GNU g++ compiler was developed within the
context of the philosophy of the
Free Software Foundation
meaning (among other things) that everybody may download and use the
software at no costs.
Once the GNU g++ compiler version 3.0 was released, a fairly
acceptable implementation of the ANSI/C++ standard became available. By
now, a compiler showing a version before 4.3.3 should no longer be used for
the C++ course.
It is assumed that participants use a recent GNU g++ compiler (by
now at least version 4.7.0
). No support can
be given to students using a different compiler, and no rights can be derived
from using a compiler not adhering to or using less complete implementation
standards than the GNU g++ compiler version
4.7.0
.
How to install the GNU g++ compiler on Unix systems
Below the steps are described which could be taken to install the
GNU
g++ compiler on a
Unix operating system:
- Assumption: the Unix-system is actually a Linux
system, as installed from a standard distribution, like
RedHat or Debian.
- Install the compiler using the standard procedure for installing
software, given the used distribution.
How to install the GNU g++ compiler on a computer running Windows
For MS-Windows the compiler is made available as a part of the
Cygwin environment.
This environment is made available by
Redhat.
Currently the Cygwin distribution is at
http://sources.redhat.com/cygwin
The steps to take to install the cygwin environment on a computer running
Windows are described in a README file. This
file is related to a CD-ROM which is available for participants of the
C/C++ course.
Please consult this README file for further details. The README
file will be updated annually, and it describes how to install the necessary
software. Contact the lecturer for details. The contents of the CD-ROM is
partially available in the cygwin directory: this may be
useful for those who are able to download the cygwin environment itself via
the Internet.
Students attending the C/C++ course are strongly advised to install the
necessary software before the course's first lecture, as the compiler will be
used right from the start.
C++
The
C++ language is an elaborate language,
consisting of seven main
facets. Only two of these facets were
already present in the
C programming language, and then only
partially.
C++ is also a beautiful language. It also shows features not
commonly encountered in other languages:
- It's very well standardized (by an official ANSI/ISO standard), and the
upcoming new (C++-0x) standard is now gradually implemented by
compilers;
- it's available on a wide range of platforms;
- it offers direct access to low-level (hardware) features;
- it offers a great implementation of modern views on object based and
oriented programming (do you know the difference?);
- it's a direct descendant of the C programming language, which was
used in the past (and is still being extensively used) to construct virtually
all professional-level software.
Because of all this
C++ is the language of choice for a large number of
major software engineering projects. It may very well become your language of
choice too.
Having learned C++ opens an easy road to an wide range of
C-like languages (including C itself). Since C++ is a
direct descendant of C, it is very well suited as a primary computer
language, not requiring novices to plunge immediately into complex object
oriented programming concepts, which are usually well beyond a novice's level
of com- and apprehension.
The C++ course covers all seven facets of the C++ computer
language. These facets are:
- The primary grammar: statements, expressions and operators which were
(for the greater part) already available in C (but not all; some of
C++'s additions are l- and r-value references; several new data types;
strict use of const; and range-based for loops;
- The procedural part: the tools the language has to offer for
top-down programming: functions etc.. But again there are extensions:
C++ offering overloaded functions, default function arguments,
fine-grained scoping-rules and the ability to reducing life-times to sensible
blocks;
- The exception handling mechanism, obliterating the need for
(local and non-local) goto's and unsafe exit() calls;
- Object-based programming: Classes, Operator overloading,
Function objects: tools to construct objects helping us to solve
programming problems in a far more natural way offered by the
(now traditional) top-down decomposition methods (without loosing all the
benefits of those methods);
- Generic Algorithms: Generic Algorithms, implemented
using templates, offer implementations of a wide range of commonly
occuring programming problems, idependently of the actual data types
on which the algorithms operate.
Related to the generic algorithms: the Standard Template Library
and the so-called Abstract Container Types are also covered.
- Object oriented programming: inheritance, polymorfism, virtual
functions, classe-hierarchies: methods to develop reusable
software: software that can easily be extended, modified and reused in various
situations in ways completely different from and vastly more powerful than
offered by earlier paradigms. One of the more amazing features of object
oriented programming being that software developed earlier in time
may use characteristics of software developed later in time. Object
oriented programming has shown its value in developing a standard set of
design patterns when developing reusable software. These design
patterns will also be introduced and (partially) covered by the C++
course.
- The template mechanism itself: developing abstract `recipes' for
both functions and classes which may then be used by the compiler to actually
create new functions and classes based on these recipes. The compiler
will be able to do so without requiring the programmer to implement the
concrete implementations of these functions and classes. Templates are very
important in current-day C++ programming, as all abstract containers
and generic algorithms use templates. During the C++ course
participants will learn to develop their own templates, as well as a `feel'
for the situations in which they may be used profitably.
Templates not only allow the compiler to create code on-the-spot from
recipes we've presented the compiler with, but it turns out that the template
mechanism has allowed programmers to do things compile-time that were
heretofore impossible to do. The aphorism never do run-time what you can
do compile-time has left the level of a hollow phrase in C++ where
it is possible to take full control of the compiler by actually programming
it. This has resulted in remarkable results, like having the compiler
generate series of prime numbers or completely changing memory allocation
schemes in 10 seconds. Many of the extensions to standard C++ offered
by the upcoming C++-0x standard were only possible because of the
features offered by the template mechanism.
The three parts of the C++ course will cover the various facets of
the C++ in (loosely) the order mentioned above. In addition to the
topics that are `purely' C++ several meta topics, like the use
of tools for generating lexical scanner and parser classes
are covered by the third part of the C++ course. These tools allow
software engineers to design their own grammars and input languages. Also, the
development of programs offering Graphical User Interfaces will be
mentioned briefly.
The course's setup.
Part I:
During the first part of the
C++ course the main focus of attention
will be on the primary grammar: following the initial lectures, covering basic
concepts like source code organization and layout; compilation
vs. interpretation; using and designing software libraries,
C++
expressions, statements and (free) functions will be discussed. This opens the
road to `procedural (structured) programming'.
At this point we're ready to introduce `Object Based Programming', introducing
classes, objects, construction, and composition.
C++ introduces, different from C's FILE-based
input/output (I/O) stream-based I/O. Stream-based I/O is closely
related to object oriented programming, but it can be em(used) before those
latter concepts are well introduced. Having covered the basics of object based
programming stream-based I/O will be introduced next.
C++ shares facilities for memory allocation with C
(albeit that C++ adds many more features to those offered by
C). By the end of part I arrays and pointers, including fundamental
forms of memory allocation will have been covered.
Students having completed part I of the C++ course will be able to
- Develop and understand basic C++ programs, primarily using the
`structured programming' methode of program development.
- Develop and use their own basic C++ classes,
- Use stream-based I/O
- Dynamically (and safely) allocate memory
- Use pointers, both to data and to code (functions)
This part's actual topics are listed in this part's
schedule.
Part II:
In this part Object Based and Object Oriented programming are the main
topics. Continuing where the first course ended, the
ins and
outs of classes are covered. This will eventually result in programs in
which design patterns and other advanced methods to construct software may be
used.
Many C++ programs heavily use templates: abstract containers, allowing
the software engineer to construct complex data structures with little effort
will be covered by this part as well. The actual use of generic algorithms
and the construction of templates is not covered in this part of the course.
Students having completed part II of the C++ course will be able to
- Develop and understand advanced C++ programs
in which inheritance and polymorphism are extensively used;
- Develop and use their own class hierarchies;
- Develop protocols using Abstract Base Classes,
which may also be their own design;
- Apply certain design patterns and recognize arguments for
applying them;
- Overload operators and recognize arguments for overloading operators;
- Avoid goto's and exit() calls, using exceptions
instead. Arguments for using exceptions (i.e., recognizing
exceptional circumstances) will have develped as well.
This part's actual topics are listed in this part's
schedule.
Part III:
This part of the course aims at advanced (but important and frequently used,
make no mistakes about this) topics of the
C++ programming language.
Also, tools for generating lexical scanner and parser classes will be
introduced and used. By the end of this part some attention will be devoted to
the design of programs using
Graphical User Interfaces (GUIs).
Students having completed part III of the C++ course will be able to
- Design and understand complex C++ programs. By the end of this
course students have had exposure to and hands-on experience with
practically all elements of the C++ programming
language. Students having completed the full (rhather than
lightweight (see below) course may consider themselves
highly experienced C++ programmers;
- Use advanced tools like lexical scanner and parser class generators
to design their own artificial (input) languages;
- Apply (and recognize arguments for doing so) generic algorithms,
including advanced context wrappers to enlarge the
applicability of generic algorithms even further;
- Design their own template functions and classes;
This part's actual topics are listed in this part's
schedule.
Exercises and training
For all three parts ample means will be offered to gain mastery of the
C++ language. There will be an electronic mailing list, the lecturer
may be contacted (even outside standard office hours), and many exercises will
be offered, which must be completed within a limited period of time. This
ensures a constant exposure to the language, which has beneficial learning
effects.
Starting the academic year 2005-2006 The C++ course is not only
offered in its standard (15 ECTS points) form, but also various
lightweight variants are offered for each of the three parts of the
C++ course. All lectures and all literature offered for the standard
course is also offered for the various lightweight variants, but the amount
of practice varies over the various lightweight variants. The lightweight
variants are (for each of the three parts) rewarded by 2, 3 or 4 ECTS points.
It is possible to select a different light-weight variant for each of the
three parts of the course, and it is possible to modify the (lightweight)
level while a course is actually being attended.
If you're interested in the C/C++ language you're more than
welcome to join and attend the C++ course. Contact the lecturer if you
have any further questions (email or
telephone (+31 50 363 9281)).
Frank B. Brokken
(f.b.brokken@rug.nl)
16 August 2010