John Molluzzo: C++ for Business Programming, Prentice Hall, ISBN 0-13-577594-9, 700 pages.
Despite the popularity of C++, a few experts and a lot of skeptical programming managers find it utterly unsuitable for developing traditional business applications. The respected Robert Glass, for example, found it inferior even to Cobol! (ACM Communications September, 1997, p.11).
While knowledgeable C++ programmers may condescendingly snicker at Glass's pronouncements, they can only cringe at the publication of this book, which unintentionally fuels Glass's arguments. If the techniques Molluzzo presents are what business applications programming in C++ is about, then you'd be crazy to consider using C++.
It's hard to conceive of a business application that doesn't manipulate amounts of money. Indeed, in some business systems, money data constitute a majority of the application-domain data items.
Deciding how to represent money data internally is a long-standing issue and, for C++ and Java programmers, a critical one. Throughout the text Molluzzo opts for raw floating-point dollars! That choice sends shudders through information systems auditors when a grand total turns out to be $4,544,299.999999999999. Yes, we all know that amount is the same as $4,544,300.00, but most accountants still raise a fuss over it, as did Glass in his article.
Savvy C++ designers recognize that object-oriented languages offer the perfect
solution to that problem. They design (or find) a
Money class. Then whatever the hidden internal representation
is, the encapsulated methods assure that arithmetic on
objects generates exact rather than approximate results.
Money class not
only takes care of arithmetic, but also provides sensible display options.
Molluzzo's code examples are full of clumsy
manipulators, that would make confirmed Cobol-haters long for a
Molluzzo also repeatedly refers to "the cout statement", a beginner's gaffe.
Any C++ programmer knows that
is a predefined output stream, not a type of statement.
A pretty decent money class is found on this web site.
I've been complaining for some time about C++ writers who can't get
operator overloading right, but
Molluzzo wins the prize with a non-commutative addition operator taking
Account object on the left and a
floating point number on the right! Presumably he meant to add to the
account balance, not the whole record. The Java fanatics who condemn
operator overloading as unintuitive will have fun with that one.
Close behind amounts of money in business applications are dates. Although this book was published during the heat of the "Y2K crisis", Molluzzo provides little help; the word "date" doesn't even appear in the index.
Return to book reviews.
Return to IDI home page.