This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
Anybody have a suggestion for a preferred book for a Java developer to learn C and/or C++ programming? My mind goes numb with the beginning C/C++ books I've started to read as so much of the material I already know from Java. It's just too boring reading page after page on for-loops and if-else constructs. But I find that I can't safely and quickly skim such material as I'm too likely to miss some small, barely mentioned feature specific to C/C++. So, has the great "From Java to C/C++" book been written, yet?
I'd recommend Andy Koenig and Barbara Moo's "Accelerated C++." It's not specifically for Java programmers, but it was the book that introduced the new style of teaching C++, which is not to start with C and add objects, but to start off using, e.g., the string class right away. So you won't find page after page of introductory syntax. The syntax is intermixed with learning to think in terms of standard containers and algorithms. It's a small but powerful book.
I recommend Koenig and Moo�s Accelerated C++. I have been studying C++ for a couple of months. When I started, I experimented with the following books. C++ Primer by Stanley Lippman Essential C++ by Stanley Lippman C++ for Java Programmers by Timothy Budd Accelerated C++ by Koenig & Moo The C++ Programming Language by Bjarne Stroustrup I decided to use Accelerated C++, and follow up with The C++ Programming Language. C++ for Java Programmers is an interesting and entertaining supplement. [ February 20, 2004: Message edited by: Marlene Miller ]
Joined: Mar 05, 2003
Here is a description from Accelerated C++ by Koenig & Moo about their approach to teaching C++.
The first part concentrates on programs that use the standard-library abstractions. The second part talks about defining your own abstractions. Presenting the library first is an unusual idea, but we think it is right. Much of the C++ language � especially the harder parts � exist mostly for the benefit of library authors. Library users don�t need to know those parts of the language at all. By ignoring those parts of the language until the second part of the book, we make it possible to write useful C++ programs much more quickly than if we adopted a more conventional approach. Once you have understood how to use the library, you will be ready to learn about the low-level facilities on which the library is built, and how to use those facilities to write your own libraries. Moreover, you will have a feeling for how to make a library useful and when to avoid writing new library code altogether. Although this book is smaller than many C++ books, we have tried to use every important idea at least twice, and key ideas more than that.�
[ February 20, 2004: Message edited by: Marlene Miller ]
Joined: Dec 10, 2001
Thanks for the advice. The title of Timothy Budd's book sure fits the bill. I'll have an eye out for it.
Joined: Mar 05, 2003
Dirk, a word of caution... As one amazon reviewer has pointed out,
This book was mistitled. It should have been "Differences Between Java And C++: A Crunch Translation Guide". Like an English-LanguageX translation guide (or a culture-to-culture translation guide, for that matter), this book is intended to identify the sorts of things that a Java developer jumping into C++ with no background in C++ would typically incorrectly presume or fail to correctly presume without having been told. To that end, this is an excellent, one-of-a-kind book that immediately immerses the reader into very significant and important differences between the languages regarding everything from syntax to compilation and execution.
Even so, when I am reading through Accelerated C++ and I come across something Java-like but not really, or never seen before in Java, I would rather refer to The C++ Programming Language by Stroustrup for a complete description of the C++ way. Budd's book is good for highlighting and introducing the differences. It is an interesting and helpful supplement. [ February 29, 2004: Message edited by: Marlene Miller ]
Even if you are a Java veteran, this book will always be the one to read and do exercise with, "C Programming Language". This isn't actually a beginner guide, it requires alot of thinking and exercise.
author and iconoclast
Originally posted by Adrian Yan: "C Programming Language".
K&R is a wonderful book, but folks who teach C++ for a living have developed a very different way of teaching that language in recent years, and that new way definitely does not include learning C first. C++ isn't thought of anymore as C plus some extra stuff; it's a higher-level language that is compatible with C. I'd not have a C++ newbie pick up "The C Programming Language" until they had become quite conversant in C++.
Joined: Oct 02, 2000
I tho Dirk wants to learn C/C++. The common mistake for alot of people when they say I want to learn C/C++ (&& ||) , they don't realize there are many differences between them (C++ has much more features than C). From my personal experience, comparing C to C++ is not clear or precise, C++ is more comparable to Java. I'm not a C++ guy, so I can't comment on how to learn it (I know the basics). As far as learning C goes, you can't beat "C Programming Language".
It should be noted that Java developers who need to learn C++ can still make use of the rich Java API in their new language. This approach (native C++ coupled with the Java API) lowers the learning curve dramatically and smoothes the transition. Several solutions exist for accomplishing this.
One is NewJ Library for C++, which implements the Java API (and Java language features) in native C++, for C++. NewJ apps run 100% native and do not require a VM or JRE for development or deployment.
Another is NewJNI (included with NewJ), which provides a natural C++ interface to VMs, JREs, and JNI. NewJNI makes Java objects and interfaces feel like real C++ objects.
As an aside, like Timothy Budd's book, the NewJ Library for C++ Developer's Guide discusses the intricate differences between Java and C++ and warns Java-to-C++ developers about the rocks beneath the surface.