Disclaimer: The following account is a bemused experiment that explores the coding capabilities of AIs and the way these can help and/or endanger the existence of Homo Engineerus. The information is by no means accurate, complete or even based on real research, but the language it is presented in might make it seem as if it was, to the point where it can sound condescending. P.S.: No AIs were hurt during the making of this article.
Part one: Zeitgeist.
Despite all the recent layoffs at FAANG & CO, the software industry is still a massive gold rush. That’s mainly because software jobs pay well. And, some might say, it’s even easy to land a job as a developer.
Many of these jobs are for coders. So.. what is a coder? The simplest definition is “a living organism (person) who can type in a language machines understand”. In essence, we’re translators. We take ideas from people and explain them to robots that do our bidding.
There are two threats to a coder’s way of life.
Threat 1. The growing popularity of the IT industry. From a speech given by Uncle Bob I learned that for a few decades between the 60s and the 90s the number of developers doubled every 4 years, which is not as rapid as the growth of mice populations, but it still sounds like a lot. More people equals more competition equals decreasing labor opportunities & conditions.
Threat 2. Technological advancements. Back in my day, displaying even the simplest thing on screen involved intense coding and a lot of math (plus some black magic for good measure) distilled into 80-character rows. Today, it’s not out of the ordinary to ask a junior developer to create self-scaling web apps using K8s, fitted with rate limiting, SSO, web RTC, microservices of all kinds, and a beautiful UI. The crazy part is that a junior can deliver all this, despite a complete lack of understanding of the aforementioned technologies.
These two threats have been made worse by an idea that dawned on business people who started thinking “Our machines work non-stop and we don’t really pay them much. They automate simple tasks! If a junior developer can do it, surely we can build a machine that can do that as well!” (insert evil laugh here). Crazy thing is, there are some really smart people working for the business people who started actually building this machine. Fast forward a couple of years and the no-code revolution was born. Thanks to it, people with no code skills can create apps using fascinating UIs. At the same time, advancements in large language models make people believe AI will replace us all, which it should, because we’ve caused enough havoc on this planet.
Recently, social media has been exploding with AI-related content. As I write this, it keeps getting flooded with examples of how chatGPT writes apps given just simple hints, and about how, not too long ago, Github’s copilot did exactly the same.
With all of this in mind, let’s go back to that definition: “a living organism (person) who can type in a language machines understand”.
The human half of the equation is still too complex for machines to comprehend. Machines like precision, and each instruction in a file has exactly the same meaning every time. However, enter hoomans, and things get complicated with nuances and multiple interpretations. Take the word “great”, for example. Great means “great”, but pronounced in a lower tone and prolonged (more like “grreat…”) could actually mean “not great”. When used enthusiastically, “Great!” could mean something more positive than the regular “great”. However, if you find yourself in a situation that sucks, “Great!” can be uttered sarcastically, meaning “awful”. Confused enough yet? Try explaining this in javascript.
Part Two: Tools of the Trade
I mentioned how a novice developer can actually build amazing apps. This is possible because of the fantastic tools that exist. Anyone that has seen a computer in the 90s can tell you that today’s integrated development environments (IDEs) are pure science fiction by comparison, and Software as a Service (SaaS) providers are offering incrementally better products every day.
When it comes to machine learning (ML), let me first say that it still feels like voodoo to me. I am very much an ML noob and no matter how well this subject is explained to me, there are practical aspects that I simply don’t understand and maybe never will. It’s similar to driving my car. I can drive it just fine, but it has a myriad of parts that I don’t understand and I currently have no interest in doing so. .
I believe ML can be seen just as any other tool, with inputs, outputs, predictable behavior, varying degrees of quality, and whatnot.
To test this idea, I went on a coding journey to replicate a simple app with the help of AI. I’m mainly a front-end developer and that’s where I feel at home, so I chose as my candidate a simple single page application (SPA) that I had recently tinkered with. I opened my browser and navigated to https://chat.openai.com/ where sidekick no. 1 resides. I also went and subscribed to GitHub’s Copilot and installed it in my IDE.
And from here on things started to get interesting.
Part Three: Mad Science
I approached this project with essentially zero expectations. I’ve been around long enough to know that hype trains are not to be trusted. However, my immediate reaction was to jump on the train and drive it!
I was blown away by ChatGPT’s ability to understand natural language. I just typed like he was my homie, bros for life, and it managed to discern my expectations. But even more amazing was Copilot’s ability to read my mind. I would just move my cursor somewhere and it somehow magically knew exactly what I was about to type, using the exact variable names that I was thinking of. Mind blowing.
After pair programming with my two new buddies, Chat GPT and Copilot, for a grand total of two weeks, I declared myself an expert and I’ll now explain everything to you.
Here is a list of how Chat GPT and Copilot can transform the way we code:
- Give mister Copilot a hint.
Copilot is really good at randomly guessing things, which can be useful at times, but very annoying at others . Nonetheless, usually it just needs a slight nudge to work its magic. For e.g.: start declaring a variable and, if named appropriately, even partially, Copilot should be able to guess the rest of the implementation.
2. GPT can refactor.
I hate pointless nesting, especially “if/else” statements. They are incredibly easy to write, but are guaranteed to become a headache because they tend to heavily rely on business logic. Anyway, I asked GPT to refactor my code and remove some of the nesting, and the result actually exceeded my expectations. No brackets.
3. Copilot can refactor too.
Sometimes less is more, but sometimes more is easier to read and understand. In the below scenario, Copilot was able to infer one solution from the other. Fun fact: it can swing both ways as long as you give it a nudge and type a few characters yourself, you lazy coder!
4. Copilot can help with writer’s block.
In the example below, the sentence “Scenario name is required, yo!” was written by me (surprise, surprise). However, all the short input errors are suggested by Copilot, and I was very pleased to see that it can use words like “bro” and “dude”, which I’m sure will come in handy throughout my codebase.
5. A cuppa tea with GPT.
The first reply from GPT doesn’t have to be the final version. You can get an even better solution by guiding it. For example, tell it to eliminate repetitions or merge two functions and it can incrementally improve the code, eventually reaching the desired output. Be patient with GPT and sip your tea. The perfect code will come.
6. GPT as Google 2.0
I think one of the best uses of GPT is to ask it existential-engineering stuff.
For example:
“What are the most popular frameworks for X?”
“How to manage the server side state when dealing with same-server orchestrated instances and trying to write a multi-user chat application like Discord?”
Difficult questions will not have straight up answers, but you’ll always obtain a few different suggestions to get your gears turning.
Downsides of GPT
- Talks like an eight-year-old, grade-A student. You know, it gives those types of weird and righteous answers that restate the question.
2. It is incredibly verbose. I even asked it to provide short answers. Let’s just say we have a different definition of “short”.
Downsides of Copilot
- No understanding of project context. Plus, it doesn’t seem to know the file’s name… Bummer. Just when I was hoping it could search for a function and import it. It only suggests changes to the code next to my cursor. When I type a variable usage before declaration, I expect Copilot to insert the declaration wherever it deems fit, even if that’s 20 lines above. It doesn’t.
- Sometimes it suggests distracting things (a decoy?). It insists on “overengineering candy” and I, having an engineering sweet tooth, end up doing more than originally intended. It can be a bit “in your face”.
Common issues of GPT and Copilot
- You can get flawed information. Essentially, GPT and Copilot are only as smart as the average person contributing to a public repository. Sadly, the best quality code is paid for, and therefore inaccessible to machine learning algorithms. In the meantime, all the noobs looking for a job will eagerly post their tutorial-step-by-step-built app to every possible platform. The bad news is that we can’t teach AIs what good code is, because this too is subject to interpretation. OMG, hoomans are strange!
- If the AI writes code for you, in time, you might lose some of your own ability to write code. Is this really something bad? This might be a philosophical question. It reminds me of old people saying “When I was your age…”– nobody cares, and I really hope I’m not going to become that type of person.
Part Four: Will it blend?
The bottom line is that ML tools are amazing. If they are anything like the image generators or game playing ML models out there, they will get a lot better, and I see them being used in fantastic ways.
For me, as an early adopter and developer, it has been incredible to see how easy they are to use, and I’m honestly surprised by the level of assistance. I can literally write code much, much faster than before. I only type in my intent and the rest is black magic. It’s also nice to brainstorm with GPT.
These tools don’t disrupt regular work flow (they’re noninvasive) and are incredibly intuitive. I’m not going back to the old ways. I’ll be keeping my Copilot subscription and might even pay for chat GPT too.
In conclusion, I spend more time thinking and reading and less time typing, which is basically what technical progress has been doing to all forms of labor since the 1800s. This change in the way we work might lead to some job losses, as we have seen happen with many jobs throughout history. I can imagine carriage drivers hated cars when they first appeared, but then there were plenty of jobs as chauffeurs, mechanics etc. I guess I’m trying to say that I fear AI, but also embrace it, and hopefully, I myself will not become obsolete.