Principled Programming

Author: Tim Teitelbaum
Publisher: DateTree Press
Date: March 2023
Pages: 429
ISBN: 978-8987744109
Print: B0BZF8R467
Audience: General
Rating: 5
Reviewer: Mike James
Principled Programming - what else would you want to do?

So many books try to teach programming by explaining a language. This is a terrible idea, but enough readers manage to see the wood for the trees and even provide false proof that the method works. The problem is that when you teach a language you fail to teach the principles of programming, replacing it by the idiosyncrasies and gotchas of the language. The readers that complete the course do so because they did the hard work of extracting the principles from what they were being exposed to - there are better ways.

This book approaches the problem of teaching programming from the correct end of the stick - principles, illustrations and expression. The language used is more or less irrelevant. Most modern languages follow C in using a particular type of expression for loops, conditionals and so on. Modern block structured languages look much like each other and while a subset of Java is used in this book, it could be C, C#, C++, JavaScript...

Banner

I'd advise readers, especially beginners, to skim read or skip the first two chapters which would better be converted into appendixes. The book really gets started at Chapter 3 with a look at specifications. This is a good way of getting started which leads on to the subject of the next chapter -  a study of stepwise refinement as a fundamental principle of programming. Once, not so long ago, it was the core methodology of structured programming. Today it tends to be overlooked, overshadowed by object-oriented methods. This is a mistake as when it comes to crafting code it is still a core approach to actually creating code whether you use objects or not.

princprog

Chapter 5 introduces the problem of sequential data processing - a topic not given anywhere near the amount of attention it deserves. Even in today's era of large memory machines, sooner or later you run out of space and need to figure out how to handle even more data. Chapter 6 is about enumeration patterns - these are something that most beginning programmers are forced to learn by trial and error or problem solving as it is otherwise known. Making it clear what is going on has huge advantages and saves the learner so much time. Chapter 7 is about sequential search - again fundamental but so many texts just want to move on to binary search or something clever. The following chapter generalizes the idea by considering rearrangements of arrrays. Reversing is easy but what about partitioning - something generally not considered unless it is part of a Quicksort but it is a thing in its own right. Chapter 9 does introduce  binary search and discusses the idea of divide and conquer algorithms along the way.

Chapter 10 is about finding the median, but really its a softening up exercise using partitioning on the way to applying it to Quicksort in Chapter 11. Chapter 12 is an introduction to collections - lists in particular. Next we have an unexpected chapter on celluar automata, then one on the Knight's Tour and one on maze running. All good examples that make use of what has gone before.

Chapter 16 is a collection of shorter examples with the emphasis on finding representations - a skill every programmer has to master but usually without much help. Chapter 17 is about graphs, which again relies on representation. Chapter 18 introduces objects and Chapter 19 rounds out the book with a look at debugging - again a skill that invariably isn't taught, the novice programmer is just expected to pick it up.

The chapter on objects is sketchy because you need to know everything in this book before you can really start to understand the whole idea of objects. The modern way of teaching programming has a lot of problems with objects because they are fundamental to so many languages that if you teach a language you have to cover them early. This is crazy because at this point the beginner has no idea about the procedural programming needed to put life into an object and hence struggles with both the concept of an object and the practice of creating one. What is needed is a "pre-objects" programming book that introduces all of the ideas that we have to have to create a program without objects and this is what this book mostly is.

Conclusion

This is not a book that talks down to the reader, so you'd better not be a "dummy" if you are going to read it. You need to engage with it and not expect to be spoonfed. The style is easy to read and there are lots of interesting asides to keep you going, but no gimmicks or tricks. It is also well produced and looks good. There is no Kindle version which is a shame - even if an ebook couldn't match the quality of the presentation, some readers prefer an ebook even if it is inferior.

The examples are built up rather than simply being presented and the ideas are discussed at length. The author suggests several pathways through the material and if it is to be used in a course these will be useful. If you are a solitary reader I would suggest reading chapters 3 to 9 and then making your own way through the examples that follow, leaving the chapter on objects until last.

Recommended as a good textbook for a course and for individual study.

 

To keep up with our coverage of books for programmers, follow @bookwatchiprog on Twitter or subscribe to I Programmer's Books RSS feed for each day's new addition to Book Watch and for new reviews.

Banner


Grokking Machine Learning

Author: Luis G. Serrano
Publisher: Manning
Date: December 2021
Pages: 512
ISBN: 978-1617295911
Print: 1617295914
Kindle: B09LK7KBSL
Audience: Python developers interested in machine learning
Rating: 5
Reviewer: Mike James
Another book on machine learning - surely we have enough by now?



Go Programming In Easy Steps

Author: Mike McGrath
Publisher: In Easy Steps
Date: January 2021
Pages: 192
ISBN: 978-1840789195
Print: 1840789190
Kindle: B08NF958NM
Audience: Non-programmers wanting to learn to code in Go
Rating: 5
Reviewer: Mike James
Getting going with Go - great idea!


More Reviews

 

 

Last Updated ( Wednesday, 12 July 2023 )