Skip to content
Writing
Engineering
· · 11 min

The abstraction of incompetence

listen to this article from the Wonder Why? podcast
Listen

When I started learning software engineering, I discovered Bootstrap.

And my God, Bootstrap was an incredible piece of technology.

For somebody who had only recently discovered HTML and CSS, the ability to add a couple of class names to an element and suddenly have something that resembled a professionally designed interface felt like an intellectual shortcut of the highest order.

I could build a navigation bar without particularly understanding everything that went into the construction of a navigation bar.

I could implement a responsive layout without fully understanding the intricacies of responsive layouts.

And for a while, the quality of what I could produce was considerably higher than the quality of my understanding.

There’s nothing inherently wrong with that. In fact, it’s one of the beautiful things about technology. We build on the intellectual efforts of the people who came before us.

But somewhere between discovering Bootstrap, learning JavaScript, becoming a professional engineer and watching AI generate entire applications, I’ve developed a rather uncomfortable question.

At what point does an abstraction stop amplifying your competence and start concealing your incompetence?

The beautiful thing about not knowing

Software engineering is essentially an exercise in abstraction.

I don’t need to understand the electrical properties of a transistor to declare a variable in JavaScript.

I don’t need to understand the implementation of every operating system’s networking stack to make an HTTP request.

And I certainly don’t need to understand how a browser rasterises every glyph in a typeface before I can decide that I don’t particularly like its lowercase g.

Abstraction is what allows us to operate at increasingly sophisticated levels of thought without having to reconstruct the foundations of computing every Monday morning.

Imagine having to implement a TCP stack before you could build a login form.

We’d all be miserable.

The value of abstraction is that it allows us to defer understanding of certain complexities until that understanding becomes relevant.

The problem, I think, begins when we confuse deferred understanding with unnecessary understanding.

They’re two fundamentally different things.

One acknowledges that complexity exists somewhere beneath the surface.

The other assumes that because we can’t see the complexity, it doesn’t exist.

And software has a rather entertaining way of reminding us that it does.

Usually in production.

The competence illusion

Consider this incredibly ordinary React component.

function SearchResults({ query }: Props) {
  const [results, setResults] = useState([]);

  useEffect(() => {
    fetch(`/api/search?q=${encodeURIComponent(query)}`)
      .then(response => response.json())
      .then(setResults);
  }, [query]);

  return <Results items={results} />;
}

An engineer with relatively little experience can write this. An AI model can generate something equivalent almost immediately.

And under reasonably favourable conditions, it works.

But imagine I type the word “software” into the search field.

The request for “soft” takes 900 milliseconds.

The request for “software” takes 100 milliseconds.

The more recent request finishes first, correctly updating the interface.

Then the earlier request finishes and replaces the results with something I am no longer searching for.

Now React is displaying the wrong information, despite every individual piece of the application apparently working correctly.

The network requests succeeded.

The state updates succeeded.

The rendering succeeded.

The experience failed.

Why?

Because the abstraction made it relatively easy to express the behaviour without requiring us to reason about the ordering of asynchronous operations.

Results appear here

Not recommended: Last response wins

Results appear here

Recommended: Stale requests aborted
Type “software”, or press the button. One box types into both; each row is a request, numbered in the order its answer arrived.

A more considered implementation might look like this:

useEffect(() => {
  const controller = new AbortController();
  let active = true;

  async function search() {
    try {
      const response = await fetch(
        `/api/search?q=${encodeURIComponent(query)}`,
        { signal: controller.signal }
      );

      if (!response.ok) {
        throw new Error("Search failed");
      }

      const results = await response.json();

      if (active) {
        setResults(results);
      }
    } catch (error) {
      if (active && !controller.signal.aborted) {
        reportError(error);
      }
    }
  }

  void search();

  return () => {
    active = false;
    controller.abort();
  };
}, [query]);

Now we have a way of preventing an obsolete request from updating the current results, alongside cancellation of the previous fetch when appropriate.

There are still other things we might consider, including , caching, loading states and how we present failures to the user.

But the more important thing we’ve introduced is an understanding of the underlying problem.

Asynchronous operations don’t necessarily complete in the order in which they began.

React didn’t invent that problem.

React merely gave us a convenient environment in which to encounter it.

And this is what I find particularly interesting about engineering competence: sometimes the most valuable thing an engineer knows has absolutely nothing to do with the framework they’re using.

Your framework isn’t the runtime

I’ve noticed something interesting about frontend engineering over the years.

It’s entirely possible to become quite proficient at writing React without developing a particularly good mental model of the browser.

You understand hooks. You understand components. You understand how to install packages, manage state and configure your application.

Then somebody asks you why a button becomes unresponsive while a large computation is running.

And suddenly we’re in rather uncomfortable territory.

Consider this:

async function processImage(pixels: Uint8Array) {
  for (let i = 0; i < pixels.length; i++) {
    pixels[i] = expensiveTransform(pixels[i]);
  }

  return pixels;
}

