AI and [Code]: A Love-Hate Relationship

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: 

  1. 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

  1. 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

  1. 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.
  2. 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

  1. 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!
  2. 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.

IN THIS ARTICLE:

SPREAD THE WORD:

Be the first one to learn about new Victory openings.

Subscribe to our newsletter and keep up with the new career opportunities in our evergreen engineering square. We promise to send only relevant information, no fluff included.

Interested in more?
Here are some of our moments.

Shopping Basket