Programming: Principles and Practice Using C++ (2e)

Author: Bjarne Stroustrup
Publisher: Addison Wesley
Pages: 1312
ISBN: 978-0321992789
Print: 0321992784
Kindle: B00KPTEH8C
Audience: Beginners wanting to understand programming
Rating: 4.9
Reviewer: Mike James

The second edition of a book that many regard as the best way to learn and teach C++. 

 

Who better to learn C++ from than the man who invented C++ and depending on how you view things was, and is, a hero or set the course of programming back many years! C++ is a language that you either love or hate depending probably depending on whether or not you have had to debug someone else's C++ code. 

The problem with C++ is that it is flexible, so flexible that you can write it in styles that make it look very different from the simple straightforward textbook approach. As a result many programmers believe that it's no place to start learning how to program.

Clearly Bjarne doesn't agree because this book is aimed at the complete beginner. However, even if you are a complete novice you will probably want to skip the introduction (and perhaps even later bits) because the approach is very wordy.

This said it's all well written and well organised. Bjarne clearly understands programming, and the way you have to think to program, at a sufficiently high level to be able to reflect on the activity and understand what it is a beginner has to master and in what order. In short this is an excellent introduction to programming that just happens to use C++ as its target language.

It is clearly a student-oriented book and it is designed to be used on college courses - it has exercises. The notes to the reader go into the teaching philosophy used. 

 

Banner

Chapter 1 is a very lightweight look at what computing is all about and is suitable as an introduction for any reader who has never seen or heard about computers. 

The book really gets going at Chapter 2 which is where I suggest all readers should start. There is the usual hello world program, but it is important to know that the author uses a custom header file to make the examples in the rest of the book easier to use. It is important that the reader knows this and downloads the header from the author's web site. This isn't made clear, nor is where to store the file - it is expected that you can work this out. This could be the place that the real beginner without any help to call on gets completely stuck and gives up, so never reading the remaining 1000 plus pages of the book. This needs fixing.

 

 

From here the book moves though the basic topics of objects, expressions, functions, class and so on. It also deals with more general topics such has how to cope with errors and how to think about program creation. The chapter on how to think about creating a program includes a long discussion of grammar and how it relates to code.

What is strange is that the book proceeds very slowly in terms of what it explains - it tackles everything in simple prose and uses color to make everything look clean and simple. However, what it is explaining is quite advanced and sophisticated. It is a bit like reading a treatise on advanced quantum physics expressed in basic English - I kept thinking "tell it to me like I'm five". For example:

"... look at the calculation of the ratio in the code above. It look innocent enough. Did you notice something wrong with it? If not look again: area3 will be 0, so that double(area1)/area3 divides by zero. "

How you react to this sort of explanation is key to how you feel about the book. Some readers find it boring, tedious, insulting even. Me? I found it deeply relaxing and easy to read. How can anything be difficult when explained in this straightforward way? But remember this is C++ which has a reputation for biting programmers whenever they relax too much.

Part II, a sizable chunk of the book, is called "Input and Output" which might seem a very narrow topic but interpreted in the full sense of data and graphics has a lot of ground to cover. It starts off with a look at streams and working with files, but it quickly moves on to graphics. Graphics is a good place to explain the ideas of object-oriented programming but there is also a lot to learn about GUIs and UIs. 

Part III called "Data and Algorithms" is more what you would expect in an "educational" book on C++. It starts off with a look at the vector and how to manage storage. This leads on to a consideration of arrays and templates, i.e. generics, before moving into more complicated data structures - collections, linked lists and maps. You will also find discussions of algorithms and other computer science topics.

The final part of the book is called "Broadening the View". For most readers the view will have been fairly broad already so what to expect? Oddly Chapter 22 restarts the whole discussion of what is programming with a look at the history. This is odd because it is the sort of thing that is usually dealt with early in a book. Treating it at this point, however, allows it to be discussed with a bit more understanding. From here we move on to text manipulation as an example of a difficult subject area. Next numerics, with matrices and simple numerical algorithms. Chapter 25 gives the flavour of embedded programming - mostly bit manipulation.  The book closes with a look at the ideas of testing and bit more on debugging and a look at the C programming language - which of course is more-or-less a subset of C++. 

The collection of appendices include a definition of C++ and how to use Visual Studio.

 

 

This book would make an excellent course text book and it is one of the few that could succeed in teaching you C++ with good style and understanding just by reading it - but it is long and some are going to find it slow and plodding. 

If you are looking for a book that has a jazzy layout, crazy humour, cartoons and gimmicks then you will be disappointed. There is humour, but it is very gentle and if you are in a hurry you might well miss it. Also the book isn't just an introduction to C++. It attempts to educate you in the wider issues and ideas of programming. This means that even though the presentation is slow paced you will need the intellectual apparatus to understand some of the subtle ideas. 

Finally if you are a Bjarne Stroustrup fan then you will find this an excellent read.

Banner


Python All-in-One, 2nd Ed (For Dummies)

Authors: John Shovic and Alan Simpson
Publisher: For Dummies
Date: April 2021
Pages: 720
ISBN: 978-1119787600
Print: 1119787602
Kindle: B091DGDLK8
Audience: People wanting to learn Python
Rating: 2
Reviewer: Mike James
All-in-one refers to the fact that this is seven books put together - why?



C# Programming, 3rd Ed (In Easy Steps)

Author: Mike McGrath
Publisher: Easy Steps
Date: April 2022
Pages: 192
ISBN: 978-1840789737
Print: 1840789735
Kindle: B09WPBZZCV
Audience: C# developers
Rating: 5
Reviewer: Mike James
An easy guide to C# - what could be better.


More Reviews

 

 

Last Updated ( Sunday, 15 April 2018 )