Week 7 - Program Design

Learning objectives

Upon finishing this learning module, you should be able to:

  • Design a program using functional decomposition
  • Use a test driven development methodology to develop code

Day 1

Day 2

Day 3

Day 4

  • Design activity

Online Activity Outline

Wrap up functions

Read 6.7 & 6.9 - they cover some other techniques that can be used while defining functions. This video recaps the material:

Multiple file compilation

Read 6.8 and skim LearnCpp.com Chapter 2.10-2.11 which covers header files (not covered well in the book).

This first video shows the desired structure of a multi-file project:

This one shows you how to get .h/.cpp files set up correctly:

This video covers how to compile multiple files from the command prompt:

Test Driven Development

Read through the final section of the UnitTesting Guide on creating Combo projects. This video demonstrates how to do the setup:

Then watch this video that briefly covers the concept of Test Driven Development:

At this point, you should start doing the setup for this week's assignment. If you have a setup problem, ask about it early. It almost certainly is easy to fix, but trying to do so by trial and error is likely to be very frustrating.

Function and Program Design

Finally, read 6.15 on how to go about designing and building programs using functions. Skip the video in the chapter and use the one below.

This video talks about what makes for a good function:

This video recaps the process of designing the program described in 6.15, but shows using unit tests to help develop it:

Start working on the actual code for the assignment.

Design Activity

Time to practice thinking about designing functions to solve a problem. Here is an activity to practice thinking through a problem and identifying functions. It is designed to take 30-60 minutes depending on how much time you choose to spend in each part.

As you work on it, remember that you are not shooting for perfection... you are just exercising your design muscles.

Here is a sample of what a completed version might look like - after you finish each section, you can compare what you have to what you see here. Not to see if you are right or wrong, there are many ways to attack this problem, but just to sanity check the format of your work and to see another person's version of designing some functions.

Optional Extras

More on Testing

More on Function Design