We’ve declared the function asynchronous.

So surely it isn’t blocking the interface?

Except the async keyword doesn’t magically move computation to another thread. The synchronous work inside that function still executes on the calling thread.

If that happens to be the browser’s , a sufficiently expensive computation can prevent the browser from responding promptly to input and painting updates.

And adding another abstraction doesn’t necessarily solve it.

await Promise.resolve();
processImage(pixels);

We’ve introduced a microtask boundary. We haven’t moved the expensive computation off the main thread, and we’ve not necessarily given the browser an opportunity to paint before that computation begins.

The engineer who understands the browser’s execution model can start asking considerably better questions.

Can we divide the work into smaller units and yield between them?

Can the operation execute inside a Web Worker?

Can we avoid the computation entirely through a better representation of the underlying data?

Can the browser’s graphics pipeline handle the operation more efficiently?

Perhaps something like this is appropriate:

const worker = new Worker(
  new URL("./image.worker.ts", import.meta.url),
  { type: "module" }
);

worker.postMessage(
  { type: "process", buffer: pixels.buffer },
  [pixels.buffer]
);

By transferring the buffer to a worker, we can move the computation away from the main thread and avoid copying that particular buffer.

Of course, transferring an ArrayBuffer detaches it from the sending context. If we still need the original pixels, we have to account for that. We also need to consider worker lifecycle, cancellation, message overhead and how we communicate progress.

Uploading 3 photos

Filter: Original

Press Apply filter, then type a caption. On the main thread or behind a promise the tab freezes, and the strip shows the frames that were never painted.

The solution introduces another set of trade-offs.

But at least we’re now having the right conversation.

We’re discussing the actual constraints of the runtime rather than searching indefinitely for another React hook that claims to fix performance.

The abstraction debt

Technical debt is something we’ve become relatively comfortable talking about.

We know what happens when we ship a poor implementation today with the intention of replacing it tomorrow.

But I think there’s another form of debt we accumulate quite frequently, and it’s somewhat more difficult to observe.

I call it abstraction debt.

It’s the accumulated difference between the complexity of the systems we operate and our ability to understand them when their abstractions fail.

Every time we introduce a library we don’t particularly understand, an architectural pattern we can’t justify, or a generated implementation we can’t meaningfully interrogate, we potentially increase that difference.

The interesting thing about abstraction debt is that it doesn’t necessarily appear as poor-quality code.

An application can look incredibly clean.

The folders can be beautifully organised. The TypeScript coverage can be excellent. The components can be appropriately separated. The entire test suite can pass.

And yet nobody on the team can explain why memory consumption continuously increases after navigating between certain pages.

The competence of the system has outgrown the understanding of its operators.

That’s a rather dangerous place to be.

Consider an application that subscribes to an external event source.

useEffect(() => {
  editor.on("change", handleChange);
}, [editor]);

The subscription works.

But if the listener isn’t removed when the component unmounts or the editor instance changes, and the emitter retains that listener, we can accumulate subscriptions and potentially retain references to objects that would otherwise become eligible for garbage collection.

The abstraction made the subscription convenient.

It didn’t eliminate the lifecycle of the underlying resource.

NotesPage 1

Write something…

editor.on("change")
page 1
Not recommended: No cleanup
NotesPage 1

Write something…

editor.on("change")
page 1
Recommended: Removed in the cleanup
Switch pages a few times, then type. One press reaches both; a page you have left should hold no listener.

The corrected implementation might be something as ordinary as this:

useEffect(() => {
  const listener = (event: ChangeEvent) => {
    handleChange(event);
  };

  editor.on("change", listener);

  return () => {
    editor.off("change", listener);
  };
}, [editor, handleChange]);

Again, an incredibly small piece of code.

But knowing why it matters requires understanding references, object reachability, subscription lifecycles and the relationship between component state and external resources.

The framework cannot permanently exempt us from the rules of the environment in which it operates.

Experience is a compression algorithm

When I was younger, I lived with a group of friends who were all incredibly competitive about becoming better at what they did.

One of them was particularly fascinated by the intricacies of JavaScript itself. Why use a particular data structure? What happens to memory? Why does one implementation perform differently from another? What are the consequences of a particular engineering decision?

I was considerably more interested in how the software looked and felt.

But what I’ve grown to appreciate over the years is that the depth of his understanding allowed him to arrive at certain conclusions significantly faster than somebody who had only memorised the recommended implementation.

He didn’t necessarily have to investigate every possibility.

He understood the underlying principles well enough to eliminate a considerable number of them.

And that’s what I think experience actually is.

Experience is a compression algorithm for reasoning.

An experienced engineer looks at a particular failure and immediately considers three plausible explanations.

A less experienced engineer might consider thirty.

Not because the experienced engineer possesses some inexplicable intellectual superiority, but because years of mistakes, investigations and accumulated mental models have compressed the space in which they need to search.

You know which questions to ask.

You know which assumptions to interrogate.

