Allen Downey and Chris Mayfield: Think Java

Allen Downey and Chris Mayfield: Think Java

Allen B. Downey, Chris Mayfield
Think Java: How to Think Like a Computer Scientist
2016, xviii, 273 pp., PDF

This book is available under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
Green Tea Press
You can download the book from here.


The book is also published through O’Reilly Media.

Allen B. Downey, Chris Mayfield
Think Java: How to Think Like a Computer Scientist
Mai 2016, 252 pp., Softcover
O’Reilly Media
ISBN 978-1-49192-956-8


A second updated and expanded edition of the book was published by O’Reilly Media on the 31st December 2019. A draft second edition can be downloaded from Green Tea Press. This review discusses solely the 2016 Green Tea Press edition of the book.

Allen B. Downey, Chris Mayfield
Think Java: How to Think Like a Computer Scientist, 2nd Edition
December 2019, 305 pp., Softcover
O’Reilly Media
ISBN 978-1-49207-250-8



Think Java: How to Think Like a Computer Scientist is intended as an “initial exposure to programming constructs and techniques” (p. xiii) for computer science students with no or very limited programming experience. Published through Green Tea Press under a permissive license, the book can also be purchased through O’Reilly Media as a hard copy.
I don’t know whether I would choose this book for teaching Java – should I ever be put in the position of teaching it – but I would definitely consider it.


Structure and Content

The book is subdivided into 14 chapters with three additional topics encompassing Development Tools, Java 2D graphics and Debugging as part of the appendices.

The first chapter named somewhat pompously The way of the program acts as an introduction and presents some cross-cutting concerns like code formatting and debugging. The stated goal of the book is

to teach [the reader] to think like a computer scientist. This way of thinking combines some of the best features of mathematics, engineering, and natural science.

Think Java, p. 1

The authors define programming “as the process of breaking down a large, complex tasks into smaller and smaller subtasks”. Computer science is regarded as the “science of algorithms, including their discovery and analysis” and problem solving is being identified as the most important skill of a computer scientist (p. 1f).

Following an “objects late” approach, the book starts with simple topics like declaring variables, arithmetic operators and floating-point numbers. The second chapter Variables and operators also introduces the types of errors which can happen in a program: compile-time errors, runtime errors and logic errors. This topic is discussed more broadly in the Debugging appendix.

The third chapter Input and output introduces the System and Scanner classes and exemplifies with a simple centimeters to inches conversion program their usage. The modulo operator and specialties of the automatic number type conversions are takeaways for the student. The sub-chapter titled The Scanner bug offers a very nice example of how sometimes knowledge of the implementation of an API is necessary to perform the intended task.

Chapter four deals with Void methods. The Math class and void methods – with and without parameters – are presented. The authors stress the importance of reading the JavaDocs and also the significance of writing documentation.

Conditionals and logic – the subsequent chapter – discusses booleans, relational and logical operators and introduces the if-statement, followed by the return statement as a possibility to early terminate a method. The chapter ends with an overview of recursive methods and binary numbers.

Value methods performs the next logical step as it discusses methods with return values and method overloading.

The seventh chapter Loops discusses the while and do-while loops and the for-statement together with the break and continue statements. Object oriented principles like encapsulation and generalization are introduced.

Arrays presents what its name suggests: creation of arrays, their traversal with for and for-each and searching for values – a topic which is deepened in the following chapters. The chapter finishes with aspects of generating random numbers in Java.

While Strings and things talks about the immutability of strings, string comparison and other string-related aspects, chapter ten finally introduces Objects. Aliasing, mutability and the null keyword are presented. Garbage collection and the Unified Modeling Language are briefly described.

From objects the text leads students to classes where constructors, getters and setters, pure methods, information hiding and several other concepts are demonstrated.

The remaining three chapters: Arrays of objects, Objects of arrays and Objects of objects propose the implementation of the card game Crazy Eights. Their content demonstrates all that has been thought so far. Certain topics are deepened. Class variables, immutable objects, inheritance and some searching and sorting algorithms are introduced.

Appendix A Development tools discusses briefly DrJava a “teaching” IDE, the usage of the command line interface, how to run Checkstyle and how to write JUnit tests.

Appendix B Java 2D graphics is a very short introduction to AWT and Appendix C Debugging a long How-to discussion of what to do as a student in case of problems like “My program doesn’t work.”

Discussion

The book is a textbook for prospective programmers. Its clear and concise style and its structure with many examples and encouragements to try things out are aligned with the books stated philosophy. The book’s “facetious and grandiose” sub-title as the author himself calls it, appears as more inappropriate than it is. Being curious while working in a structured manner, trying out, building things iteratively, debugging, learning and applying algorithms while thinking creatively in order to solve problems are the cornerstones of a computer scientists thinking. The book tries to inculcate all of these in the students minds while teaching the basics of Java.

I don’t know whether I would choose this book for teaching Java – should I ever be put in the position of teaching it – but I would definitely consider it.


About the authors

Allen Downey, the main author of the book, is Professor of Computer Science at Olin College in Needham, Massachusetts. His interests include among others Bayesian statistics and Python. He strongly believes in writing free books, having already written several of them. Some of them are: Think Bayes, Think Python, Think Data Structures.

Source: The information about the author is taken from his website – retrieval date 09.02.2020.

Chris Mayfield is an Associate Professor at the Department of Computer Science at the James Maddison University in Harrisonburg, Virginia. His interests include computer science education, machine learning and data structures.

Source: The information about the author is taken from his profile page on the James Maddison University website – retrieval date 09.02.2020.


Folgende Bücher könnten Sie ebenfalls interessieren:

Petre Sora

Petre Soras Interessen sind vielfältig und befinden sich an der Schnittstelle zwischen Mensch und Informationstechnologie. Als studierter Psychologe und Software Engineer war er sechs Jahre als Java-Entwickler in mehreren Unternehmen tätig. Mit der Gründung der Rezensionsplattform nososo hat er sich entschieden eigene Wege zu gehen.

Schreibe einen Kommentar