Pluses and minuses

C++, The Core Language - The Object Concept - Practical C++ Programming
February 9, 1996

The subject of these books is an object-oriented extension of the popular C language. It is sometimes called a hybrid object-oriented language because it allows us to combine elegant techniques such as encapsulation and inheritance with procedural programming practices. This facility has both its advantages and disadvantages. On the positive side, it means that C programmers can progress to C++ with minimal learning effort.

An average C programmer should be able to grasp the extra syntax in C++ in about four months. The downside is that many C programmers never learn to use the object-oriented features in C++ which are so vital to writing correct, flexible and portable applications. The consequences are that it becomes difficult to create good C++ applications and that it is almost impossible to maintain C++ applications once they reach a certain critical size. It is no wonder that some of the developers at Sun decided to write the Java language, which can be likened to "C++ without pain and pointers".

It is estimated that there are 400 books on C++ in the marketplace at the moment of writing (the current reviewer has two to his name). Very few of them deal with how to write classes which adhere to what Bertrand Meyer, the designer of the Eiffel language, would call software quality criteria: portability, reusability, robustness, maintainability and extensibility. There is a great need for someone out there to write a book on how to do it correctly in C++.

These three books are outdated in the sense that they either pay little or no attention to new and important concepts such as the template mechanism, exception handling and run-time type identification. Furthermore, the burnt-out examples (such as array and linked list) are superfluous since they will be supported in the Standard Library Toolkit in the upcoming releases of C++. Second, we see a lack of any coherent approach to writing real-life applications. In short, the target groups for whom these books are intended will not be able to apply C++ to real problems after reading them. Worse still, they may learn techniques which are at odds with good software engineering principles. This is in part due to the fact that certain vital topics (such as layering and contracts) have not been treated.

The book by Decker and Hirschfield attempts to give C++ an engineering flavour but it falls short of its objective. The authors should have built their book around modern techniques which have been pioneered in other languages such as Ada, Smalltalk and Eiffel. I missed the quality approach in the book.

The book by Satir and Brown is meant as an introduction to C++ for C programmers. As such it achieves its aim, but you should not expect to write real C++ after having read this book. It gets you over the syntax hurdle. The approach is typical C with overuse of structs, pointers and other nasties which have been eradicated in C++ (remember, Bjarne Stroustrup originally invented C++ to be a "better C".

Oualline deals with practical issues of writing C++ classes in a UNIX environment (although the author does look at Turbo C++ and Microsoft C++). Some of the material is outdated but the book may be of use to those who use the gnu compiler in UNIX. The chapter on debugging is based on gnu; this is not relevant if you use, say, Visual C++ under Windows NT. The book contains some useful titbits, such as rounding errors, language portability issues and makefiles but again the emphasis is on mechanics and syntax. The question is: is this enough?

Seeing that each of these books is aimed at the C++ neophyte, the question is, have they achieved their aim? If the objective is to teach C and Pascal programmers C++ syntax and to apply it to linked lists and array structures, then all three books have just about done it. However, the big question for the C++ community is: how can I create quality software? Unfortunately, none of these books has achieved this objective since they do not see this as an issue. What we need for the C++ community is an equivalent of Bertrand Meyer.

Daniel Duffy is founder of Datasim BV, Amsterdam. He is the author of two books on C++ and chief architect of a C++ class toolkit for computer aided design and graphics applications.

C++, The Core Language

Author - Gregory Satir and Doug Brown
ISBN - 1 565 92 116 X
Publisher - O'Reilly & Associates
Price - £14.95
Pages - 210

You've reached your article limit.

Register to continue

Get a month's unlimited access to THE content online. Just register and complete your career summary.

Registration is free and only takes a moment. Once registered you can read a total of 3 articles each month, plus:

  • Sign up for the editor's highlights
  • Receive World University Rankings news first
  • Get job alerts, shortlist jobs and save job searches
  • Participate in reader discussions and post comments

Have your say

Log in or register to post comments