Proposed APCS C++ subset

[ philosophy | subset | classes ]

There are two different, but overlapping exams that are part of the APCS program. The A exam corresponds roughly to CS1, the AB exam corresponds roughly to CS2. All topics that are part of the A course are also part of the AB course.

A description below describes the proposed APCS C++ subset. Basic parts of C++ common to other programming languages (e.g., while and if/else statements) are not mentioned, but are part of the APCS subset. The subset description does not address all the topics that are part of the APCS courses. The full list of topics can be found in the College Board's AP Course Description in Computer Science booklet. For example, sorting and searching are parts of both courses and are listed in the Course Description.


Defining the APCS C++ Subset: A Philosophy

Since C++ is a large and complex language, the Advanced Placement Computer Science (AP CS) course will not cover the entire language; a restricted subset of C++ has been chosen for use in the AP CS course and examination. The criteria for defining the subset were as follows:

The subset provides several auxiliary classes, including vector and string classes with facilities similar to those available in languages like Ada, Java, and (extended) Pascal.

An important feature of the subset is its inclusion of classes and related features that facilitate the design of programs based on modern concepts of data abstraction, encapsulation, and information hiding. Object-oriented programming in its full glory is not covered --- in particular, features of C++ that allow classes to be related by inheritance are not part of the subset. The subset does, however, support the use of what is often called an "object-based" approach to programming, emphasizing data abstraction and encapsulation.

C++ counterparts to Pascal features that allow avoidance or easier detection of common programming errors are retained in the subset. Examples are type-safe input and output and range-checked vector and string classes.

C++ is not C. The AP CS subset includes stream input/output, reference parameters, and definition of constants using the const keyword, eliminating the need for their C counterparts. The vector and string classes provided in the subset are significant improvements over C's pointer-based realizations of arrays and strings.

The subset omits a number of C++ features that are not necessary to design and implement large programs as part of an AP CS course. Some features, such as inheritance, are not included because they are not part of the AP CS course. Other language features either are redundant, are easily replaced, or do not provide sufficient benefit to be included in the subset. What remains is sufficiently extensive to permit large and complex programs to be developed using generally accepted C++ idioms. Additional details of the AP CS subset of C++ are summarized in the following pages.


AP Computer Science C++ Subset

The C++ subset is accessible as a separate document.

A rationale explaining parts of the subset is accessible as well.


Proposed Classes

Commented header files for the proposed APCS classes are available. Beta implementations of these classes are also accessible.

In the next month, versions of these classes tuned to particular compilers will be made available. In particular, some compilers, including Borland Turbo C++ (for Dos/Windows) and Metrowerks Codewarrior (for Mac OS) do not include the type bool as a built in type. A header file bool.h is available for use with these compilers. In this preliminary release, the #include for this file will need to be uncommented, e.g., it appears as a comment

// #include "bool.h" Future versions of these classes will be adapted to major compilers. In addition, a future version will use exceptions (although exceptions are not part of the APCS C++ subset).
All classes/code is available as a tar file or as a compressed tar file (web browsers should be able to handle these) so that you don't need to download each class individually.

* bool.h

* apqueue.h and apqueue.cpp

* apstack.h and apstack.cpp

* apstring.h and apstring.cpp

* apvector.h and apvector.cpp

* apmatrix.h and apmatrix.cpp