Hacker News new | ask | show | jobs
by x3haloed 23 hours ago
So interestingly, I have almost the opposite philosophy. It would be interesting to compare notes.

My philosophy is that agentic engineering works best when the code is compact and straightforward, and there is no documentation to confuse the source of truth. The code is the documentation.

What is the purpose of documentation to begin with? It's a shortcut to compress the structure of a system into a quickly scannable map. Or for closed-source software, it's a stand-in for actually being to see inside the black box yourself.

But why would you write documentation about a system that already sufficiently describes itself in an understandable format? What the program is and what it does is already abundantly clear to the model, because it can absorb all of it at once (or all of the relevant pieces at once).

I understand what you're saying about using documentation as requirements and a system design guide. And that definitely stands out as useful. If you can anticipate the architectural tensions ahead of time and encode your decisions about them in the documentation, then you don't have to encounter them and unpack them in the middle of surgery.

But after thinking this over, there is one thing I see missing from my method. The code itself already describes exactly what happens, but it doesn't provide any information at all about which choices in the algorithms in the architecture are just straightforward implementations and which are consequential to the system for outcomes, customers, industry-specific requirements, etc.

You and I typically hold those things in our heads and remind each other of them as we collect years of experience on a codebase. But every time I asked an LLM "but why would it be implemented that way?" I get almost a readback of the code itself. Something like "Because Var X depends on it." Yeah. Well. Why does Var X depend on that? Where is this all going? What does it touch in the DB and the UI?

2 comments

I think the challenge of the code is the documentation is with current context windows the agent cannot keep the entire codebase in mind at once.
That's true, and sometimes it's unavoidable, but I'm arguing that the first move should be to compact the codebase and rely on documentation only where the codebase is too sprawling to fit in context.

And I don't mean that you should try to fit the entire codebase into one context window. Anything bigger than a little to-do app is going to grow past that really quickly.

I mean that we should get rid of the abstractions and cruft that we used to rely on to make the codebase understandable to humans so that more and more of the causal structure does fit directly into one context window. Get rid of anything that's there to make everything fit into neat elegant abstractions. Keep everything that creates a single source of truth.

But IMO repository patterns, data transfer objects, and boundaries that exist for conceptual reasons alone should all disappear.

If I have a front-end UI framework that has nested components on a page that call an AJAX/fetch class with models that call the server, which has an endpoint with a matching data transfer object that maps onto a business-layer model that is manipulated through a repository class that calls an ORM that modifies a data model in a database somewhere, that is a useful separation of concerns that helps a human programmer reason about how the program works through learned architectural consistency. But it's also potentially 10 to 20 files to go from button click to UI change.

I would argue that shifting to a server-rendered application with a thin database abstraction is better, because it's two or three files to understand exactly what the button click does. It's more possible to hold that entire structure in context, and therefore also more of those structures. You don't need to feed it a bunch of documentation about how things are organized, why they're organized that way, what the system does, and how you designed it to behave. It's all evident in the two files of code.

So I'm not saying it's always possible to hold everything in context and documentation is useless. I'm saying the stronger move is to compress the actual architecture first, and then only document what's still sprawling and complicated.

I agree with your point and suspect you're right in terms of where things will go. One challenge I've found is most of the LLMs want to be extremely verbose which blows up context with comments and unnecessary detailed description so when you have an LLM write lots of the code I've struggled to keep it concise. I've found the good context the LLM needs is why an element exists and what it is intended to do and not a detailed description of the mechanics, because as you pointed out the LLM can just inspect the function to understand the mechanics perfectly.
I’m curious: do you not use _any_ documentation at all? or do you just keep it minimal?