Programming Essays

programming essays

Programming essays here are long-form, worked explanations of how tools and ideas work inside. Pick your first by question: how a tool you use is built, how a data structure behaves, or how a language is made.

If you commit code daily, the most rewarding place to begin is git from the inside out, because the tool is small enough to read end to end. The rest of this page helps you choose among the other essays and shows the kind of reasoning they share.

Choosing where to start

Three criteria settle most choices: what you already use, what you want to be able to do afterwards, and how much abstraction you can tolerate before you see code. An essay on a tool you touch every day gives you something to check the explanation against. An essay on an abstract idea travels further across languages, but it gives you less immediate feedback, so it suits a reader who is comfortable holding an idea before testing it.

  • You use Git daily and it still feels like magic. Start with git from the inside out. The payoff is that commands stop being incantations and become operations on a small set of things you can inspect.
  • You want code that is easier to reason about. Start with a practical introduction to functional programming. It suits readers who are bothered by bugs that depend on hidden state.
  • You keep reaching for lists and arrays without knowing why. Start with data structures explained. Choose it if you want to predict how a structure behaves before you use it.
  • You want to build something that reads code. Start with how to write an interpreter. It is the longest road, but it ties together most of the other topics on this page.
  • You help other people learn. Start with how to teach programming. It suits mentors, lecturers and anyone who answers questions at work.

When to wait: if you have never opened a terminal, begin with an idea-level essay, such as the functional or data structure ones, rather than the Git material, because the Git essay is easiest when you can type commands as you read. If you already read code comfortably and want a project, go straight to the interpreter essays and return to the others when a term trips you up.

What makes a good programming essay

A good programming essay answers one concrete question about how something works, shows the working in code you can run, and stays with specific mechanisms instead of general praise. That is the standard every essay on this site is written to.

Shelves of textbooks in sunlight. These are calculus titles rather than programming ones, but they show the reference shelf that essays send you to once you know which question to ask.

The advice comes from an unexpected place. A college admissions guide on writing about computer science says a strong essay is not about general praise of the subject but about specific features that align with your goals. It is a different genre, yet the discipline transfers. An essay that says a tool is elegant teaches nothing. An essay that shows which file changes when you run a command teaches something you can verify.

The same guide recommends sharing an origin story of how interest in the subject took root. For a programming essay the equivalent is naming the problem that made the tool or idea necessary. A reader who sees why a hash table, a closure or a commit exists will remember the mechanism far better than one handed the definition first.

Short Python snippets with print statements and a type() call: the scale of example that suits a runnable essay, small enough to type and check in a single sitting.
  • One question per essay. A title such as a question about recursion or merging promises one thing. If the essay drifts to a second topic, it should hand the reader to another essay instead.
  • Evidence you can run. Code is a claim you can test. Commands and short programs should be small enough to type in a single sitting.
  • Plain reasoning between steps. The gap between two lines of code is where most readers get lost, so each transition is spelled out in ordinary sentences.
  • Attributed facts. When an essay states how a tool stores data, it names the documentation that says so, and it keeps its own opinions in separate sentences from documented behaviour.
  • Honest limits. An explanation of one mechanism is not an explanation of the whole system. Where an essay simplifies, it says so and moves on.

Reading a worked example

A worked example teaches only if you do something with it, so treat each essay as a lab sheet and not as an article to skim. The method below suits every essay on the page, from the shortest function to a full interpreter.

Hands on the keyboard with a notebook within reach: the working posture the essays assume, where each example is typed, run and annotated rather than only read.
  1. Read the opening question and write down your own guess at the answer before you read further.
  2. Type the first piece of code instead of pasting it. Typing slows you down enough to notice names and punctuation.
  3. Predict the output of each step, then run it and compare.
  4. Change one thing, such as an input, a name or an order of operations, and explain the new result in a sentence.
  5. Close the essay and explain the mechanism aloud or in your notebook. If you cannot, reread the step where your prediction first failed.

This habit pays off most when a prediction fails. A wrong guess marks exactly the place where your mental model differs from the real tool, which is the whole point of reading an essay from the inside.

Line numbers beside the code make it easy to point at a specific line, the habit that keeps a walkthrough precise. The language here is Java, shown only to illustrate reading code line by line.

