PROGRAMMING 1 M - Z

Academic Year 2017/2018 - 1° Year
Teaching Staff: Giovanni GALLO and Fabrizio MESSINA
Credit Value: 9
Taught classes: 36 hours
Exercise: 36 hours
Term / Semester:

Learning Objectives

The course presents fundamentals of programming computers by adopting C ++ as the reference language. In particular, basic concepts of structured programming and the OOP (Object-Oriented Programming) are introduced. Furthermore, encoding of fundamental algorithms and some OOP software design techniques are discussed.

Knowledge and understanding the primary objective of the course is the students' acquisition of the "philosophy" of the structured programming and of the OOP, as well as the detailed knowledge of the syntax and the semantics of the C++ programmig language.

The course pays particular attention to the development of well-written and well-structured code using the basic techniques for software development in the Object-Oriented paradigm.

Applying knowledge and understanding the goal of the course is to provide the tools to achieve the following skills: - Translate algorithmic ideas into code; - Design, describe and implement programs in C++; - Debug C++ programs with professional tools; - Understand simple recursive algorithms; - Analyze and describe Object-Oriented solutions using UML (Unified Language Modeling) class diagrams; - Design, implement and correctly use hierarchies of polymorphic classes and generic code; - Read, understand and analyze third-party C++ code also in terms of efficiency; - Orient yourself in the documentation of the libraries.

Making judgments: through the examination of a large number of examples of Object-Oriented programs and various practical programming sessions, the student will be able, both independently and in a cooperative form, to analyze problems and design and implement related software solutions.

Communication skills the student will acquire the necessary communication skills and expressive appropriateness in the use of technical verbal language and UML visual language in computer programming.

Learning skills the course aims to provide to the student the theoretical and practical methodologies needed in professional contexts and, in particular, the ability to formulate ad-hoc algorithms for problem solving and the opportunity to learn quickly the C++ programming language.


Detailed Course Content

Part A - Fundamental of Imperative and Object Oriented Programming (3CFU)

  1. Introduction to programming:
    • Problems; Algorithms; Flowcharts.
    • Variables; Expressions; Assignments.
    • Structured linear notation; Böhm-Jacopini's theorem.
    • Array data structure.
  2. The C++ Programming language.
    • Programming languages: machine, assembly and high level.
    • Translation problem: compilation and interpretation.
    • Installation of the compiler; First program: Editing, Compiling, Running, Debugging.
  3. Constructs of the language
    • Data types; Predefined operators; Type conversions; I/O management.
    • Flow control: if-then-else selection and switch constructs, while and do-while constructs.
  4. Introduction to Object Oriented Programming
    • Objects: state and behavior; Classes; Instance of objects: constructors.
    • Messages: structure, parameters, types of messages.
    • Composition and aggregation of objects.
  5. Arrays and character strings
    • Arrays of fundamental types and array of objects. Two-dimensional arrays.
    • Iterative construct for.
    • Character sequences: char arrays and string objects.


Part B - Advanced features of the C ++ language (2,5CFU)

  1. Class definition
    • Class structure: attributes and operations; Access control.
    • Implementation of methods: return value, parameters by value and by reference; Variables, allocation and their scope.
    • C++ constructors.
  2. Pointers and Arrays
    • Pointers; Addressing and dereferencing operators.
    • Arithmetic of pointers. Pointers and arrays; Pointers as a parameter; Dynamic memory allocation.
    • Function pointers; The pointer this; Multilevel addressing. References; enumerations; Unions; Bit fields.
    • 2D Arrays: Arrays dynamically allocated, Arrays as parameters, Sparse Arrays; Multidimensional Arrays
  3. Advanced elements of the language
    • The const keyword for pointers and methods; Standard arguments for function parameters. Namespace clause; Forward declarations; Inline functions.
    • Implementation of the composition / aggregation relationship.
    • Overloading methods; Constructors and destructors. Copy constructor.
    • Functions and friend classes; Static attributes and methods.

Part C - Programming Techniques (0,5CFU)

  1. Notable algorithms
    • Search algorithms: linear in an ordered unordered sequence, with sentinel, search for the maximum / minimum, iterative dichotomous search.
    • Sorting algorithms: Bubblesort, Selectionsort, Insertionsort.
    • Fusion Algorithms: Natural-merge.
  2. Recursive methods.
    • Definition of recursive methods; Calculus of the factorial.
    • Management of calls to methods by activating the stack.
    • Queue and non-queue recursion.
    • Efficiency of recursion: Fibonacci numbers.
    • Recursion applications: dichotomous research, Tower of Hanoi, Binary segmentation of a ruler.

 

Module D - Object-oriented software design (3CFU)

  1. Inheritance
    • Definition; IS-A relationship; Derivations and methods of access: protected.
    • Hereditary hierarchies of classes. Methods overriding. Operator :: scope resolver.
    • Initialization list and execution modalities of inherited constructors and destructors.
    • Multiple inheritance. Virtual classes
  2. Polymorphism and abstract classes.
    • Pointers to derived classes; Virtual functions; Late-binding. Polymorphism.
    • Hereditary hierarchies of polymorphic classes.
    • Pure virtual functions; Abstract classes; Interfaces.
    • RTTI: typeid and dynamic_cast.
  3. Object-oriented design principles
    • ​​UML diagrams for classes.
    • Design and analysis in the OOP paradigm.
  4. Overloading of operators.
    • Type of overloading of operators: non-member, friend, member.
    • Prefix and postfix operators "++" and "-".
    • Overview of assignment operators "=", indexing "[]" and "()" and cast.
    • I / O operators.
  5. Generic programming.
    • Template functions and template classes.

Textbook Information

  1. H.M. Deitel, P. J. Deitel, C++ How to Program – Pearson
  2. Eckel, Thinking in C++, Vol. I, 2°Ed. (also online)
  3. Horstmann, C++ for everyone, 2°Ed. – Wiley (also online)
  4. Lippman, Lajoye, C++ Primer, 5°Ed. – Addison Wesley
  5. Pohl, Object-Oriented Programming Using C++, 2° Ed. – Addison Wesley
  6. Schildt, C++ The complete reference, 4°Ed. – McGraw-Hill (also online)
  7. Stroustrup, The C++ programming language, 4°Ed. – Addison Wesley

 

Books (1), (2), (3) and (6) are recommended for beginners.
The book (3) is strongly recommended for beginners because of the large amount of exercises in it.
Books (4) and (5) are intermediate level and they are recommended to those who are familiar in programming.
The book (7) is advanced and it is recommended to those who are skilled in programming.