Instructor

Roger Hartley, SH 148, telephone 646-1218
Office Hours: Mondays, 4:00 - 5:00 pm; Tuesdays, 10:00 am - 12:00 pm.

Where and when

Room: SH113
Time: MWF 9:30 - 10:20
For the first four or five weeks, the Friday session will be spent in the J. Mack Adams lab. SH118.

Textbook:

C++ Program Design, by Cohoon and Davidson, published by Irwin, 1997. The definitive guide to C++ is The C++ Programming Language (2nd. edition), by Bjarne Stroustrup, who designed the language. While not essential for this course, this book is useful if you are going to use C++ for applications programming later.

Course outline

C++ is a computer language that attempts to do two incompatible things. The first is to be an efficient implementation of the ideas in object-oriented programming. The second is to encompass, and be sympathetic to, the ideas in the strongly-established language C.

The fact that it succeeds at all is strongly in favor of the tenacity of its designer, Bjorne Stroustrup. Its weaknesses are largely due to the idiosyncracies of C, and not due to poor implementation. It is the best and most-widely used object oriented language available today.

I will teach C++ as an implementation of an object-oriented language. Since the textbook, and the course, delves deeply into the language, it would be excellent to have a knowledge of C already, or at least an imperative language like Pascal, Ada, Fortan or Basic, although it is not essential to succeed in the course. C++ is actually not "the next C"; it is a different language. For instance although strings and arrays form C are available, I will encourage use of the string and vector classes from the standard C++ library.

So, we will study the principles of object-oriented programming and how C++ allows implementation of these ideas. The fundamental notions here are abstract data typing through encapsulation and data-hiding, message-passing, polymorphism and inheritance.

Syllabus

The course is organized into six sections, each of which will address a topic from programming methodology. The content of each topic will use C++, but the principles are applicable to any programming language. In this way, you will gain a good set of programming skills, as well as a thorough knowledge of C++. The six topics are:

  1. Code reading - from small fragments to whole functions.
  2. Code simulation - by hand, with paper and pencil.
  3. Program design - top-down stepwise refinement - classes and object-oriented design
  4. Program testing - test sets, limits, unexpected inputs.
  5. Program debugging - assertions, using watches as a substitute for hand simulation, extra debugging code.
  6. Program modification - adding requirements, changing requirements, improving efficiency, improving coding.

The breakdown by weeks is:

[1] Introduction, getting started in the lab, UNIX: login/logout, files/directories, ls, cd, mkdir, rm, more/less, gemacs, g++, e-mail, X Windows.
[2] Intro. to computer languages: source files, compiling, object files, executable files, libraries. Code reading: syntax vs. layout, tagging, names, keywords, types, operators, punctuation, comments.
[3] Code reading: name scope, declarations and definitions, classes, functions, blocks, loops, levels of commenting.
[4-5] Code simulation: semantics vs. behavior, paper and pencil tracing, diagrams for memory layout, values, expressions, function calls.
[6-7] Program design: Flow charts, tasks, subtasks, object-oriented design.
[8-10] Program testing: interactive programs, expected input, unexpected input, input validation, error messages, error recovery, pathological cases, simple cases, generic cases, representative cases, test data files.
[11-12] Program debugging: trace statements replace hand simulation, assertions for exceptions, debuggers, watches, stepping, additional debugging code.
[13-15] Program modification: adding requirements, changing requirements, improving efficiency, adding coding, improving coding.

Calendar

[1] 1/13-1/17 First class: Jan. 15th.

[2] 1/20-1/24 Deadline for adding: Jan. 24th. Lab. 1: Edit/Compile/Run/Print.

[3] 1/27-1/31 Lab. 2: Code reading

[4] 2/3-2/7 Lab. 3: Hand Simulation

[5] 2/10-2/14 Lab 4.

[6] 2/17-2/21 Lab 5: Assignment 1: design

[7] 2/24-2/28 Test 1. Wednesday 26th.

3/3-3/7 Spring break: no class

[8] 3/10-3/14 Drop date: Monday 10th. Assignment 2: testing

[9] 3/17-3/21

[10] 3/24-3/28 Spring holiday: Friday 28th.

[11] 3/31-4/4 Moratorium: Friday 4th. late work receives zero after this date.

[12] 4/7-4/11 Assignment 4.

[13] 4/14-4/18

[14] 4/21-4/25 Assignment 5: debugging.

[15] 4/28-5/2

5/5-5/9 Review. Assignment 6: modification.

5/12-5/16 Exam week. CS177, Friday 16th. 8-10 am.

Resources

The programming problems can be completed in two ways. Either an account on our computer science SUN network will give you access to UNIX and the C++ compiler g++, or you will need access to a PC running Microsoft Visual C++ or Borland Turbo C++ at home or in the Jacobs lab.

Assessment

There will be one mid-term test and a final comprehensive examination. There will also be four or five lab. exercises early on in the course, and then five or six programming problems starting out easily and graduating to fairly hard at the end of the course. It may also be necessary to give take-home assignments for certain parts of the course. The assignment of credit is as follows:

My grading is always flexible, but justice will also be done! ! The penalty for late work is that it receives a maximum C grade, but there will be two cut-off dates. A moratorium date is included in the calendar after which, any work that is due but not handed in will receive a zero. The first day of exam week is the last day for handing in work for credit.