Yeda AI Tips · #175

Español

Delete It. Did Things Get Simpler?

Delete the module. Did things get simpler?

We're trained to add abstraction, so we keep adding it — a wrapper here, a helper there, a service in front of a service. But not every module earns its keep. A module is supposed to hide complexity. If its interface is nearly as complicated as the code behind it, it hides nothing. It's just an extra hop you have to read through to understand what actually happens.

Deep vs shallow modules

John Ousterhout's A Philosophy of Software Design frames this precisely. The value of a module is its interface complexity subtracted from its functionality.

A shallow module is negative-value because the interface itself is a cost: every caller must learn it, and it doesn't buy them any hidden complexity in return.

# Shallow passthrough: the interface is as wide as the body.
def get_user_name(user_service, user_id):
    return user_service.get_user(user_id).name

# Callers already have user_service. This hides nothing;
# it just adds a name to memorize and a file to open.

Run the module test

The concrete check from the reel: delete the module and inline its code at every call site. Did the whole system get simpler?

If inlining makes things clearer — fewer files, fewer names, a shorter path from question to answer — the module was a shallow passthrough. Fold it in. If inlining makes things worse — the same non-trivial logic copy-pasted everywhere, a genuine abstraction lost — then the module was pulling its weight. Keep it.

After inlining...Verdict
System is simpler, less to readShallow passthrough — delete it
Logic duplicated, real abstraction lostDeep module — keep it
Roughly a washLean toward deleting; fewer parts win

Why passthroughs hurt

Shallow modules feel like architecture but act like friction. Each one splinters the design into more pieces, so understanding any single behavior means hopping through more layers. "Classitis" — the belief that more, smaller classes and modules are always better — produces exactly this: a system of thin wrappers where the interfaces cost more than the implementations hide. Prefer fewer, deeper modules that each hide something real.

Power moves

Resources

Shipping AI or cloud systems? Yeda AI audits and hardens production LLM and application codebases. Talk to us · Read the blog