Overview
This week we will take time to reinforce and deepen our understanding of
how to create objects in C++, and practice separating our objects into
header (.h) and source (.cpp) files.
Project: Have a Little Class!
Motivation
The learning objectives of this project are:
- to gain practice separating C++ objects into their three parts: header file, source file, and testing program.
- to practice with the use of doctest for the last of these parts.
Process
With me, we have 12 students in this class, which will make 3 project groups of 4 people each. I let Python choose, and it gave us the following teams:
Meet your new team
This is a group project, and the psuedorandomly selected groups for it are:
- Evan, Sean, Robbie and Stephan
- Giselle, Jeff, Waleed and Dimitrios
- Delanie, Mason, Antoan and Nathan
- Choose one of the projects listed in Chapter 11 Exercise Set 2: ncurses Projects.
-
Assuming your project is
ourproject, create three files:ourproject.h,ourproject.cpp, andtest_ourproject.cpp. The first of these will hold your object definition and member function prototypes, and the second the member function definitions. -
In the third file, start out with this:
#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN #include <doctest.h> #include "ourproject.h" using namespace std; TEST_CASE("Test can create and render OurObject") { OurObject our_obj(); CHECK(ourobj.to_string() == "This is Our Object"); }Fill in the header and source files so that this first test passes.
We meet three times this week, so we'll see how far we can get during those class periods and decide how to proceed on Friday.
Friday, December 5th
Classwork
We will work on our group projects during the full class period today. As discussed last class, the due date for these projects will be extended to give us all time to achieve a meaningful result. We'll talk about the schedule during class.
Homework
Continue working your way through Learn Makefiles: With the tastiest examples as assigned last class.
Once again, this homework is due by 11:59 pm on Saturday, December 6th so that I can have time to evaluate it on Sunday.
Wednesday, December 3rd
Classwork
We will begin class with a very brief discussion of the homework from Monday.
Then we will look at how the Robots group is using Git and Make in its project workflow.
The rest of class will used for working on our projects.
Homework
Let's use homework time both today and Friday to complete as much as we can of Learn Makefiles: With the tastiest examples.
Create a subdirectory named learn_make where you can commit some
of the work you do as part of studying the tutorial, including trying out the
examples from the tutorial and any other experiments and notes
you care to add. (Note: this is an open-ended
description of
requirements, but it is understood that evidence of regular engagement
through frequent commits is needed for an A evaluation).
This homework is due by 11:59 pm on Saturday, December 6th so that I can have time to evaluate it on Sunday.
Monday, December 1st
Classwork
During class we will work in our groups on our projects.
Homework
In a file in your git repo named essence_of_oo.md, answer the
three questions that were given to you before we watched Uncle Bob's video
last week:
- What is code rot, and why does it happen?
- What is the design of a software product?
- According to Uncle Bob, what is the essential characteristic of Object-Oriented design?
This homework is due by 3 pm on Tuesday, December 2nd so that I can have time to evaluate it before class on Wednesday.