From CS559 Computer Graphics Fall 2007

Main: CPP

Thoughts on C++ for Programming and 559

On this page... (hide)

  1. 1. C++ vs. 559
  2. 2. Some Resources for Learning C++
    1. 2.1 Books to Learn C++ From:
    2. 2.2 Web Tutorials
  3. 3. Advanced C++/Programming Books
  4. 4. Some Hints

For this class, you will need to program all of your projects and assignments in C++.

This is not a statement about the language, or the appropriateness to doing graphics. It's more a statement about what is a convenient environment for us to teach graphics in. Just as we chose to give lectures in English, despite the fact that other languages could have been used, we chose to give programming assignments and projects in C++.

That said, most "real world" graphics programming is in C++. So learning C++ is a useful skill if you want to go on and do more graphics. In fact, C++ is a useful skill in general.

Requiring projects in C++ might be a problem if your previous programming experience was in a different programming language. This is increasingly the case as we move our introductory programming courses to Java.

First, it is definitely possible to do well in CS559 if it is your first exposure to C++. Many students (OK, some students) did very well. In fact, knowledge of C++ beforehand is not a good predictor of how well students do in 559.

That said, learning C++ at the same time that you are learning the graphics material will be a challenge. Plan to devote some extra time to it. While many students who did not C++ prior to taking 559, all of those who were successful put in lots of extra time and effort. While it is possible for students without C++ experience to do well, it is not easy.

To be honest, the biggest problem for most students transcends the language: its the ability to build and debug non-trivial programs. For many students, 559 is the first time that they have to write a program that is too big to wrap their head around. Learning to write complicated programs is harder than picking up C++ if you already know Java. So, you might be better off if you've written lots of big programs in Java than if your programming experience is limited to short C++ programs.

If you really don't want to learn C++, we will may allow students to use Java in the future (probably not this year).

1.  C++ vs. 559

Learning C++ is not part of 559. We will not test you on knowing C++. We will not expect you to know any fancy C++ features in order to use our example code.

We will help you with C++ programming - to a point. We will help you enough that you can do the projects. We cannot teach you to program. We will not help you use complex language features.

2.  Some Resources for Learning C++

Since a lot of people will ask...

The department offers a "course" (CS368) to teach student C++ after they have learned Java. It is a self-paced web tutorial. You can work through it without registering (and getting credit). You can access the tutorials from http://www.cs.wisc.edu/~hasti/cs368/.

2.1  Books to Learn C++ From:

Essential C++ by Stanley Lippman Recommended
This is a really good book for getting started with C++. Its a thin little book that tells you what you need to know, without going crazy. Its more about the language and how to program in it than it is about a philosophy of how to organize your program (which many books seem to do).

(Buy at Amazon) (Publisher Site)

The C++ Primer by Stanley Lippman, Josee Lajoie and Barbara Moo Recommended with Caveats
(Buy at Amazon) (Publisher Site)

When I learned C++ (1989), I went to the bookstore and there were 2 books. So when I tell you the book that I used to learn C++, you have to take the recommendation with a grain of salt.

The book I learned from (and is probably my favorite C++ book) is C++ Primer. (published by Addison Wesley). With each version, it seems to double in size (this time it added a second author). When I got the first version it was a compact little volume. To be honest, I think it gets worse as it grows bigger.

With the 4th edition, the "getting bigger" has gotten to a crisis - there's so much in here, and fancy stuff is mixed in with the basics. Part of this is that C++ (the language) has gotten so big and complicated that there really is 900 pages of stuff to talk about.

Even the author laments the fact that a comprehensive book on C++ is unwieldy, which is why he wrote Essential C++

Other C++ Books:

Two other books that have been recommended to me are Wang's "Standard C++ with Object Oriented Programming" and Deitel & Deitel's "C++, How to Program." I have not used either of these, so no promises. Another well known book is Stroustrap's "The C++ Programming Language." This book was first (Stroustrap is the "inventor" of C++). Like Lippman (who was 2nd) this book doubles in size with each version. .

One thing that I dislike in C++ books is when they spend more time telling you their programming philosophy, rather than the constructs of the language. There seems to be no avoiding this.

Another problem with C++ books is that they like to show off how you can use the complicated features of the language to do tricky things. There are whole books on these kinds of things (that are probably better at it). My opinion is that you are best off learning the basics first, and then moving on to fancier things later.

2.2  Web Tutorials

Aside from CS368, there are a bunch out there. In fact, if you type in some C++ topic to your favorite search engine, you will find something. (I did this the other night when I couldn't remember how Templates worked). While you might wade through a pile of junk (this is the web), you might find something good.

3.  Advanced C++/Programming Books

There are lots of "advanced" C++ (and programming in general) books out there. Once you learn the basics, reading an advanced book really can teach you some new tricks and help you become a better programmer. However, sometimes, these books get so caught up in debateable tricks or picky details that they aren't that valuable.

Some books that I would recommend that can help you become a better programmer:

The Effective C++ series by Scott Meyers
(buy at Amazon) (publisher's link)

I don't agree with everything he tells you to do. However, in all cases, he give good arguments. Its worthwhile to read his tips just to learn how to think about the issues. Whether you agree with him or not. The whole series is pretty good - the first book is probably the best place to start though.

C++ Coding Standards: 101 Rules, Guidelines, and Best Practices (C++ In-Depth Series) by Sutter and Alexandrescu
(buy at Amazon) (publisher's link)

This book is full of useful tips and tricks as to how to use (or not to use) C++ effectively. Most of the tips in this book are good, and always well argued. You may not want to use all of them, but its a good thing to browse to get ideas on how to be a better C++ programmer.

4.  Some Hints

This is based not only on my own experience, but on my experience teaching CS367 back when it was taught in C++, and in helping 559 students write their first programs.

Retrieved from http://www.cs.wisc.edu/graphics/Courses/559-f2007/Main/CPP
Page last modified on August 27, 2007, at 02:21 PM