You know when a symptom is likely to be unrelated to the apparent cause.

And occasionally, you know exactly which innocent-looking line of code is about to ruin your afternoon.

This is why I find the act of debugging particularly valuable.

The process of discovering why something doesn’t work often teaches you considerably more than the process of implementing something that does.

AI and the economics of understanding

Now let’s introduce AI into this conversation.

For the first time in my career, I can describe a relatively sophisticated piece of software in natural language and receive an implementation that might actually work.

That’s incredible.

I don’t think we should minimise how extraordinary that capability is.

But something interesting has happened to the relationship between production and understanding.

Historically, producing a certain class of software required at least some familiarity with the underlying implementation. The process of writing the code imposed a degree of intellectual participation.

Not necessarily enough, but some.

Today, that participation is increasingly optional.

You can generate the implementation before developing the mental model required to understand it.

And I don’t think that’s inherently problematic either.

Sometimes seeing an implementation is the fastest way to start understanding a concept.

The problem is when we stop there.

Imagine two engineers using AI to implement a cache.

Engineer A generates an implementation, integrates it, runs the application and confirms that the responses are considerably faster.

Engineer B does the same thing but also asks:

What constitutes a valid cache key? How do we invalidate this? What happens if several requests attempt to populate the same missing entry? Is the cache scoped to a particular user or organisation? What is the acceptable level of staleness? Is its memory consumption bounded?

Both have used AI.

Both have benefited from the same reduction in implementation effort.

But only one has meaningfully interrogated the consequences of the implementation.

This isn’t a distinction between engineers who use AI and engineers who don’t.

It’s a distinction between outsourcing execution and outsourcing judgement.

And I think we need to become considerably better at distinguishing between the two.

The engineering due diligence

I’ve started thinking about generated software and unfamiliar abstractions in terms of a very simple set of questions.

Can I explain what this implementation is doing without simply restating the code?

Can I explain what assumptions it makes?

Can I identify the conditions under which it fails?

Can I explain how I would diagnose that failure?

Can I justify its existence relative to a simpler alternative?

For example, consider the introduction of a query-caching library.

I don’t necessarily need to understand every line of its internal implementation.

But if I’m responsible for an application that depends on it, I should have some understanding of query identity, invalidation, freshness, cancellation, memory retention and how mutations affect cached data.

I should know where its guarantees end and where my own engineering responsibilities begin.

That’s the difference.

The objective isn’t to know absolutely everything underneath every abstraction.

Nobody knows everything underneath every abstraction.

The objective is to maintain enough understanding to operate responsibly at the level of complexity we’ve chosen.

And when something goes wrong, we should be capable of descending a layer.

If the component behaves incorrectly, investigate its state.

If the state behaves incorrectly, investigate the underlying operations.

If the operations behave incorrectly, investigate the runtime or network.

The ability to move between levels of abstraction is a considerably more valuable engineering skill than being exceptionally proficient at remaining within one.

Don’t mistake the tool for the talent

Outside of software, I DJ quite a bit.

And something I’ve come to appreciate about modern DJ equipment is the sheer amount of technical complexity it abstracts away.

Beat grids, BPM detection, synchronisation, visual waveforms.

Technology can do a considerable amount of the work that previously required a different set of technical skills.

But none of that necessarily means you know what song ought to come next.

You can synchronise the tempo of two records and still produce an absolutely terrible transition.

You can have a technically flawless transition between two songs that had absolutely no business being played together.

The equipment can make execution easier. It can give you considerably more room to explore creative possibilities.

But it doesn’t automatically give you taste.

And I think software engineering is entering a very similar phase.

Writing code is becoming cheaper.

Knowing what code should exist, understanding the implications of its existence, and exercising judgement over the resulting experience are becoming increasingly important.

The interesting differentiator might no longer be whether you can produce an implementation.

It might be whether you understand it well enough to know when it shouldn’t exist.

Know what you’re choosing not to know

I don’t want to live in a world where every engineer has to implement their own database before they’re allowed to use one.

That sounds horribly inefficient.

I want us to continue building incredible abstractions. I want tools that make software easier to produce. I want to spend less time implementing repetitive logic and considerably more time thinking about the problems that genuinely interest me.

But I also want to remain intellectually capable of operating without the convenience of those tools when the situation demands it.

There’s a beautiful distinction between not knowing something because you’ve consciously decided that understanding it isn’t necessary right now, and not knowing something because you’ve never considered that there was anything to understand.

One is a deliberate allocation of intellectual effort.

The other is ignorance disguised as productivity.

So by all means, use the framework. Use the library. Use AI. Abstract as much of the incidental complexity of software engineering as you possibly can.

Just don’t accidentally abstract yourself out of the engineering.

Because an abstraction should extend the boundaries of your competence.

Not conceal their absence.

— Adenekan

Thoughts on this one?

Tell me what it made you think, or where you think I got it wrong.

Still working on the last 10%.0:00pm in london