Engineering leader in Washington State
With the ever increasing use of AI to generate code, the question of codebase understandability has come front and center in the software development community - from teams and managers to online communities and more. I see this in a historical perspective as the latest in a long history of paradigm shifts, of which I’ve lived through many. I’ve come to the conclusion that AI-generated code doesn’t remove the need to understand code. It moves where that understanding is needed.
In college I took the usual courses in Computer Science required at the time, including ones that covered instruction sets, machine programming, assembly language, compiler construction, and programming languages (procedural, object-oriented, logical, functional). There was definitely some value in learning to code “the hard way” to understand what is actually going on under the covers - to a point. The higher-level languages added richer expressivity to abstract away the repeating lower-level coding patterns. Sometimes this was at the cost of performance, and sometimes certain things became a lot more difficult than they should be (e.g. printing output in the functional language Miranda). It strikes me that generative AI offers a similar improvement in richness of expressivity. Instead of worrying about declaring variables, structuring code, getting syntax right, garbage collection, variable naming conflicts and so on, the focus is on writing instructions in plain natural language and letting the LLM do the translation, much like compilers do for high-level languages translating to machine language or byte code. Code is precise: it expresses flow control, state, and computation, its rules are enforced, and a compiler or runtime translates it mechanically. Now we don’t write in code, we describe what code should do and the LLM translates that to code.
In the former world, we rarely needed to understand the machine language (or byte code) generated by a compiler (JVM). Mainly this understanding was only required if you were doing things like writing a compiler. The question now is how much of the code do we need to understand versus the natural language instruction? I would argue with existing tooling it’s a mixed bag. If you generate code that has a bug, or is missing a user story, how do you figure that out? Generative AI works from what you tell it, and the more specific the instructions, the better the outcome will be. It can quickly be used to iterate from a relatively loose specification to a more specific one that approaches what you actually want. But this requires understanding the output at each exploratory iteration. There is one fundamental difference. A compiler is deterministic and rigorously specified, so the same source always yields the same output. An LLM isn’t rigorously specified and won’t reliably give you the same output twice, which means its output has to be reviewed.
That need to review the output brings me to the common complaint of “AI slop”. I’m reminded of the days when object-relational mapping frameworks were born. Prior to them, a well-rounded backend developer needed to understand a lot about SQL and fundamentals of relational databases. I recall fondly learning about all the various techniques for ensuring data integrity and performance - referential integrity constraints, check constraints, triggers, transactional isolation, DDL, third normal form, and so on. It was useful to have to learn how all this worked “the hard way” - just like it was to code in assembly language and write a machine language generator for a compiler. Once object-relational tools came on the scene, it was a welcome relief! Now instead of writing brittle SQL that would break across schema changes, we could tackle the object-relational impedance mismatch problem with a more natural and expressive syntactic sugar (first XML, then annotations). SQL now moved to the framework.
I noticed that I had a distinct advantage using the new technology because I had done it the hard way, and knew how the underlying systems actually worked. By contrast, those who jumped straight to, say, Hibernate struggled. I often heard “Hibernate sucks” - usually with complaints about how it didn’t do what the developer thought, but this usually came from not understanding what was happening under the covers. It seems we have a similar potential here with generative AI. If you don’t keep on top of what the tool is doing, you will get frustrated. Moreover, your product’s quality and operational posture will likely suffer. If you rely on trial and error until something seems okay, without understanding why, it isn’t good enough.
I’m similarly reminded of struggles folks had with Ruby on Rails (or Groovy on Grails). These frameworks were designed to leverage convention over configuration and mapping database entities to working prototypes quickly. Starting from code, generating tables, then generating web pages to perform CRUD operations was the norm, and done too quickly just led to problems. Teams would ship generated scaffolding as production code. I recall a project I worked on where the team relied on Groovy on Grails to generate about 100 tables and 100 interfaces to edit them. Users had a horrible time creating records in a certain order (child first, then parent), linking them, etc, all because the team implemented a naive quick and dirty prototype. Use cases (user stories) were done backwards - from the interfaces, rather than the correct way - from user-centric meaningful workflows. The result was angry users and pretty terrible code to maintain. The key missing point was that these frameworks were never intended to be run blindly to create prototypes that immediately became production code. The prototypes needed to be iterated over and refined into user-friendly interfaces that map to user stories - increments of functionality that provide value to a user. The tool in the hands of someone using it carelessly produced slop.
There is a trap in new, powerful, expressive tools. The more powerful and expressive the tool, the more damage can be done by using it carelessly. A powerful tool needs to be used by a craftsperson who wields it masterfully. This requires understanding of what the tool does for you (so you don’t have to), as well as what it is doing, and where you need to make sure it’s doing what you expect. This applies to generative AI.
Leaders should encourage their teams to be craftspeople who understand the tools they are using and the output those tools produce, and uphold best practices. For AI-generated code, that can mean:
Stephen Bobick is an engineering leader with over 15 years of management experience and over 15 years of hands-on software development. Connect with him on LinkedIn | More writing