How to Think Like a Computer Scientist: Learning with Python
Allen Downey, Franklin W. Olin College of Engineering
Jeff Elkner, Yorktown High School
Chris Meyers, Lane Community College
Pub Date: 2008
Publisher: Green Tea Press
Conditions of Use
This book is designed for beginning programmers, but it still useful for readers with prior programming experience. The book starts out with a read more
This book is designed for beginning programmers, but it still useful for readers with prior programming experience. The book starts out with a well-written discussion of algorithms, machine language, and other helpful foundational material for new programmers. The following chapters introduce the elements of the Python language in a thorough and comprehensive fashion. There is certainly much more that could be said about Python, but the scope seems just right for an introductory text.
I did not note any errors or issues with accuracy.
This text has been around for several years (current edition = 2008) and is a popular and widely known textbook on the Python language. The authors should be able to update it without a problem as new versions of Python are released.
I teach an introductory programming course myself, so I have an eye for concepts that can easily trip up new programmers. I think the greatest strength of this text is the simple, readable prose and the logical manner in which the material is presented. In courses such as math, chemistry, and physics, students are trained to learn a new concept and then apply that concept to example problems and homework exercises by following the pattern in the examples. While this is still true to a certain degree in programming courses, programming is more open-ended and there is often a large number of ways one can use the syntax and structure of the language to accomplish a given task. This open-ended nature can be a major stumbling block for some new programmers, who feel more secure with a "cook book" approach to problem solving. As the title of the book indicates, the text is written in a way that teaching the students to think algorithmically, thus empowering them to harness the creative aspect of programming.
The text maintains a consistent tone throughout. The terminology is consistent and new terms and concepts are introduced in a logical manner.
The text is divided into 20 chapters, each of which covers a specific topic. However, one has to be careful when not reading the text sequentially. For example, functions are introduced in chapter 3, but it is not a complete coverage. Functions are further explained in the following two chapters: 4 and 5. It seems the authors have organized the book in this fashion in order to keep each chapter short and focused, which is a worthy goal. But an instructor would need to be careful about assigning portions of the book to cover specific topics.
Excellent organization. Simple foundational topics are covered first and the chapters progress to more advanced topics at the end.
The PDF version is nicely formatted. The HTML version is simple and easy to navigate.
The book provides a good overview of Python syntax and basic functions, while also examining more complicated and potentially confusing concepts read more
The book provides a good overview of Python syntax and basic functions, while also examining more complicated and potentially confusing concepts (e.g., abstract data types). Python-specific glossaries are provided at the end of each chapter, and the ideas build from simple to complex. The book is good for both beginner and intermediate developers.
I worked through about a third of the code, and found no errors. I focused primarily on the concepts and less on the computation, and was pleased to see that - although the book can be useful as a tutorial - it also stands alone as a conceptual problem solving book, which reaffirms the title phrase, “how to think like a computer scientist.”
The emphasis on general programming concepts, and the exploration of computer science as a means of designing methods, functions, and algorithms to solve linear or iterative/recursive problems makes the utility of the book long lasting. Additionally, the focus on simple and fundamental core concepts (such as syntax and format), increases the usefulness of the book for beginner and intermediate level programmers.
Generally speaking, the authors carefully and deliberately explain the use of Python for solving specific computational problems. The later chapters become a bit abstract, but this is probably the nature of the concepts, and not so much a shortcoming of the explanations. Iterative readings, as well as continued programmatic familiarity, will help the reader understand more clearly. From a formatting perspective (i.e., bold, italics), the book does a good job of communicating types of Python language. At the end of each chapter, the glossary of newly introduced concepts helps cement the ideas further.
The themes and structure of the book are consistent from chapter to chapter, and relatively easy to follow. The concepts build consistently upon each other, from very simple to complex and abstract. Most importantly, the example problems are topically consistent, and are touched upon in multiple chapters (i.e., programming a card game).
The structure of the book lends itself to modular development, and even repeatedly reminds the reader to break processes down into smaller, more manageable chunks. The book also repeatedly suggests the benefit of generalizing snippets of code into tools that can be recycled into multiple workflows.
The flow of the book is good, incrementally proceeding from very basic examples of statements and functions to more complicated examples of classes and objects. The typological formatting of the book is explicitly designed to communicate an at-times non-intuitive Python vocabulary. The structure of the chapters becomes suitably familiar, and often iterates through multiple examples of achieving similar or identical results with varied syntax and structure.
The book is not designed to be a step-by-step tutorial, but instead balances applicable code examples with a narrative about the advantages and simplicity of programming in Python. In between sections, the reader is invited (in italics) to be creative and fix or enhance code without explicit or obvious guidance. The book will reward the casual reader and dedicated coder alike.
No grammatical errors of note.
The primary cultural relevance of this book is to make computer science more user-friendly, familiar, and attainable by providing tangible examples of programming as, essentially, stepwise problem solving. Additionally, coding is not portrayed as being particularly easy or difficult; good code is attainable, but it takes thought (to plan ahead of time) and patience (to fix afterwards).
I really enjoyed the combination of a broad overview and detailed examples of “how to think like a computer scientist,” and I look forward to reading again and recommending to my students as a good intro to programming generally and Python specifically.
The book covers the basics of programming in the Python language in a very readable fashion. The materials are organized reasonably well. The new read more
The book covers the basics of programming in the Python language in a very readable fashion. The materials are organized reasonably well. The new concepts are always introduced to have a direct comparison to previous Chapters. The new terminology is revisited in the end of each Chapter. The PDF file lacks links, which makes the reading slightly inconvenient. Each Chapter includes one or two questions for the students to think and code. More examples and Problems are definitely very welcome and helpful. I understand that this is a short book, but some important concepts, such as List Comprehensions, are not discussed. Overall, the book serves very well as introductory materials for the students to grab fundamental programming concepts using Python, and does this job very effectively.
I only spotted one minor error throughout the whole book. On pg 48, the “type string” should be “type str”.
The book's topics are very basic and so always relevant for Python Programming. Many people are concerned about the transition to Python 3 that has significant difference to Python 2 in terms of data types and many other aspects. That should be a completely new book to cover Python 3. I think the current book did an excellent job for introducing those basic Python concepts and styles that will definitely last in future versions.
The explanations and examples are extremely clear. For example, whenever a new type or new concept is introduced, it is directly compared or differentiated from previous chapters. Furthermore, the technical terminology is clearly defined throughout the text and in the end of each chapter.
The overall style of chapters is very consistent.
The text is divided up into 20 chapters and three appendices. All of them are relatively short with ~10 page each. The overall grouping of materials is excellent. Chapters are generally built upon previous chapters and it is better to read through in sequence.
The content is well structured. All the Chapters are very short and concise for specific data types or concepts, such as String, List, Tuples, Dictionary, Function, and Class. The flow is very well from simple to more complex, and new terminology are introduced in the beginning and revisited in the end in such a way that reader can also grab the difference to relevant ones in previous Chapters and that follows.
The main critic of this book is lack of links, which makes the navigation a little inconvenient. That would be helpful if the PDF can be made crossed-linked. Also, organizing the code in blocks instead of spreading out all over the place would make people test the code easier.
I was not aware of any grammatical errors in the book. Apparently, the book has been proof read by many authors and probably many readers as well.
For this matter, I did not find anything worthy of mentioning. No material presented in this book is cultural sensitive or offensive to any group of people.
I was very motivated to review this book upon request because my research group uses Python quite extensively as an interface language to electronic structure modeling. The book serves very well as introductory materials to students who do not have much programming background. Some of my students and myself did not have strong interests to understand or apply some of the concepts covered in the book (e.g., Queues, Tree). But overall I found it to be very readable, and I plan to use it as the required reading material for new group members and for a modeling course I am developing.
Table of Contents
- Chapter 1: The way of the program
- Chapter 2: Variables, expressions and statements
- Chapter 3: Functions
- Chapter 4: Conditionals and recursion
- Chapter 5: Fruitful functions
- Chapter 6: Iteration
- Chapter 7: Strings
- Chapter 8: Lists
- Chapter 9: Tuples
- Chapter 10: Dictionaries
- Chapter 11: Files and exceptions
- Chapter 12: Classes and objects
- Chapter 13: Classes and functions
- Chapter 14: Classes and methods
- Chapter 15: Sets of objects
- Chapter 16: Inheritance
- Chapter 17: Linked lists
- Chapter 18: Stacks
- Chapter 19: Queues
- Chapter 20: Trees
- Appendix A: Debugging
- Appendix B: Creating a new data type
- Appendix D: Recommendations for further reading Index
About the Book
How to Think Like a Computer Scientist: Learning with Python is an introduction to programming using Python.
About the Contributors
Allen Downey is an American computer scientist, Professor of Computer Science at the Franklin W. Olin College of Engineering and writer of free textbooks. Downey received in 1989 his BS and in 1990 his MA, both in Civil Engineering from the Massachusetts Institute of Technology, and his PhD in Computer Science from the University of California at Berkeley in 1997. He started his career as Research Fellow in the San Diego Supercomputer Center in 1995. In 1997 he became Assistant Professor of Computer Science at Colby College, and in 2000 at Wellesley College. He was Research Fellow at Boston University in 2002 and Professor of Computer Science at the Franklin W. Olin College of Engineering since 2003. In 2009-2010 he was also Visiting Scientist at Google Inc.
Jeffrey Elkner is a high school math and computer science teacher at Yorktown High School in Arlington, Virginia.
Chris Meyers is a professional programmer who teaches a beginning Python class at Lane Community College in Eugene, Oregon.