Beginning C++ : The Complete Language
ISBN 1-861000-12-X Price £36.99UK
Ivor Horton
20 Chapters, 5 Appendices and Index in 953 pages
Chapter List
Introduction
1.Basic Ideas: Namespaces, Program Structure, Compilation,
Keywords
2.Basic Data Types: Performing Calculations, Using
Variables, Assignment, Floating Point Calculations
3.Handling Basic Data Types: Mixed Expressions, Bitwise
Operators, Enumerated Data Types, Scope
4.Choices And Decisions: Comparisons, If-Then-Else,
Logical Operators, Switch statements
5.Loops: While, Do-While, For, Nesting, Skipping, Breaking
6.Arrays & Strings: Data Arrays, Multidimensional
Arrays
7.Pointers: Declaration, Initialisation, Pointers and
Arrays, Dynamic Memory Allocation
8.Functions: Arguments to Functions, Pass by Value,
Pass by Reference, Returning Values, Inline Functions
9.More on Functions: Overloading Functions, Pointers
to Functions, Recursion
10.The Preprocessor: Namespaces, Directives, Debugging
11.Data Types: Objects, Structures, Unions, Structures of
Structures
12.Classes: Object-Oriented Programming, Constructors, Public/Private
Members, 'this'
13.Class Operations: Controlling Access, Copy Constructor,
Dynamic Memory Allocation within Objects, References
14.Operator Overloading: Operators that can be Overloaded,
Implementing Full Support
15.Inheritance: Deriving Classes, Access Control, Construction,
Multiple Inheritance, Conversion
16.Virtual Functions & Polymorphism: Polymorphism, Pure
Virtual Functions, Pointers To Class Members
17.Errors: Handling Exceptions, Functions that Throw Exceptions,
Standard Library Exceptions
18.Class Templates: Defining Class Templates, Explicit Instantiation,
Class Templates with Nested Classes
19.Input & Output: Stream Classes, File Streams, Unformatted
Streams, Random Access, Objects & Streams
20.The Standard Template Library: the Vector Container, Understanding
Iterators, Storage Management, the List container, Associative Maps,
Performance and Specialisation
Appendix A
ASCII Codes
Appendix B
C++ Keywords
Appendix C
Standard Library Header Files
Appendix D
Operator Precedence and Associativity
Example Project
Outline & Notes
Synopsis
Whether you're just starting programming, or you're a seasoned programmer, there's something in this book for everyone. You'll benefit from having some previous knowledge of programming: C would be advantageous, Java especially so. However, as long as you're reasonably computer literate, you'll be able to follow this book and learn to program in the C++ language. From a Linux users' point of view, this is a very generic book: it is not aimed at any particular platform, and as such it's going to give you a good grounding in the language that you can apply anywhere. People wishing to program KDE applications will especially find this book useful, as you'll find it covers the traditional KDE development strategy of deriving classes from the KDE base. However, the knowledge you'll gain from this book will be applicable to any situation
Review
This book starts with the basics. The basic building blocks of programs, variables and C++ keywords, are introduced from the start at a leisurely pace. If you're not programmed before, or you've not programmed in C/C++ before, you'll find this information invaluable. Very quickly you will be able to construct working programs, albeit simple ones. The thought processes you'll need to go through quickly become natural as you work through the section on functions.
If you're already a programmer, possible even in C++, you'll find there's something in this book for you also, although you'll have to dig further into the book to find it. People familiar with programming can dive straight into Chapter 12 and beyond (the introduction to classes). People who started with no prior knowledge will take a week or two solid use of this book before they get here. Chapter 12 is where the interesting concepts start to take shape, and for the OO initiate there'll be no problems. If you're not fluent in object-oriented methods, you may start to run into a few problems at this point.
Object-oriented programming is not particularly new; but it has taken a while to be accepted into the mainstream. Object-orientation (OO) requires a perspective shift on the part of the reader. For those who are new to programming, and who are following the book, this won't be too hard. For someone who's been programming in various languages, it'll be harder. The basic concept of OO is that function and data are maintained together in an object, but is an intricate subject, and beyond the scope of this review. However, it suffices to say that the leap in thinking is comparable to that between iterative and recursive functions, if you've ever had to learn functional programming having learnt procedural programming, or vice versa.
OO is what makes C++ great, it's also what makes it (seemingly) impenetrable to those on the outside. If you're programming in Java previously you'll be fine, and as long as you take things slowly you'll be fine with this book. Horton makes things clear, and although the full implications of what he states may take time to sink in (generally, some thinking will be required before full understanding is attained), the writing style and layout of the book make this a very quick process.
Classes in C++ are what make the language interesting, but the OO makes it doubly so. This book handles many of the complex issues with ease. Particularly, operator overloading and polymorphism (these terms may mean nothing to you!) are covered thoroughly, as well as the implications of their use. Runtime issues, such as type identification, are also well-documented. Obviously, if you know what I'm talking about, you probably don't need to read the book, but basically my point is that the subjects covered are covered concisely, yet thoroughly, and every aspect of the language is explored.
There are two more areas I haven't discussed: streams and the STL. Streams are a conceptual idea, where data flows more or less sequentially. This may seem like something of a retrograde step to some readers, but this book explains well the advantages. All the stream manipulators of import are discussed, with good examples using file streams to illustrate the ideas involved.
The final chapter covers possibly the most interesting area of C++:
namely, the Standard Template Library, or STL. The STL is a set of tools,
which make creating complex data structures a breeze. It provides three
types of tools: containers, iterators and algorithms. For example, it provides
sequential lists, a type of container (lists are known as doubly linked
lists to C programmes). It provides algorithms, such as sorting, positioning,
etc., which can be applied to containers. Algorithms are applied to containers
using the iterators. This is where C++ starts getting interesting, because
with consummate ease you can apply large-scale transformations to your
data structures. The first example in this chapter of the book compares
a - a sequential container - to a standard array, showing off the benefits
of the STL. Of course, this could be achieved by a programmer using manual
means, but in reality this is often not done: for example, how many programmers
will code up a balanced tree implementation when they could use a hash
table? Few. And of course, the advantage of the STL means that the best
algorithms - which naturally find their way into the STL - are they for
you to use, without having to code, understand or do anything else about.
They're just there, and your code improves automatically every time the
STL is improved, to incorporate the latest string-searching innovation,
perhaps. This book outlines the use and benefits of the STL, with strong
but clear arguments and
examples.
Throughout the book the writing is clear and concise. Pedagogical aids abound, and they're often short but to the point. Each Chapter contains numerous "Try It Out" boxouts, and each chapter ends with a short summary and then a set of exercises. There are also common "FYI" boxouts - "For Your Information" which usually point out information which is useful, but slightly offtopic.
I would recommend this book to anyone wishing to learn C++, having learnt other languages previously or not. Do not underestimate the size of the task; this is a big book about a big language. C++ is one of the "big things" at the moment, and reading this, it's little surprise why. The level of abstraction above vanilla C is as little as you like, but it can be very large. While C++ can look incredibly C-like at times, the more interesting examples will not look anything like C in many ways. This book continues the Wrox Programmer-to-Programmer tradition, with Horton's clear and accomplished writing style, honed over many such tomes, and the level of information contained within. In short, if you're looking to learn to program in C++, you won't go far wrong with this book.
Review by Alex Hudson