Git from the inside: objects, refs and the index

Git is the clearest case for an inside-out essay, because its storage model is simple and every part can be inspected with a command. This section answers how Git stores commits and branches internally, using the structure that Pro Git describes.

A content-addressable filesystem with a version control interface

Pro Git puts it bluntly: Git is fundamentally a content-addressable filesystem with a VCS user interface written on top of it. That one sentence changes how you read everything else. The commands you type daily are the interface, and the content store underneath is what actually holds your history.

Git itself is described as a free and open source distributed version control system. Version control, as a practice, means keeping a record of changes so you can return to earlier states. One book on Git describes the result as a tool that greatly simplifies the software development cycle by letting users create, use and switch between versions. The inside-out view explains how that switching can be cheap: you are moving between entries in a store, not rebuilding files by hand.

What a new repository contains

Run the initialisation command in an empty directory and look inside the hidden Git directory. Pro Git lists four important entries: the HEAD and index files and the objects and refs directories. Each has a distinct job.

  • The objects directory stores all the content of the database. Everything you commit ends up here as an object.
  • The refs directory stores pointers into commit objects. These pointers are branches.
  • The index file is where Git stores your staging area information, the set of changes prepared for the next commit.
  • The HEAD file is the fourth entry in the list. The essay on Git internals follows what it tracks as you move between branches.

This division is a useful mental map. Content lives in one place, names for points in history live in another, and the staging area sits between your working files and the store. When a Git command surprises you, ask which of these locations it changed.

Blobs, trees and commits

You can see the content store working with only a few plumbing commands. The procedure below follows the example Pro Git uses, and you can run it in a throwaway directory.

  1. Create an empty repository with: git init
  2. Store a piece of text directly in the database with: echo ‘test content’ | git hash-object -w –stdin
  3. Note what comes back. Pro Git reports that the output is a 40-character checksum hash, the SHA-1 key for that content.
  4. Ask Git what it made, using that key: git cat-file -t followed by the hash.

The last command is the revealing one. Pro Git explains that you can have Git report the object type of any object, given its SHA-1 key, and the answer is blob, tree or commit. A blob is stored file content. A tree plays the role of a directory. A commit is the third kind of object, which is how history itself is recorded in the same store as the files.

On disk, the initial storage format is plain. Pro Git describes a single file per piece of content, named with the SHA-1 checksum of the content and its header, with the first 2 characters of the hash naming a subdirectory. That is why browsing the objects directory shows many short directory names. The name of an object is derived from its content, so identical content is identified identically.

Trees explain how a snapshot of a whole project is represented. Pro Git says all content is stored as tree and blob objects, with trees corresponding to UNIX directory entries. A single tree contains one or more entries, and each entry carries a SHA-1 pointer, a mode, a type and a filename. A tree entry can point to a blob or to another tree, which is how nested directories fit the same scheme.

Branches as refs

Put the pieces together and the original question has a short answer. Commits are objects in the objects directory, alongside blobs and trees. Branches are not separate structures at all. They are the pointers in the refs directory that Pro Git describes, each aiming into a commit object. That is why creating or moving a branch is a small operation: you are changing a pointer, not copying content.

Seeing branches as pointers also prepares you for the next question. Once two pointers have moved apart, how does Git combine the work behind them? That is what how does git merge work sets out to answer, using the same objects and refs you have just inspected.

Functional ideas: purity, closures and recursion

The functional essays share a theme: understanding what a function depends on and what it can change. They suit readers who want predictable code, and they reward careful reading more than fast reading, since each idea builds on the last.

  • Purity. The question behind what is a pure function is how a function relates to the world outside it. Read it first, because the vocabulary of inputs, outputs and side effects returns in the other functional essays.
  • Closures. The essay on what is a closure in programming asks how a function can carry context with it. It is the right second step once you are comfortable with functions as values.
  • Recursion. The essay on how recursion works follows a function that calls itself. It matters beyond the topic itself because it recurs in the data structure and interpreter essays.

Order matters here as a matter of judgement. A reader who starts with recursion often meets terms the other two essays define, while a reader who starts with purity can usually follow the rest without backtracking. If you are short of time, read purity and stop there; it changes how you review code immediately, whereas the other two reward a longer sitting.

