Module Information

Module Identifier
CS23820
Module Title
C and C++ and Environments
Academic Year
2016/2017
Co-ordinator
Semester
Semester 1
Co-Requisite
Pre-Requisite
Other Staff

Course Delivery

Delivery Type Delivery length / details
Practical 10 x 2 Hour Practicals
Lecture 40 x 1 Hour Lectures
 

Assessment

Assessment Type Assessment length / details Proportion
Semester Exam 2 Hours   Written Exam  50%
Semester Assessment Practical Programming:  Weekly worksheets  10%
Semester Assessment Problem, Analysis, Design, Programming and Short Report:  One larger piece of practical programming work (using both languages) with report (50 hours)  40%
Supplementary Assessment 2 Hours   Written Exam and Practical Work:  2 hour supplementary exam and/or resubmission of failed/non-submitted coursework components or ones of equivalent value  50%
Supplementary Exam 2 Hours   Resit exam and or failed coursework etc  50%

Learning Outcomes

On successful completion of this module students should be able to:

Write programs in C making use of dynamic data structures and file I/O

Write programs in C++ making use of classes and file I/O

Use tools to support development of stable and efficient software

Understand the typical traps and pitfalls associated with programs written in C and C++

Be able to describe which features of C or C++ would be suitable for use in typical programming scenarios.

Discuss the differences between programming in C and C++ and decide when a procedural or object-oriented approach is more appropriate

Brief description

The module starts by covering all major features of the C programming language, a procedural programming language used for both high level and low level programming.

The module continues by covering all major features of the C++ programming language, a language that adds object orientation as well as higher level constructs not available in C.

The manner in which the languages have, and are still evolving, will be considered at appropriate points.

The module will also consider interaction with facilities provided by external libraries and underlying operating systems (e.g. GUIs, memory management, inter-process communications).

Content

1. Introduction – 1 Lecture
An introduction to the module.

2. Basic Concepts of C and C++ - 1 Lecture
History of the C and C++ languages, philosophical differences between them and Java.
Language standards. Basic form of C and C++ programs compared with that of a Java program. Using the compiler/linker.

3. The C Language.
a. Basic Issues – 4 Lectures
Simple input and output.
Sequence, branching and iteration in C.
Review of basic data types and operators in C.

b. Software Support Tools - 1 Lecture
Make, Lint, Debuggers. Libraries and library utilities. Static/Dynamic analysers.

c. Functions - 1 Lectures
Discussion of ways in which functions are implemented, and used in C, including parameter
passing mechanism

d. C Programming Style and Portability - 1 Lecture
Language standards. Portability. Programming standards.

e. Arrays, Pointers and Functions - 2 Lectures
A discussion of pointer data types, how they relate to arrays and how they are used as parameters and return values of functions.

f. Dynamic Data Structures - 1 Lecture
Implementation of various record structures and dynamic structures. Pointers. Malloc. Examples in C.

g. Further Features - 1 Lecture
C preprocessor, header files, conditional inclusion, macro substitution, bitwise operators, casts, enumeration, scope, static and external declarations, separate
compilation.

h. Case Studies - 4 Lectures
A small group of typical ANSI C programs will be presented and discussed as examples of good practice.

i. New features of C11 – 2 Lectures
A discussion of new features introduced by C11.

4. The C API to UNIX - 4 Lectures
a. IEEE POSIX.
b. The terminal interface.
c. Process creation.
Fork, exec, wait and related issues.
d. The Filesystem and Files.
The structure of the filesystem and associated operations. The types of file and the operations on files. The function and system calls available from C to
interact with files and filesystems.
e. Interprocess communication.
Sockets and their access to TCP and UDP protocols; pipes.

5. The C++ Language
a. Introduction – 1 Lecture
Brief history and versions; the C++ way of doing common things (e.g. versus , , cout vs printf etc.); stream insertion and
extraction operators; stack and heap use (revision).

b. Parameter passing – 1 Lecture
Including pointers and classes, reference (alias) types contrasting with ‘address of’ operator, auto type declaration (C++11); indirection, smart pointers
(auto_ptr, unique_ptr (C++11), shared_ptr, weak_ptr), nullptr keyword (C++11).

c. Class definitions – 3 Lectures
Data members; member functions; access levels; scope resolution operator; member access operator; class declaration, prototyping and header files.

Constructors; default constructors; implicit constructors; delegate constructors (C++11); destructors; namespaces (inc. nesting).

Const objects and const member functions; data member initialiser syntax; default parameter syntax; class composition; mutable data members; friends; static
class members; inner classes.

d. Inheritance – 1 Lecture
Access specifiers (class and inheritance); cascaded constructors.

e. Polymorphism – 2 Lectures
Dynamic binding; pure virtual functions; abstract classes; virtual destructors; encapsulation and visibility - data hiding; deep copy constructors and use.

Multiple inheritance and its implications; virtual class inheritance; example implementing an adapter design pattern

f. Templates – 2 Lectures
Motivation; comparison to Java generics; function templates; class templates.

Operator overloading requirements including assignment operator; creating a generic sort class as an example.

g. STL – 1 Lecture
History; philosophy; STL containers; STL algorithms; examples and debugging templated code; range based loop syntax.

h. Recent C++ features – 2 Lectures
Lambda functions (C++11); initialised captures (C++14); generic Lambdas (C++14); constexpr (C++11,14); aggregate member initialisers (C++14); return value
syntax, auto, decltype (C++11); strongly typed enums, enum classes (C++11);

i. Multithreading support in C++11 – 1 Lecture
Memory model; thread_local storage; mutex; atomic operations; futures and promises for asynchronous operation.

6. GUI Libraries – 2 Lectures
Approaches to GUI development in both C and C++.

7. Summary and Conclusions - 1 Lecture
a. Drawing together the topics covered in the module.
b. Revision and Exam Preparation

8. Exercises - about 10 * 2-hour Demonstrated Practicals
Formative practicals covering the main features of the C and C++ languages


Module Skills

Skills Type Skills details
Application of Number
Communication
Improving own Learning and Performance
Information Technology Intrinsic to the whole module
Personal Development and Career planning
Problem solving Programming in C and C++ and deciding which of the two languages is more appropriate for a given problem
Research skills
Subject Specific Skills Programming.
Team work

Notes

This module is at CQFW Level 5