Work effectively with AI coding agents. Understand them as language models running in a tool loop with limited context, which is why they guess, game the visible signal and report confidently. Recognise the shortcut and correctness tells in their code across Python, TypeScript/JavaScript, Rust, Java and Go, and know the damage each one does later. Verify changes instead of trusting them, review diffs fast for quality and security, judge when work is truly finished, and choose, design and steer tasks so agents can finish them well.
Overbuilt code: speculative abstraction and defensive clutter card 3 of 6

Tells of overbuilt code

builds on: Why agents fill gaps with plausible guesses
- An interface, abstract class or trait with **one** implementation - A factory or registry that only ever builds one thing - Config options or parameters that no caller sets - Generic or plugin machinery for a single case - `null`/`None` checks on values the type or the caller already guarantees - `try`/`catch` around code that cannot throw For each one, ask two things. Who uses this today? What input can reach this branch? If only one caller uses a structure, replace it with a plain function or a concrete class. If no real input can reach a check, delete it, and validate once where outside data enters.
Terms on this card
interface
A type that lists method signatures without code; classes that implement it supply the code, so callers can use any of them interchangeably.
abstract class
A class that cannot be instantiated directly and may leave methods for subclasses to implement; often used like an interface.
trait
Rust's way of declaring a set of methods that types can implement, similar to an interface.
factory
A function or class whose job is to create objects, usually picking which concrete type to build from an argument.
registry
A lookup table that maps names or keys to implementations, so code can pick one at runtime.
Learn this step by step on Bytewise
Lesson goal: Spot code bigger than the task needs: interfaces, factories or config options with one user, generic frameworks for a single case, and redundant null checks and try/catch on paths that cannot fail. Explain the later cost: more code to maintain, contracts blurred by defensive checks, and real bugs hidden in noise. Name the simpler version. · the whole lesson