How to Think Like a Computer Scientist: C Version
Allen B. Downey
Copyright Year: 1999
Publisher: Green Tea Press
Conditions of Use
Very good coverage of all beginning topics in C. I might have chosen to emphasize control structures a little more as they appear in the text but they are well integrated and used in a meaningful way. read more
Very good coverage of all beginning topics in C. I might have chosen to emphasize control structures a little more as they appear in the text but they are well integrated and used in a meaningful way.
A little stale but still very usable
A little stale but still very usable
Excellent clarity with good examples in a simple style.
Very well structured. Content is brought in as needed and motivated by previous content.
Well-designed sections cover each new topic.
Nice flow through the book. Topics arise organically from previous work.
Simple pdf format is easy to use. The text does not have hyperlinks or accompanying interactive work.
The grammar is appropriate to the subject. Clear, correct, and error free.
The text makes very few assumptions about the user other than assuming that the user understands arithmetic rules and basic English grammar rules. These concepts are then used in discussing the C programming language.
This author writes simply and concisely. I have suggested this book in the past as an additional class reference but now I will move to using this as the primary class text.
The book is intended as a very first introduction into computer science and programming. As such, its content is well-balanced in comprehensiveness and conciseness. A programming book should not distract with verbose text and this book strikes a... read more
The book is intended as a very first introduction into computer science and programming. As such, its content is well-balanced in comprehensiveness and conciseness. A programming book should not distract with verbose text and this book strikes a good middle ground between the mutually contradicting requirements to explain unintuitive new concepts to novices and keeping the path to experiential proficiency short. The topic of programming in the C language is vast, and the content selection represents a carefully selected minimal set of chapters which is both manageable for first-time programmers and a good basis for further growth. The topics and narrative are true to the title, with the author anticipating the usual suspects of tough concepts to teach the reader just in time. Importantly, the original book (The C++ Version) lacks exercises. The translator has added a very good set of exercises to the end of each chapter, an important contribution.
The selected content is accurate. The depth of the content is chosen carefully to keep the narrative as short as possible yet informative enough to create a good grounding in the most important concepts in C programming, including short forays into the C Standard Library, a sine qua non resource for any C programmer. Despite the C language being the focus and main conduit for computer-science thinking in the book, the concepts are presented in as generic way as possible, allowing the student mind to generalize in the future when it encounters the second programming language in the student’s academic or professional career.
The C programming language is one of the oldest languages still in active use. In fact, its popularity is still growing so that it is a very close second, after Java, on the Tiobe index (https://www.tiobe.com/tiobe-index/). The relevance of the material is, thus, mostly appropriate. As the book presents the C98 standard of the C language, there are minor parts that are outdated. Despite the omission of some important additions and updates that came with C99 (1999) and C01 (2001), the backward compatibility of the major C compilers ensure that the book remains relevant to this day. The C99/C01 changes in no way comprised a major evolution of the C language, so the book remains a great introduction to it and programming in general.
The style of the author is refreshingly clear. Most of this comes from the conciseness and directness of presentation of the topics. The author is aware of the depth of each topic and abstains with discipline to keep the progression very gradual and not to throw the student in at the deep end, which is very easy when introducing a complete novice into such a complex topic. There are only 2-3 spots in the narrative the reviewer believes can be edited to reduce the conceptual change required of the student.
The progression of topics is perfectly constructed to serve the dual goal of narrative conciseness and comprehensiveness of the material. This is usually a difficult task in programming-language books. The author “stays the course” firmly and resists the inevitable urge to throw in an extra detail. This keeps the cognitive load on the student at an appropriate level consistently throughout the narrative.
The segregation of the content into chapters is very good. This is another problem with many programming language books, especially when there are language revisions and evolution. Each chapter presents a standalone set of new concepts well grounded in the previous chapters. The exercises at the end of the chapters extend just a step or two beyond the explicitly covered material, which is just enough to prod the student to apply their knowledge and “play”, a very important habit for a computer scientist.
The topic progression is kept both minimal in terms of new material and unflinching of important details. This is to say that the student has just enough capacity to grasp the main computer science ideas and programming best practices while informed on time about important idiosyncrasies and deviations of the C language. In each case, these details are either explained briefly so as not to keep the student in a lurch, or are given prominent place in the very next chapter.
From the very start, the book makes good use of code examples and figures. Most fortunately, the author has chosen to introduce state diagrams and call-stack sketches as an indispensable mental tool for the novice student. The abstractness of topic of programming and the unintuitiveness of some computer science concepts can be mitigated with visual aids, and the author employs them without fuss at the first appropriate occasion. This said, the book can be updated to modern-day interface standards by having a website with many hyperlinks to more in-depth material, language and library references, and additional explanations and exercises.
There are just a handful of minor grammatical errors that do not detract from the narrative or obscure a topic.
The topic of the book is sufficiently abstract that there are minimal cultural references and they are appropriately unbiased. The style of the book is friendly and accessible. The language of the book is English, which has so far been the worldwide standard for a first book on any programming language. A website might make it easier for the content to be translated into other languages for students who do not have sufficient knowledge of English.
I am considering adopting this book for the Introduction to Computer Engineering course I am teaching. If I decide to do so, I will rework the content according to the review sections above (clarity, relevance, grammatical errors) and bring the interface up to modern expectations, all within the CC BY-NC license.
Table of Contents
Chapter 1: The way of the program
- 1.1 What is a programming language?
- 1.2 What is a program?
- 1.3 What is debugging?
- 1.4 Formal and natural language
- 1.5 The first program
- 1.6 Glossary
- 1.7 Exercises
Chapter 2: Variables and types
- 2.1 More output
- 2.2 Values
- 2.3 Variables
- 2.4 Assignment
- 2.5 Outputting variables
- 2.6 Keywords
- 2.7 Operators
- 2.8 Order of operations
- 2.9 Operators for characters
- 2.10 Composition
- 2.11 Glossary
- 2.12 Exercises
Chapter 3: Function
- 3.1 Floating-point
- 3.2 Constants
- 3.3 Converting from double to int
- 3.4 Math functions
- 3.5 Composition
- 3.6 Adding new functions
- 3.7 Definitions and uses
- 3.8 Programs with multiple functions
- 3.9 Parameters and arguments
- 3.10 Parameters and variables are local
- 3.11 Functions with multiple parameters
- 3.12 Functions with results
- 3.13 Glossary
- 3.14 Exercises
Chapter 4: Conditionals and recursion
- 4.1 Conditional execution
- 4.2 The modulus operator
- 4.3 Alternative execution
- 4.4 Chained conditionals
- 4.5 Nested conditionals
- 4.6 The return statement
- 4.7 Recursion
- 4.8 Infinite recursion
- 4.9 Stack diagrams for recursive functions
- 4.10 Glossary
- 4.11 Exercises
Chapter 5: Fruitful functions
- 5.1 Return values
- 5.2 Program development
- 5.3 Composition
- 5.4 Boolean values
- 5.5 Boolean varaiables
- 5.6 Logical operators
- 5.7 Bool functions
- 5.8 Returning from main()
- 5.9 Glossary
- 5.10 Exercises
Chapter 6: Iteration
- 6.1 Multiple assignment
- 6.2 Iteration
- 6.3 The while statement
- 6.4 Tables
- 6.5 Two-dimensional tables
- 6.6 Encapsulation and generalization
- 6.7 Functions
- 6.8 More encapsulation
- 6.9 Local varaiables
- 6.10 More generalization
- 6.11 Glossary
- 6.12 Exercises
Chapter 7: Arrays
- 7.1 Increment and decrement operators
- 7.2 Accessing elements
- 7.3 Copying arrays
- 7.4 for loops
- 7.5 Array length
- 7.6 Random numbers
- 7.7 Statistics
- 7.8 Array of random numbers
- 7.9 Passing an array to a function
- 7.10 Counting
- 7.11 Checking the other values
- 7.12 A histogram
- 7.13 A single-pass solution
- 7.14 Random seeds
- 7.15 Glossary
- 7.16 Exercises
Chapter 8: Strings and things
- 8.1 Containers for strings
- 8.2 String variables
- 8.3 Extracting characters from a string
- 8.4 Length
- 8.5 Traversal
- 8.6 Finding a character in a string
- 8.7 Pointers and Addresses
- 8.8 String concatenation
- 8.9 Assigning new values to string variables
- 8.10 strings are not comparable
- 8.11 Character classification
- 8.12 Getting user input
- 8.13 Glossary
- 8.14 Exercises
Chapter 9: Structures
- 9.1 Compound values
- 9.2 Point objects
- 9.3 Accessing member variables
- 9.4 Operations on structures
- 9.5 Structures as parameters
- 9.6 Call by value
- 9.7 Call by reference
- 9.8 Rectangles
- 9.9 Structures as return types
- 9.10 Passing other types by reference
- 9.11 Glossary
- 9.12 Exercises
About the Book
The goal of this book is to teach you to think like a computer scientist. I like the way computer scientists think because they combine some of the best features of Mathematics, Engineering, and Natural Science. Like mathematicians, computer scientists use formal languages to denote ideas (specifically computations). Like engineers, they design things, assembling components into systems and evaluating trade offs among alternatives. Like scientists, they observe the behavior of complex systems, form hypotheses, and test predictions.The single most important skill for a computer scientist is problem-solving. By that I mean the ability to formulate problems, think creatively about solutions, and express a solution clearly and accurately. As it turns out, the process of learning to program is an excellent opportunity to practice problem-solving skills. That’s why this chapter is called “The way of the program.”
About the Contributors
Allen B. 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.
Prof Thomas Scheffler, translated the book "How to Think Like a Computer Scientist: C++ Version" to C.