YALE UNIVERSITY
DEPARTMENT OF COMPUTER SCIENCE
CPSC 427: Object-Oriented Programming | Handout #5 | |
Professor M. J. Fischer | October 4, 2016 | |
Problem Set 4
Due before midnight on Monday, October 17, 2016.
This assignment is designed to give you experience in refactoring existing code. It will also be good preparation for the midterm since it will encourage you to look closely at some of the demo code from class.
Example 08-BarGraph has been extensively discussed in class. Several design issues, bugs, and places for improvement were mentiond. The process of taking an existing piece of code and modifying it to improve its design and style while preserving functionality is called refactoring. The purpose of this assignment is to give you a deeper understanding of the many design decisions that went into the relatively simple bar graph program, and to experience what is involved in refactoring.
In particular, any changes are likely to result in new compiler errors as variables are renamed, types are changed, and code is moved around. Since you are starting with code that compiles, a compiler error that results from a change you made shows you where to look for the problem. You should work a little bit at a time and recompile after each related group of changes to make sure you haven’t broken things.
You should make the following changes in 08-BarGraph:
Your assignment will be graded according to the scale given in Figure 1 (see below).
# | Pts. | Item |
1. | 1 | All relevant standards from PS1 are followed regarding submission, identification of authorship on all files, and so forth. |
2. | 1 | A well-formed Makefile or makefile is submitted that specifies compiler options -O1 -g -Wall -std=c++14. |
3. | 1 | Running make successfully compiles and links the project and results in an executable file bar. |
4. | 1 | Your program gives the same output as 08-BarGraph except for the debugging comments written to cerr, which should be eliminated. |
5. | 16 | Each of the changes required section 2 is worth the indicated number of points. |
20 | Total points. |
|