computational thinking

Computational thinking is the skill of turning a messy, real-world problem into a sequence of steps precise enough for the fetch-decode-execute cycle from Topic 1 to actually carry out. It rests on four habits practiced together: decomposition, which means splitting one large problem into smaller pieces that can each be solved on their own; pattern recognition, which means noticing that a step already solved once is simply repeating, rather than being brand-new work every time; abstraction, which means deciding which details actually matter for solving the problem and deliberately setting the rest aside — the same idea Topic 3 relied on when it treated eight bits as either an integer or a character depending only on which interpretation mattered, without needing to think about the underlying voltage levels at all; and algorithm design, which means assembling the decomposed, pattern-matched, abstracted pieces into one precise, finite sequence of steps that always produces an answer. Pseudocode is that algorithm written down in a plain, half-English, half-structured form before any real programming language gets involved — a stepping stone whose only job is making sure the sequence of steps is complete and unambiguous, not actually running on a computer yet.

A concrete problem makes all four habits visible at once: how much disk space does a given directory use, counting everything inside every directory nested beneath it? Decomposition splits this into two separately solvable pieces — find the size of one file, and find the size of one directory — where the second piece turns out to depend on the first. Pattern recognition notices something important here: a directory can contain other directories, so the exact same find-the-size-of-a-directory step needs to run again on each one of those, which means the sub-problem is repeating rather than being new work, the core insight behind recursion, a procedure whose own definition calls back to itself. Abstraction keeps the plan simple by setting aside irrelevant detail: the procedure never needs to know how the storage device from Topic 1 physically arranges those bytes on disk, only that each file reports a size in bytes, the exact unit Topic 3 defined. Putting all of this into pseudocode: start a running total at zero; for each entry in the directory, add its size to the total if it is a file, or run this same procedure on it and add whatever total comes back if it is a directory; once every entry has been visited, the running total is the answer. That pseudocode is detailed enough for a person to carry out by hand on a small folder, and precise enough that Programming Fundamentals, a later topic in this series, can turn it directly into real, running code without resolving any further ambiguity.

Problem: how much space does this directory use?
a messy, real-world question with no steps yet
Decomposition
split into: size of one file, size of one directory
Pattern recognition
a subdirectory is the same question, asked again
Abstraction
ignore how bytes sit on the disk; only the count matters
Pseudocode
a complete, unambiguous step-by-step procedure
Ready for real code
Programming Fundamentals turns this into a running program
Decomposing One Problem Into Smaller Pieces a directory's size depends on the size of everything inside it Directory size? It's a file add its byte count to the running total It's a subdirectory ask the same question again, one level down recursion: the same question, asked again once every entry is visited, the running total is the answer
Abstraction: What the Procedure Keeps vs. Ignores only the details that matter for the answer survive into the pseudocode Kept each file has a size, measured in bytes a directory can contain files and other directories totals from sub-directories add into the running total Ignored which physical sectors a file occupies on disk the file's storage device: SSD, hard drive, or network which program last changed or opened a given file good abstraction keeps exactly what the problem needs and throws away everything else, on purpose

Go deeper with CFSGPT

Get AI-powered deep-dives, save terms, and run advanced simulations — free account.

Create Free Account