Learning objectives
Knowledge and understanding
Object Oriented Programming is based on a few principles (encapsulation, inheritance, polymorphism, etc.) that years of experiences have shown to be fundamental for the design and development of clear, concise, reusable and
maintainable software. Tools and techniques that support an object oriented methodology are provided by most of the mainstream programming languages. The course will present the advanced characteristics of the C++ programming language, showing how these can be exploited to achieve the goals mentioned above.
Applying knowledge and understanding
Each programming concept presented in the course will be explained in the context of a minimal working example, so as to highlight its essential characteristics.
Making judgements
The study of alternative solutions to the same problem will allow for a critical comparison of the different approaches, so as to highlight those contexts where a specific technique is to be preferred to alternatives.
Learning skills
The study and application of the main programming techniques on simple examples is propedeutic to their adoption in more general contexts, where it is also necessary to address the possible interactions between the many components of the system under design.
Prerequisites
A working knowledge of the imperative fragment of the C++ language is assumed.
Course unit content
A summary of C++: data types; expressions; statements; functions; scope and life cycle; function overloading; classes.
Introduction to the new constructs of the ISO C++ 2011 standard.
Programming by contract: pre-conditions, post-conditions and class invariants.
Initialization, assignment and destruction; copy vs move.
Exceptions and resource management; dynamic memory management techniques.
Single inheritance: containment versus private inheritance versus public inheritance.
Dynamic polymorphism: virtual functions; the Liskov's substitution principle.
Design of software interfaces: concrete types, abstract types, interface classes and implementation classes; multiple and virtual inheritance.
Static polymorphism: function templates and class templates.
The Standard Template Library: containers, iterators and generic algorithms; function objects.
Development environment: the compiler g++; the debugger gdb; automating the software build process: make; version control: git.
Documentation of software interfaces: doxygen.
Full programme
Bibliography
B. Stroustrup.
The C++ Programming Language,
Fourth Edition, Addison-Wesley.
S. Lippman, J. Lajoie.
C++ Primer,
Third Edition, Addison-Wesley.
B. Eckel.
Thinking in C++, Volumes 1 and 2,
Second Edition, 2003.
Teaching methods
Lectures and guided exercises.
Assessment methods and criteria
The exam consists of a written test and an optional oral interview.
The written test is composed of exercises and open questions on the course contents; the oral interview consists in further questions on the course contents and/or a discussion of the written test. The oral interview, if any, must occur in the same exam slot as the written test.
Students with a grade between 18 and 26 in the written test will pass the exam (without the oral interview); the oral interview is reserved to students with a grade greater than 26 or between 16 and 17 in the written test.
Other information
2030 agenda goals for sustainable development