The broader practical introduction to functional programming is the path to follow if you want the three ideas presented together instead of separately.

Data structures: hash tables, linked lists and heaps

Data structure essays work best when you draw the structure before you run any code. A sketch of nodes and arrows forces you to commit to a model, and the code then confirms or corrects it. Keep paper or a whiteboard beside you.

  • Hash tables. The question in how do hash tables work is how a structure finds a stored value without searching everything. Building one from scratch is the quickest way to see which design decisions are involved.
  • Linked lists and trees. A linked list explained step by step is the foundation for trees, since both are made of nodes that refer to other nodes. If you read the Git section above, you have already met a tree of this kind, because a tree object points to blobs and to other trees.
  • Heaps and priority queues. The heap data structure explained goes furthest in abstraction. Take it last, after the node-and-pointer picture feels natural.

If you are choosing one, choose by the problem you face. A reader who wonders why lookups are quick should start with hash tables. A reader who wants to understand how structures grow out of references should start with linked lists. A reader who has already built both can take on heaps. The overview in data structures explained helps if you would rather compare them before committing.

Arrows linking handwritten labels on a whiteboard. The diagram is not a data structure, but it shows the kind of sketching that precedes code when you plan how nodes refer to one another.

Languages and interpreters: Lisp and parsers

The interpreter essays are the capstone of the collection, because they combine recursion, data structures and careful reading of text. Do not begin here unless you are comfortable with at least one of the earlier groups.

  • The language. What is lisp programming language introduces the ideas behind a language whose programs and data share the same shape. Read it if you are curious about why it keeps appearing in discussions of language design.
  • The build. The little lisp interpreter essay turns that idea into a program you can run. It suits readers who learn by building and who have already seen recursion at work.
  • The front end. How does a parser work covers how raw text becomes something a program can evaluate. It is useful even if you never write an interpreter, because configuration files, query languages and templates all need the same step.

A sensible order is the language idea first, then the parser, then the full interpreter. You get vocabulary, then the front end, then the complete system. Readers in a hurry can skip straight to the build, but they will need to return to the parser essay when the input handling stops making sense.

Teaching and helping others

Several essays approach programming from the side of the person explaining it. They matter even if you are not a teacher, because most developers explain code to a colleague at some point, and the habits that work in a classroom work in a code review.

The central practice is the one the reading method above relies on: make the learner predict, then reveal what happened. Sitting side by side at one screen supports that well, since the explainer can stop at the moment a prediction goes wrong instead of finishing a monologue. When the essays discuss teaching, they treat a wrong guess as useful information about the learner’s mental model, not as a failure.

One person types while the other watches and asks questions, the pairing arrangement that lets a helper catch the moment a prediction goes wrong.

Building a reading path

You do not need to read every essay, and you do not need to read them in the order they appear on this page. The pages are written so each stands alone, with the question stated at the top and the prerequisites named where they matter. A short path through one theme usually teaches more than a scattered tour of all of them.

  • For tool fluency. Read the Git internals essay, then the merge essay, and try the plumbing commands in a scratch repository after each.
  • For clearer code. Read purity, then closures, then recursion, and rewrite a small function of your own after each one.
  • For a project. Read the language essay, then the parser essay, and build the interpreter last.
  • For structure. Read linked lists, then hash tables, then heaps, drawing each one before you code it.

Keep a notebook of the questions an essay raises but does not answer. Those questions usually point to the next essay you should read, and they are a better guide than any fixed curriculum. Reference books and documentation then fill in detail once the mechanism is clear, which is the right moment to consult them.

Frequently asked questions

What is Git, and how does it relate to version control?

Git is a free and open source distributed version control system, according to its published documentation. Version control is the broader practice of recording changes so earlier states can be recovered, and Git is one tool that implements it.

Should I type the code in an essay or only read it?

Type it. Typing forces you to notice names and punctuation, and it gives you a working copy you can change to test your understanding. Reading alone tends to feel clear until you try to reproduce the result.

Do I need to read the essays in a fixed order?

No. Each essay opens with its own question, so you can start wherever your need is greatest. Follow a theme, such as functional ideas or data structures, if you want a sequence that builds on itself.