CS177/CS477 C++ Programming
Fall 1999

Instructor

Roger Hartley, SH 148, telephone 646-1218
Office Hours: Tuesdays, 2:00 - 4:00 pm.; Fridays, 2:00 pm - 4:00pm; also by appointment.

Email: rth@cs.nmsu.edu

Internet: http://www.cs.nmsu.edu/~rth/cs/cs177

Where and when

Room: SH115
Time: MWF 10:30 - 11:20 am.
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, 2nd. edition, published by McGraw Hill, 1998. 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. A useful reference book is the C/C++ Programmer's Reference, by Herbert Schildt, published by Osborne, 1997.

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 breakdown by weeks is:

[1] Computers, languages, compilers, software development

[2] Object-oriented software development: objects, classes, methods; programs as models

[3] Overview: C vs C++; encapsulation, inheritance, polymorphism

[4] Basics: variables, assignment, control flow, types, simple I/O

[5-6] Classes, object construction, access control, method invocation, accessor functions

[7-8] Modularity: global vs class; functions, overloading, parameters and arguments, scope

[9] Abstract data types: operator overloading, libraries, header files, access control

[10] The String and Vector classes vs C-style pointers

[11] Dynamic variables; new and delete, the copy constructor

[12-13] Inheritance: modeling the IS-A relationship, base and derived classes,

[14] Templates: parameterized types

[15] The Standard Template Library

[16] Namespaces and exceptions

Calendar

[1] 8/25 First day of classes

[2] 9/3 Deadline for registration/course addition

[3] 9/6 Labor Day holiday

[8] 10/13 Mid-term test

[9] 10/20 Last day to drop with "W"

[13] 11/19 Moratorium: oustanding assignments not turned in will receive 0

[14] 11/22 Last day to withdraw from the university

11/24-11/26 Thanksgiving holiday for students

[16] 12/10 Last day of classes, Moratorium: oustanding assignments not turned in will receive 0

[17] 12/13 Final exam

[18] 12/21 Final grades due

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. The EZ window system described and used in the textbook is available for all three systems.

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.