Can AI Help Build Software?
Published: 2019-01-14 16:55:30

---
title: Can AI Help Build Software?
published: true
tags: 
canonical_url: https://blog.professorbeekums.com/ai-writing-code/
---

I’m pretty skeptical of [AI replacing humans](https://dev.to/pbeekums/the-wonder-of-human-intelligence-2mni) anytime soon, but there is no denying that AI is capable of things that humans aren’t. Computers are unmatched in their ability to run brute force calculations. Theoretically, a human could perform Google’s PageRank algorithm. Yet, it would take a human millions of times more time than a computer to do so and the monotony would result in human error.

![](https://blog.professorbeekums.com/img/2019/robot-help.jpg)

[Garry Kasparov mentioned](http://www.kasparov.com/deep-thinking-ai/) that chess engines are superior to humans in short term tactical positions and the only way to beat them is to avoid positions that are conducive to those types of tactics. Humans may be good at thinking about high level strategy, but it takes us a while to double check all the details to make sure our strategy will work the way we expect. We also get tired and overlook critical details. Computers don’t get tired and run those checks easily. It turns out that while “human vs AI” provides a lot of exciting drama, the best chess is actually played by a human partnered with AI because it leverages the strengths of both. The human decides on high level strategy. The AI double checks the calculations.

This is sort of demonstrated in automated testing. Humans are great at defining what should be tested. Software runs the tests in seconds when it would normally take a human hours or days. Yet, software is not as good at defining what should be tested. “Automated testing” is really a combination of human ingenuity and software. This analogy breaks down a little because automated tests don’t qualify as AI because they simply do exactly what a human programmer told them to do.

But is there a way for AI to help in software development? If so, what would it look like?

Writing software is a creative exercise, but often times we are reusing patterns that we have used before. As an example, I had a relatively simple problem recently where I was working out when to show contextual options for an email in [Maleega.](https://maleega.com) The way the frontend is structured made it difficult to get the data to the code that handled those contexts. This was simply solved by returning an extra value from the server in one of the API endpoints.

This wasn’t a hard problem. It did take longer than it needed to because I was a bit tired at the time. My thinking was too pigeon holed in focusing on solving the problem on the front end. This limitation meant that every solution I could think of was going to be a mess of code.

In this scenario, it would have been great to have a teammate to bounce ideas off of. That’s not always feasible though. Sometimes you’re working on a project solo. Sometimes you want to exhaust your options before interrupting someone else. Interruptions can break concentration. I usually don’t like asking for help unless I’m 100% stuck on finding a decent solution and it takes time to get to that point.

AI would be great here. I don’t think AI would be suitable in picking a solution, but it would be **perfect** for providing a number of solutions and potentially showing what the code would look like for each one. It would essentially act like a brainstorming tool. I, the programmer, need to do X. AI can run through multiple permutations and provide me with some possible implementation patterns. Maybe I use one of them. Maybe they inspire me to come up with something better. Either way, I should have better ideas for building software.

The main problem is the pesky detail of implementing this AI. As mentioned, software design is more of a creative problem than a mathematical one. That makes it harder to define the “bits” to use in calculating permutations. On a chess board it would just be “piece in this square, than piece in this other square”. I struggle to define one that would work for software design. Can’t use AI to brute force permutations of solutions when we can’t say what those permutations actually are.

Even if this problem was solved, we would then have the issue of how to rank these solutions. Using AI in this way would probably result in millions of possible results and negligible variations of those results. Only a handful of these will actually be useful. Maybe this will be easier to solve if the above problem was solved, but at the moment I don’t know how ranking would work either.

There’s also a more existential problem if we can get all this working. With any tool comes the temptation to use it as a crutch. If we don’t even attempt to come up with solutions ourselves, we never practice our creative muscles. Our ability to evaluate the AI’s solutions will deteriorate. More importantly, we may always just choose to use a provided solution instead of using it as inspiration for something possibly better… because we will no longer be capable of being inspired.

Regardless, I think the possible benefits make the effort worth investigating. If you’re interested in discussing this kind of work, [I’d love to chat!](mailto:contact@professorbeekums.com)