Fundamentals of Computer Science
Welcome. This book teaches programming from the ground up.
Each chapter focuses on one type of data: booleans, integers, arrays, and eventually your own custom types. For each type, you’ll work through five questions: How do I store this data? What operations come built in? How does it affect what the program does? How do I define my own computations with it? How do I combine it into larger structures?
These questions repeat every chapter. By the third time through, you’ll find yourself asking them automatically whenever you encounter something new. That’s the goal: not just learning facts, but building a way of thinking.
What to Expect
Two things shape how this book teaches: precise language and deliberate practice.
Programming requires saying exactly what you mean. Vague descriptions lead to vague understanding, which leads to bugs you can’t explain. So you’ll learn specific vocabulary: what it means to bind a value to a variable, what it means to evaluate an expression. When you see bool x = true;, you’ll know to read it as “create a boolean variable named x and bind the value true to it.” This precision pays off when code breaks and you need to describe what went wrong.
Practice comes in two directions. Sometimes you’ll see code and translate it to English. Other times you’ll see a description and write the code. Both directions matter, because reading and writing are different skills. After each exercise, you’ll compare your answer to a model and note specifically what you got wrong. This self-correction step is where most of the learning actually happens, so resist the temptation to skip it.
Where to Start
If you’re new, begin with Chapter 0. It introduces the core ideas (data, computation, types) and walks you through the practice method you’ll use throughout.
Chapter 0 - Before Beginning: What programming is, how this book teaches, and how to practice effectively.
Chapter 1 - Booleans: True and false values. The simplest data type, and your first complete pass through the five questions.
Chapter 2 - Numbers: Integers and decimals. Arithmetic, comparisons, and counting loops.
Chapter 3 - Arrays: Ordered sequences. Indexing, iteration, and strings as sequences of characters.
Chapter 4 - Classes: Defining your own types. Modeling real things with structured data.