tags:

views:

498

answers:

13

I've been trying to pick up C++ and I have an old textbook a professor gave me awhile ago. The book was published in 1998 and I've been reading through it.

The first area that I ran into problems was in the graphic section. The textbook says to use the following library.

#include <graphics.h>

This didn't work with the system I'm on so I did some research. I found out that the library is very outdated and not used anymore.

So the problem I'm facing is whether or not to keep trying to learn from the textbook or switch to an online tutorial, or even buy a brand new textbook.

I really prefer to learn from physical media, like textbooks, as opposed to learning from a web page.

Am I going to have many more problems if I continue trying to learn from the textbook? If so, what are they?

Also, what are your opinion on keep the textbook or just tossing it?

A: 

Keep it, you'll get to exercise your debugging skills while using it!

Brian Knoblauch
Good point -- having to figure out what went wrong when the book can't help you can be an interesting way to learn more about how the stuff works.
Jonathan
A: 

Things have certainly changed in C++ since 1998, but I am not sure exactly what.

I would keep the textbook you have and try to find a newer one to supplement it. The old book will still be accurate for the most part and it never hurts to have more than one explanation for things.

17 of 26
+2  A: 

Graphics stuff is likely going to be one place where the book won't be "up to date". It also may not have much coverage of the STL (a library that has a number of data structures and algorithms).

However, the basics will still apply -- classes, pointers, etc. When you're ready to start doing graphics and web stuff and the like, you'll want a more up-to-date book.

Jonathan
A: 

Well, many things have not changed. Or at least not a lot.
Learning from the past is generally a good thing too.
I would keep it.

Burkhard
A: 

This would be like trying to learn American English from a 19th Century English textbook. Sure most of the basics will be the same, but the libraries and template systems will have changed dramatically. Go with an online tutorial or visit your local library!

pdavis
A: 

If your textbook is telling you to include "graphics.h", then it sounds like it's not really a C++ textbook, but one that uses C++ to teach you something else.

Modern template metaprogramming and some functional programming concepts like functors probably won't be covered much. The use of IOstreams has also evolved quite a bit, even if the streams themselves haven't changed a lot.

The book "Modern C++ Design" would be a great complement to Stroustrup's latest edition of "The C++ Programming Language". I would also recommend "Standard C++ IOStreams and Locales". Those 3 books will take you farther in good C++ design than you ever care to know about.

I suspect "Beyond the C++ Standard Library: An Introduction to Boost" would also be a good complement to the above collection, but I can't say for sure because I haven't ponied up for that one yet.

Ben Collins
A: 

I think that the most significant change needed in new textbooks about any programming language is the inclusion of good practices integrating code with another systems (e.g. libraries for graphics, networking, hardware, etc).

Of course, the syntax and grammar and patterns has not changed at all, but, the computer programming of today is not more of standalone components. Today we talk about integration between disparate systems. We need more guidance in how to make to work external libraries (to not reinvent the wheel anymore) in our systems, and this includes good design/architecture as well as the basis of the language itself.

Alex. S.
+1  A: 

If the examples in the book you have are no use to you, replace it. Taking a well-explained example and playing around with it is a good way to learn, so you're denying yourself that.

For language fundamentals, though, starting with an old book might actually be better, provided that after you've done that you learn the state of the art. If there's any danger you'll ever be asked to write portable code, it's good to know the lowest common denominator.

In the case of C, I've lost count of the number of times I've had to complain when someone checked in code that doesn't compile as C89, because one of the supported platforms only had a C89 compiler. In C++ the issue is slightly different, in that everything is in the standard but not all compilers implement it all. The effect is the same, though. That said, there's stuff you want to learn that's common but not standard, like boost. Don't skip this, just don't start with it.

Steve Jessop
+1  A: 

Another subject which will be lacking is security. Up until recently, very few books would even mention it. barely acknowledge even basics like buffer overflows, not to mention "newer" attacks like format string vulnerabilities.

Overall though, I think the older book may be good for learning the basics, but not necessarily the best practices. Just make sure you pick up a more focused, updated book to catch up later.

AviD
+2  A: 

As others have said, 1998 is not horribly old for a C++ book, but I think one should be aware that C++ textbooks can have very varying quality.

Some of them are really bad, and teach practices that are outdated, dangerous or wrong, even if published rather recently. So don't learn from just any C++ book, but use one that you know is good!

It can be hard to know if a particular book is good or bad, and I'd like to recommend the UK-based organization ACCU, which has a good list of reviews of many books. Link: accu.org

Thomas Padron-McCarthy
That accu.org seems like a great resource, too bad the book review section is down right now, :P
Dave
Works now. Go there, click on "Book Reviews", and type C++ in the search field. Gives 234 book reviews, from "Highly recommended" to "Not recommended".
Thomas Padron-McCarthy
+7  A: 

It's impossible to guess how many anachronisms a given C++ textbook might contain. Do yourself a favor and get a copy of Accelerated C++, a book written by two of the most prominent C++ programmers in the world specifically for the purpose of giving an up-to-date introduction to the language.

Avdi
A: 

The big thing is that this is about when the STL and the standard came out. Your book may have the STL; it may not.

I would recommend a more up-to-date text, @Avdi's suggestion of Accerlerated C++ is a good one, and it's probably worth hanging on to the book you have as a reference.

JohnMcG
A: 

For a brief period of time, it was in vogue to declare the main function as void. This managed to make its way into several on-line tutorials, although I don't know as it was in any actual textbooks. In case you're wondering, main should always return an int, otherwise the OS doesn't know whether or not it succeeded. This was a big shock for me when I switched from using MSVC 6.0, which tolerated such things, to GCC, which didn't.

Mark Verrey