Object Oriented Programming

Base Knowledge

Programming in C language and algorithms. It is important that students have passed the 1st year Introduction to Programming and Programming curricular units.

Teaching Methodologies

The classes are theoretical and practical. In the theoretical classes, an expository methodology is used to present the theoretical foundations of the subject with application examples, and student participation is encouraged with the aim of fostering an interactive learning environment. In the practical classes, students apply the knowledge from the theoretical lessons by developing applications under the supervision of the instructors, and student participation in the class is required. Outside of class, students work in pairs to develop a project that applies and deepens the topics covered in the lessons, and the project is subject to evaluation.

Learning Results

1. Acquire object-oriented programming skills.

2. Acquire object-oriented programming skills in C++.

3. Acquire the ability to develop console C++ applications.

4. Acquire the ability to develop applications based on encapsulated and polymorphic data structures.

5. Improve the ability to organize, research, plan, justify solutions and document software projects.

6. Improve the aptitude for autonomous information research.

Program

General introduction to object-oriented concepts and the C++ language

  • General Concepts of Object Oriented Programming
  • Encapsulation, Polymorphism, Inheritance
  • SOLID Principles

 

Some differences between C and C++

  • Standard data input and output Structuring projects in .h and .cpp
  • Comments in C++
  • Definition of local variables
  • Predefined types
  • Type cast
  • References
  • Constants
  • Functions
  • Overloaded Functions
  • Functions with default arguments
  • Ambiguity situations in overloading

 

Classes

  • Class definition syntax
  • Classes as Structure evolution
  • Member functions
  • The this pointer
  • Inline Functions
  • Visibility (accessibility)
  • Constructors
  • Initialization syntax () and {}
  • initializer_list
  • Non-dynamic arrays of objects
  • Destructors
  • Inline member functions
  • static members: data and functions
  • constant member functions
  • friend functions

 

Objects life cycle

  • Destructor
  • Introduction to copy construction
  • Assignment. Introduction to the assignment operator

 

Dynamic objects

  • The new and delete operators
  • Dynamic arrays of objects

 

Operator overloading

  • General Introduction to Operator Overloading
  • Operator Functions
  • Unary and binary operators
  • Choice of member operators vs. non-member operators
  • Conversions operators

 

Composition and aggregation

  • Meaning of composition versus aggregation
  • Composition without dynamic memory – syntax, initialization requirements. Constructors and Destructors calling order
  • Aggregation by reference and pointer

 

Composition through dynamic memory

  • Concept of managing own resources in classes
  • Data members that are pointers to dynamic memory
  • Destructor, Assignment Operator, Copy Constructor

 

Object composition

  • Composition of objects and constructors
  • Basic Types in initialization list
  • Composition of objects and destructors

 

Inheritance in C++

  •  Derived classes
  •  Composition vs. derivation
  •  Forms of derivation and accessibility
  •  Constructors and destructors
  •  Copy constructor and assignment operator on derived classes
  •  Inheritance and overloaded functions

 

Polymorphism

  • Upcasting
  • Virtual functions
  • Abstract classes and pure virtual functions
  • Overloaded virtual functions and redefinition in derived classes
  • Virtual destructors

 

C++ Exception Mechanism

 

Introduction to the STL library

  • Notion of container and iterator
  • Classes of containers. Container manipulation.
  • Class vector. Class map. Classes for string manipulation. String, istringstream, ostringstream
  • Classes for stream I/O support ifstream and ofstream

 

Introduction to smartpointers in C++

  • unique pointer
  • shared pointer
  • weak pointer

Introduction to templates and STL library

  • Class Templates
  • Template arguments
  • Function templates

Curricular Unit Teachers

João António Pereira Almeida Durães

Grading Methods

Assessment is composed of four components

i)                    Written exam – 11 points

ii)                  Practical assignment – 4 points

iii)                Written test – 3 points

iv)                Evaluation in theoretical classes – 2 points

 

