Despite my skepticism about AI, I see its coming value. What is commonly called “AI” I see mostly as stats on steroids. A few moments with ChatGPT has me shaking my head at the “intelligence” moniker. Nonetheless, AI will eventually save me time and frustration, letting me focus on problem solving instead.
Will I lose my job? No, but let me get back to that later.
In short, I see the current generation of tools being able to help in three, maybe four, areas:
- Research: Helps me find details quicker, and narrow down the results better
- Management: Track and classify all the work that needs to get done
- Refactor: Keep my code tidy and ready for future expansion
- Debug: Take care of the predictable defects in the code
By “current generation”, I’m referring to all the tools based on statistical machine learning and language, or domain, modelling. The ones that take troves of information, find patterns in it, and give me insights. These aren’t reasoning general artificial intelligence creatures, but we don’t need to achieve that level that to be useful.
I spend a lot of time looking for details. How do I draw a gizmo in the Unity simulator? What’s the type syntax for a Python class constructor? What’s the modern C++ way to deconstruct tuples? How do I get my systemd script to report logs to AWS? How can I calculate the tangent vector on an arbitrary point on a spline?
These questions follow a particular pattern. I’m asking for a specific piece of information that factually exists. Some of them may have multiple answers, but it’s a fixed set, with no creative thought to arrive at them.
My difficulty, today, in finding answers is multifold:
- The information isn’t readily available. Maybe it’s lost in forums, old mailing lists, or some examples in random pieces of code.
- I can’t formulate the correct search query, either due to generic terms or not knowing the name of what I’m looking for
- There are too many results. I waste a lot of time sorting through incorrect, outdated, or nonsense answers.
I see this as an area where a language-based tool would help. It would increase my productivity, as well as avoid a lot of the frustration I face while coding. While ChatGPT is showing promise here, it still makes way too many mistakes to rely on it. I see it could work though and I hope tool evolution will get it here.
I don’t want to waste time searching. This, I find, is the biggest value of language models across virtually all industries. May we finally have a tool that can do thorough research for us?
Programming is the job of juggling hundreds of requests, trying to balance the highest impact work and things that just need to get done. Between chatting, phone calls, issues systems, text files, and notes in the code, it’s hard to keep an overview of what people are waiting for, what’s been promised to a client, or what’s blocking other team members.
What I want, what I need, is a single tool that can track all the bits and pieces, including my paper notes — which could be handled by a simple camera, or I can write on e-paper.
The problem with current tools is that they specialize in one aspect of management, and do the other poorly, or not at all. It’s not feasible to switch systems whenever I need to take notes. I will use whatever tool I’m currently in, or close at hand. This results in all tasks recorded multiple times, with different titles, descriptions, and responsible parties.
I believe language analysis tools can excel here. Hopefully, one tool can look at all sources of information and build groupings of features, tasks, and promises to clients. If I tell it what my priorities are, for example, Client X wants a few features done, it should be able to give me a list of tasks related to that. This would save a lot of headaches and ensure I can properly balance user needs and maintainability.
As code grows, it accumulates technical debt. Most of this debt is minor, but if left unchecked, it can obscure the behaviour of the program and confound our ability to extend a program. For this reason, we refactor the code: take steps to make it cleaner, making it easier to understand and extend.
A large part of refactoring is fairly basic operations, such as moving files, renaming classes, adding type information, or deprecating code. Each of these requires going through the entire code base and tweaking all references to the things I’m changing. It’s time consuming, and often incomplete.
If I had a tool that was tuned to code, I would want it to do these things, in order:
- Locate references: For any variable or function, I want to know everything that references it. While purely statically typed languages manage okay here, any dynamic aspects, or even dynamic loading in static places, can make it challenging. Further to just locating them, I’d like to know the nature of the dependency. For example, I may need to change an argument to a function, and I need to know which call sites depend on the behaviour of that argument.
- Rename, remove: These are perhaps the most basic refactoring steps. I’d like to just point to any symbol and give it a new location, or name, and have everything still work. Those of you working in monolingual, statically typed projects may already have this with your tool. But I assure you, with multi-language, multi-component projects, we’re not there yet.
- Extract and inline: Sometimes I just want to take a piece of code out of one function and put it in a new one, or take a function an inline it. This is a rather error-prone process. Often there are too many inputs and outputs to keep it in my head. I’m hoping a tool won’t have my working memory space limitations.
- Merge and generalize: I want two features here. First, I want a tool that can find nearly similar pieces of code and point them out to me. Redundancy is a bane of large projects. Second, I’d love to highlight two pieces of code and tell it to make a shared function complete with the arguments required to tweak it for both call-sites
Even without the last step, reliable refactoring tools would improve code bases.
I should note that the source control tools need to be in on this game. Often it’s conflicting pull requests that make refactoring hard. Something like git has no semantic knowledge and frequently can’t resolve merges of refactors and other changes.
I have definite hopes of the first three requests. This feels like something that mostly requires a shallow understanding of the code: only the syntax and basic flow. A tool doesn’t need to understand what the code is doing to make many of these changes. I know I certainly don’t. I often even use generalization to understand the code: less code is easier to follow.
Obviously, I’d love for an AI to tell me why my code isn’t working as I want. I think we may need to contend with the halting problem though, so I don’t have high hopes for a general solution here. We’ll be debugging our stuff forevermore — more so if I blindly accept suggestions from inaccurate tools.
However, we don’t need to deal with theoretical limits all the time. A lot of my defects are because of dumb mistakes, or due to not understanding an API. This is like an advanced research ability: take this code, and see if you can find some common ways how this doesn’t behave as intended.
A tool could collect defects fixes from other projects, collating all the code changes that were made. This is what our statistics-on-steroids tools are good at. Again, it doesn’t need to understand the code, but merely point out problems. Wouldn’t it be great to be looking at a file and have a section highlighted with the warning: 137 projects were found with pull requests that changed a matching pattern of code here? A debugging detective assistant sounds great.
Any number of defects found by an AI would save me some frustration, simply help me narrow down possibilities, and point out irregularities would help. Too many false positives though, and it’d become a burden. But I’m hopeful, yet it can never be a panacea. Given that we struggle to debug code, even a GAI would be unlikely to find all the problems.
A more productive tomorrow
I look forward to having these tools. I don’t think we have them yet, but I see promise. I will not waste my time with half-baked solutions, but as soon as something truly saves me time, I will start using it. I don’t know if they are months or years away.
I’m not worried that somehow I’ll be replaced as a programmer. If everything I described in this article became available, it would revolutionize the industry. Productivity levels will skyrocket for some, but perhaps not for all. These tools would let me focus on problem solving, orchestrating the development of software, rather than spending time on the nuisances. It would be a boon for the users, who I cherish, as we’d be much better equipped to track and solve their issues.
But will it take some jobs? Yeah, probably. But take a quick look at your task list. Looking at mine, I only have time to address a fraction of the issues I put on our tracker. And only a fraction of things that are issues even make it into the tracker. And only a fraction of the things that users need end up crossing my eyes. Product and account managers focus on their high value things, knowing we can only do a few of them. Cut my workload down by 90% and I’ll still be swamped.
Now, when GAI comes along with actual reasoning power, we’ll likely have my replacement. But that could replace everybody, so it’s a different story.