CPSC 225 Intermediate Programming Fall 2006

CPSC 225 Course Information

This course continues the study of programming begun in CPSC 124. We switch to C++, a language widely used by professional programmers. C++ is similar to Java in many ways, but is a more complex language and offers many low-level features (such as direct manipulation of the computer's memory) that Java does not. C++ also removes some of the automatic checks and "safety belts" that Java provides.

The goal of this course is to build on your skills as a programmer, by reviewing and extending object-oriented programming concepts from CPSC 124 (including classes, inheritance, and polymorphism) and by adding new language features (including pointers, reference parameters, operator overloading, and templates), new algorithmic techniques (recursion), and new data structures (including linked lists, stacks, queues, trees, and, time permitting, the Standard Template Library). Continued attention will also be given to "how to think like a programmer" - that is, the fundamental logical thinking and problem-solving skills which are independent of the particular language being used.


Instructor

Stina Bridgeman
bridgeman@hws.edu
Lansing 312, x3614


Office Hours

M 12:30-1:30pm, W 3-4:30pm, R 10:30am-noon, F 9:30-10:30am
or by appointment (schedule)


Class Hours and Meeting Place

Lecture MWF 1:55pm-2:50pm, Lansing 301
Lab R 8:45-10:10am, Gulick 208


Course Web Page

http://math.hws.edu/~bridgeman/courses/225/f06/
You are expected to regularly consult the course web page for announcements, assignments, and most handouts.


Text

Absolute C++, 2nd edition
Walter Savitch
Addison-Wesley, 2006

Additional material will be handed out or posted on the course webpage.


Prerequisites

C- in CPSC 124, or instructor permission


Rationale

Computer science revolves around programs - creating programs, analyzing programs, making programs more efficient and easier to understand, making it easier to create and maintain programs, considering what programs can and cannot do...the list goes on. The first semester of programming is intended to introduce basic programming skills - the syntax and semantics of a particular programming language, and some of the basics of program design. The second semester of programming is intended to build a more sophisticated and confident programmer, by introducing more complex language features and placing more emphasis on program design, program organization, reusable code, and other features of the object-oriented programming paradigm. Attention will also be paid to several new data structures, to augment the arrays covered in CPSC 124. Programs are all about manipulating data, and choosing an appropriate data structure for a particular application is important for the program's efficiency and simplicity.


Course Content Overview

The course material can be divided into five major sections: program design with functions, program design with classes, memory management, data structures and abstract data types (ADTs), and testing and debugging. A few miscellaneous topics which don't fit cleanly into one of these sections will also be included. The objectives listed below paint - in broad strokes - what the successful student should be able to do at the end of each section.

Program Design with Functions: This part of the course will focus on program design using functions as the main organizational unit. Along the way, basic programming structures will be reviewed with an emphasis on aspects in which C++ is different from Java. Topics include C++ program structure and compilation, expressions, conditionals, loops, subroutines, functions, reference and const parameters, and I/O.

Objectives:

  • be able to successfully compile a C++ program consisting of a single file
  • be able to read a C++ program and explain how the computer executes each statement (i.e. understand the syntax and semantics of a C++ program)
  • be able to write a C++ program given pseudocode or an English description of what the program should do (i.e. be able to translate from English to C++)
  • be able to take a description of a program's requirements, create a reasonable design for the program (organizing the code into appropriate functions), and defend the decisions made

Program Design with Classes: Moving on to a more object-oriented view of the world, this part of the course will focus on designing larger programs using classes as the main organizational unit. Topics include classes, separate compilation and makefiles, inheritance, polymorphism, abstract classes, and virtual functions.

Objectives:

  • be able to successfully compile a C++ program consisting of many files
  • understand the paradigm of object-oriented programming
  • understand the importance and use of OOP features such as inheritance, polymorphism, and abstract classes
  • be able to read a C++ program using classes/inheritance/polymorphism and explain how the computer executes each statement (i.e. understand the syntax and semantics of a C++ program)
  • be able to write a C++ program using classes/inheritance/polymorphism given pseudocode or an English description of what the program should do and its organization (i.e. be able to translate from English to C++)
  • be able to take a description of a program's requirements, create a reasonable design for the program (organizing the code into appropriate classes), and defend the decisions made

Memory Management: One of the major safety belts that C++ removes is memory management - Java handles all of the memory allocation and deallocation automatically, while C++ gives the programmer more control. Topics include pointers, dynamically-allocated arrays, and the requirements for writing well-behaved classes which use dynamically-allocated memory.

Objectives:

  • understand dynamic memory management and when to use it
  • be able to read and write programs which make use of dynamic memory management
  • be able to read and write classes which make use dynamic memory management

Data Structures and Abstract Data Types (ADTs): Programs are, ultimately, all about manipulating data. How that data is stored and accessed can have a significant effect on how quickly a program runs, and how easy it is to write and understand a program. Topics include low-level data structures (arrays and linked lists), high-level abstract data types (vectors, lists, stacks, queues, and binary trees), relevant C++ language features (templates, operator overloading, friend functions), and, time permitting, the C++ Standard Template Library (STL).

Objectives:

  • know how to create, use, and destroy automatic arrays, dynamically-allocated arrays (including growable/shrinkable arrays), linked lists, and linked-structure binary trees
  • be able to describe the tradeoffs in efficiency and memory usage for arrays and linked lists (all variations), and to choose the most appropriate for a given application
  • be able to correctly implement the basic algorithms involving arrays, linked lists, and binary trees (e.g. traversal, insertion, removal, destruction) and to work out algorithms for new tasks
  • be able to describe and implement the typical operations for vectors, lists, stacks, queues, and binary trees given a particular implementation
  • understand the ideas of abstraction and generic programming and why it is important to create reusable code
  • be able to explain what an abstract data type is
  • be able to choose an appropriate ADT for a given application
  • be able to read and write programs using templated classes
  • be able to read and write programs involving overloaded operators
  • be able to read and write programs involving friend functions
  • know when it is appropriate to use inheritance, templates, overloaded operators, and friends for solving problems and be able to choose an appropriate solution for a particular application
  • (time permitting) know the properties and typical operations of the ADTs iterator, container, list, vector, deque, stack, queue, priority queue, set, map and the specifics of the STL implementations of each

Testing, Debugging, and Robustness: Once implemented, a program must be thoroughly tested in order to verify that it works correctly. If a test fails, then the error must be located and corrected. Topics include designing robust programs (i.e. error-checking), error-prevention (or at least early detection) strategies, designing comprehensive tests, and debugging strategies.

Objectives:

  • be in the habit of including error-detection mechanisms in your code
  • be able to read and write programs using assertions, and know when assertions are appropriate
  • be able to create a test suite to thoroughly test a program
  • be able to systematically track down the location and cause of a bug in most circumstances
  • know the meaning of and be able to fix common compiler and linker error messages, and be able to at least guess the meaning and cause of the majority of messages encountered

Miscellaneous: A few other useful topics will be covered which don't quite fit into one of the other categories. These include file I/O, working with strings, and recursion.

Objectives:

  • be able to read and write programs which read and write files
  • know the common string-manipulation routines
  • know the difference between C-strings and C++-style strings and when each is appropriate
  • understand and be able to use recursion to solve problems

Assignments and Evaluation

Labs: Most lab meetings will have a short lab exercise. These exercises will reinforce specific concepts from class. It is intended that most lab exercises will be completed and handed in during the lab period, but solutions may be handed in any time up until the start of the following week's lab without penalty.

Homework: Homework will be assigned most weeks and is typically due one to two weeks after it is assigned (specific due dates will be given with each assignment). Homework assignments will generally be programming assignments (though they may also contain written problems) and will emphasize program design and integrating multiple concepts from class.

Journals: A regular journal is required, and will be handed in along with each homework assignment.

Exams: There will be two midterm exams and a final exam. The first midterm will be in class, written (no programming on the computer), and closed book/notes. The second midterm and the final exam will be take-home exams, open book/notes, and may involve some programming on the computer. The final will be cumulative, but will have a somewhat greater emphasis on material covered after the second midterm (as much as it is possible to do so). Details on the material covered and the exact format of each exam will be announced prior to the exam.

Final Grades: Final grades in this course will be computed as follows:

  • Labs: 15%
  • Homeworks and Journals: 45%
  • Midterm Exams: 25% total (12.5% each)
  • Final Exam: 15%

Attendance and Participation: You are expected to attend and participate in class and lab. The course material is cumulative and many topics will be covered, making it difficult to catch up if you fall behind. Missing class - for any reason - often results in lower grades because important material was missed. Similarly, not participating in class even if you are physically present may mean that you aren't actively following the material and thus may be missing more sophisticated or subtle points.
Attendance will be taken regularly and more than three absences (for any reason, in class or lab) will lower your final grade by 0.5% per additional absence, up to half a letter grade. No distinction is made between excused and unexcused absences when computing the final grade; however, the number of unexcused absences is considered when considering borderline final grades. See the course policies for the definition of unexcused and excused absences.

Late Policy and Collaboration: See the course policies for the late policy and collaboration policy.


Valid HTML 4.01!