i) Written exam: weight of 11 points, mandatory, with minimum grade requirements. This exam covers material from both theoretical and practical classes.

  • Only materials previously authorized by the instructor may be consulted.
  • If the instructor specifies a registration method for the exam, registration will be mandatory in order to access the exam. This registration does not replace the registration with the academic services.
  • The exam has a minimum grade requirement of 35%. Failure to reach this minimum results in failure of the course.
  • This written exam is the only assessment component carried out during exam periods (regular, resit, special, etc.). All other components are completed only during the semester or at its end.

 

ii) Practical assignment: weight of 4 points, no minimum grade requirement.

  • The assignment must be completed in groups of up to two students. Group formation is mandatory through an electronic platform, by the deadline indicated in the assignment description. After that date, students who have not registered must complete the assignment individually.
  • The assignment must be completed during the semester. There is no alternative schedule or replacement option. Failure to submit results in loss of its grade.
  • The assignment has two milestones: the intermediate milestone (M1) and the final milestone (M2), with specific requirements defined in the assignment description.
  • Milestone M1 takes place mid-semester, on the date indicated in the assignment description. Students must present their work and demonstrate achievement of the defined objectives. The assessment of M1 does not contribute to the final grade of the assignment but determines access to the written test. This assessment may differ within the same group. The grade of M1 does not affect continuation of the assignment nor access to the exam.
  • Milestone M2 takes place at the end of the semester, on the date indicated in the assignment description. Students must present their work, demonstrate achievement of the defined objectives, and defend its quality. The M2 grade corresponds to the final assignment grade, and may differ within the same group.
  • Work completed in the immediately preceding year may be reused, provided it achieved 50% or more. In this case, students gain access to the written test without the need for a new presentation. This reuse is only valid if registered in the electronic platform provided by the instructor.

 

iii) Written test: weight of 3 points, no minimum grade requirement.

  • The written test takes place mid-semester, after submission of Milestone 1 of the practical assignment. It is held exclusively during the semester and cannot be replaced by any other assessment or during exam periods. Failure to take the test results in loss of its grade. However, not taking the test does not prevent participation in the other assessment components.
  • Students may take the test if they submitted Milestone 1 of the assignment and achieved at least 50% of its objectives, or if they were exempted from the assignment as described above.
  • The test covers content from both theoretical and practical classes up to the date of the test. There is no restriction on the scope of the written exam based on the content of the test.

 

iv) Evaluation in theoretical classes: weight of 2 points.

  • In some theoretical classes, there will be a question to be answered in writing by each student. The set of questions is worth 2 points, with the actual score obtained by the student proportional to the number of questions correctly answered out of the total questions asked.
  • The only scheduling for classes where questions will be asked is: a) no questions will be asked in the first week; b) there will be a maximum of 10 classes with questions, possibly fewer. Per week, a student can answer, at most, one question.
  • Only students present and registered in the class may answer the questions. Students officially recognized as working students may alternatively answer one additional question during the regular exam period. This alternative is mutually exclusive: answering in class excludes the option of the additional exam question.
  • Except for the working-student scenario described above, theoretical-class questions are not optional: students who do not answer lose the corresponding points, with no possibility of recovery.

 

The final course grade is the sum of the written exam, the written test, the practical assignment, and the evaluation in theoretical classes.

All assessment activities are in-person.


    Internship(s)

    NAO

    Bibliography

    Main references

    Brokken, F. B. (2024).  C++ Annotations Version 13.0.0, University of Groningen publishing, http://www.icce.rug.nl/documents/cplusplus/   –  online

    Stroustrup, B. (2000). A linguagem de programação C++, Bookman – 1ª-1-359

     

    Auxiliary references

    Lippman, S.B., Lajoie, J., Moo B. E. (2013).  C++ Primer (5th ed.), Addison-Wesley

    Eckel, B. (2000). Thinking in C++  Vol.1 (2nd ed.), Prentice Hall Inc., http://www.bruceeckel.com/  –  1A-1-380 / Online

    Deitel, P. J., Deitel, H. M. (2010). C++ How to Program (7th edition), Prentice Hall Inc. – 1A-1-425