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
Schedule
Day 1
- Holiday - start in on material if you have time!
Day 2
Day 3
- Test Driven Development
- Check out assignment, do the project setup
Day 4
- Function and Program Design
- Start the assignment
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). Then watch this video that talks about some other techniques for building and documenting complex programs and libraries of functions:
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 Subdirectory 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. Create a Subdirectory project with a "real" program and a unit test project. Make the .h and .cpp files to hold your functions in the real project and link to them from the unit test project. To test the setup, move the sample functions from the unit tests project into the .cpp file in your "real" project, declare them in the .h, and make sure you can still run the tests. 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.
Optional Extras
More on Testing
- A thorough reading on test driven development.
- If you prefer learning via humorous slide shows, try this: Unit testing presentation (Press arrow keys to advance/backup)
More on Function Design
- LearnCpp.com Chapter 2.5 and 2.12 have some good coverage of how to design functions and programs.