Old but good C++ textbook available for free

  • Context: Other 
  • Thread starter Thread starter jtbell
  • Start date Start date
  • Tags Tags
    C++ Textbook
Click For Summary
SUMMARY

The textbook "A Computer Science Tapestry, second edition" by Owen Astrachan, published in 1999, is now available for free online. This resource emphasizes modern C++ features such as the std::vector and std::string classes over traditional C-style arrays and pointers. The book introduces pointers later in the curriculum, allowing for a stronger focus on object-oriented programming. Despite its age and reliance on custom libraries, the content remains relevant for teaching foundational C++ concepts.

PREREQUISITES
  • Understanding of C++ programming language, specifically C++98 standards
  • Familiarity with object-oriented programming principles
  • Basic knowledge of standard template library (STL) components like std::vector and std::string
  • Experience with C++ compilers and header file management
NEXT STEPS
  • Explore the differences between C++98 and C++11 features
  • Learn about modern C++ best practices for using std::vector and std::string
  • Investigate the transition from C++ to Java in educational curricula
  • Research methods for updating legacy C++ code to modern standards
USEFUL FOR

Students, educators, and software developers interested in foundational C++ programming concepts and those looking to utilize historical resources for teaching or self-study.

jtbell
Staff Emeritus
Science Advisor
Homework Helper
2025 Award
Messages
16,107
Reaction score
8,082
Today I found out that the textbook that I taught C++ out of for several years in the late 1990s and early 2000s is now available online for free. After it went out of print, the author (Owen Astrachan at Duke University) decided to make it freely available.

A Computer Science Tapestry, second edition (1999)

I was attracted to this book because it used important features of the then-new C++ standard (1998) in preference to the C-style features that they were intended to replace:

  • The std::vector class instead of C-style arrays, which are mentioned only briefly at the end of one chapter;
  • The std::string class instead of C-style null-terminated char arrays and char* pointers, which aren't mentioned at all;
  • Passing arguments to functions using references instead of pointers, when the function is supposed to change the values of the arguments and return them to the calling function.

This means that pointers come very late in the book, in chapter 12 out of 13. They simply aren't needed until then, for explicit dynamic memory allocation using new and delete. I remember that I worried about this at first, and discussed it with the guy in my department who taught most of our upper-level computer science courses. He said something like, "Oh, that's fine! They'll deal with pointers in later courses like data structures, when they really need them. At your level, it's better that they get a decent introduction to object-oriented programming."

I suspect that Astrachan decided not to do a third edition because high-school (AP) and college/university intro computer science courses in the US moved from C++ to Java in the mid to late 2000s. That probably caused demand for C++ textbooks to plummet. Kind of a pity, because it really wouldn't have taken much work to bring it up to date.

The main problem with the code in this book is that it was written before C++98 compilers were widely available, so it uses Astrachan's own library and header files for strings and vectors. However, the code is compatible with std::string and std::vector, except for using different #include files, e.g. #include "tstring.h" instead of #include <string>. After I installed a new compiler, I simply told students to substitute the standard #include files for Astrachan's.
 
Last edited:
  • Like
  • Love
Likes   Reactions: jedishrfu, harborsparrow, vanhees71 and 4 others
Physics news on Phys.org
Not a lot of takers today. Perhaps we need a programming competition with this book as the prize.
 

Similar threads

  • · Replies 22 ·
Replies
22
Views
4K
  • · Replies 34 ·
2
Replies
34
Views
10K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 14 ·
Replies
14
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
Replies
5
Views
2K
  • · Replies 118 ·
4
Replies
118
Views
10K
  • · Replies 65 ·
3
Replies
65
Views
8K