Old but good C++ textbook available for free

In summary, the conversation discusses the availability of a textbook on C++ that was used in the late 1990s and early 2000s, but is now available for free online. The book was praised for its use of important features of the new C++ standard and its delayed introduction of pointers. The decline in demand for C++ textbooks, due to the shift towards Java in computer science courses, is cited as a possible reason for the book not receiving a third edition. The main issue with the code in the book is its use of the author's own library and header files instead of the standard ones, but this can easily be remedied. The conversation ends with a suggestion to hold a programming competition with the book as the prize
  • #1
jtbell
Staff Emeritus
Science Advisor
Homework Helper
15,926
5,736
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 jedishrfu, harborsparrow, vanhees71 and 4 others
Physics news on Phys.org
  • #2
Not a lot of takers today. Perhaps we need a programming competition with this book as the prize.
 

1. What is the title of the textbook?

The textbook is titled "The C++ Programming Language" and was written by Bjarne Stroustrup.

2. Is the textbook available for free?

Yes, the textbook is available for free in PDF format on the author's website.

3. What is the content of the textbook?

The textbook covers the basics of C++ programming, including syntax, data types, control structures, functions, and object-oriented programming concepts.

4. How old is the textbook?

The first edition of the textbook was published in 1985, but it has been updated and revised multiple times since then.

5. Is this textbook still relevant for learning C++?

Yes, the textbook is still considered a valuable resource for learning C++. While there may be newer versions available, the fundamentals of C++ remain the same and can be learned from this textbook.

Similar threads

  • Programming and Computer Science
Replies
5
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
944
  • Programming and Computer Science
Replies
5
Views
884
  • Science and Math Textbooks
Replies
1
Views
1K
  • Programming and Computer Science
4
Replies
118
Views
6K
  • Programming and Computer Science
Replies
3
Views
1K
  • Programming and Computer Science
2
Replies
65
Views
5K
  • Programming and Computer Science
3
Replies
89
Views
4K
  • Programming and Computer Science
Replies
5
Views
2K
  • Programming and Computer Science
Replies
4
Views
3K
Back
Top