Author: Allen B. Downey & Chris Mayfield
What is important about this book is its subtitle - How To Think Like a Computer Scientist. How is that?
This book promises in its title to let you into how a computer scientist thinks by teaching you some Java. It is an interesting idea, but to be honest a computer scientists thoughts aren't really tied to any particular language. However you probably do need some sort of algorithmic language to explain things, so why not Java?
The first chapter is called "The Way of the Program" and if this sounds like a philosophical discussion about what a program is - it mostly isn't. After a brief look at what computer science is all about - it's about problem solving apparently - we have the usual "Hello World" program and we are then deep into the minutiae of writing Java. And when I say minutiae I mean it.
In Chapter 1 we have a discussion of escape characters. Now this could be a deep philosophical discussion of how to code things that are not in the symbol set using just that set. It is an interesting problem with a few quite interesting and often flawed solutions - but no this is just a few notes on how to include line endings and quotes in text strings. Nothing more than you might find in any book introducing you to Java.
From here we move on to variables and operators. The book is now looking like and reading like any introduction to Java you might pick up. This continues through the remaining chapters. Any idea of teaching you how to think like a computer scientist seems to have taken a very back seat to just a standard introduction to Java.
After an introduction to input/output in Chapter 3, Chapter 4 is about "void" methods. This is an odd topic to choose for a chapter because void methods are just functions that don't return a result. The only problem is that the first functions we meet do return a result and we only meet void when we discover how to write our own functions. There is also a lot of confused "churn" about flow of control, parameters, arguments and stacks. This doesn't make anything seem easy.
Chapter 5 gets to grips with conditionals and logic, but fails to emphasize that conditionals are just one of three fundamental types of flow of control. Again none of the presentation does much to enable the reader to see the bigger picture.
Chapter 6 returns to functions but ones that return a value. Again a small distinction as we have already met functions that return a value. Inevitably we have a dose of recursion but again no deep thinking is explored. Chapter 7 introduces loops, the second great flow of control, and Chapter 8 introduces arrays - arguably what loops were invented to deal with. After arrays what could be more logical than to introduce strings in Chapter 9 but none of this is even slightly about thinking like a computer scientist; it is just about learning to program in Java.
Chapter 10 is where we first meet objects properly - you can't avoid objects in Java as the main function is a method belonging to an object. Now here surely we get into some "thinking like a computer scientist". After all, objects are a key theoretical idea in computer science. We don't. What we get is a discussion of how to use some supplied objects in Java and, without investigating the object idea at all, we have objects used as parameters and return values. Then garbage collection is discussed and we learn about the null keyword and more small details. No bigger picture is even hinted at.
Why objects? This is just not answered.
Chapter 11 moves on to consider classes without really drawing the distinction between class and instance. We do get a lot of detail about constructors and how to implement a class.
The remaining chapters have some interesting titles - Arrays of Objects, Objects of Arrays and Objects of Objects. These all feature examples of object-oriented data structures: a card object to form an array of cards; a deck object that contains an array of cards; and a hand collection of cards. There's a lot of detail without any clear statement of what murky water it is we are trying to navigate.
This is a book that claims to be something it isn't. It isn't about learning to think like a computer scientist. It is just another book that introduces Java and not particularly well. The order of material is strange and not particularly logical and there are no "big signposts" to tell the reader where they are going and how it fits together. There are lots of places where some topic or other - usually recursion - is thrown in, probably to make the book seem more academic. and hence computer science oriented.
If you are looking for a short idiosyncratic introduction to Java with a few examples, this might be the book for you. If you are looking for a book that will help you understand the deeper ideas behind programming, or even behind Java, you will need to look elsewhere.
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.
|Last Updated ( Wednesday, 20 July 2016 )|