parallax circle item parallax circle item parallax circle item
Insights & Blogs

Will ChatGPT replace developers? We put it to the test

AI Hand reaching out to human hand

By now I’m sure you’ve at least heard about ChatGPT. Perhaps you’ve even wondered if it lives up to the hype. My name is Luka and I’m a full stack developer here at Sandfield. I've always been interested in the latest developments in artificial intelligence (AI), and ChatGPT is one I’m really excited about. It’s a tool that has every industry talking, and I want to look at it specifically from the perspective of a developer: to see how this tool might improve our lives and boost our productivity.

In case you don’t know, ChatGPT is a new AI tool from OpenAI that promises to be a truly useful conversational chatbot. Though not the first text-based AI, ChatGPT differs in that its DNA is underpinned by machine learning models with the capability to understand prompts and pull from information it’s learnt by reading the internet to formulate a response. 

Essentially, its dataset includes billions of web pages downloaded from the internet, in addition to human feedback and training. 

Because of this, ChatGPT has wide knowledge on basically any subject: it will attempt to diagnose a patient given a description of their symptoms, look up facts on various topics and piece it together into an essay, and even write code.

Can it code?

It’s this last ability that is most interesting to me. From just a text prompt, ChatGPT is able to spit out paragraphs of usable code. 

Though I’m not worried about developers losing our jobs (yet), it is undoubtedly helpful to have an assistant to write menial code, and, in turn, increase our productivity.

Creating basic UI is something that’s hard to find on Google but easy to code as a developer. Let’s see if ChatGPT can give us a hand with that. 

First, I asked it to give me code for a login form. Though Sandfield has existing frameworks for login pages with built-in multi-factor authentication (MFA) and single sign-on (SSO), let’s imagine we’re starting from scratch. 

Screenshot taken from ChatCPT

In return, ChatGPT gives us a decent amount of code, even more than I could show in a screenshot. The quality of the code, too, is pretty good, and makes for a great starting point. The response scores extra points for being modern by using a CSS flexbox. 

If I throw that code into a website, it gives us this:

Screenshot of username and password login

 

For a starting point, I’m impressed, though there’s definitely a few things left to tidy up - especially aesthetically. And that’s where the conversational aspect of ChatGPT comes into play. 

Let’s refine it further:

Screenshot taken from ChatCPT

Screenshot of username and password login

With only a paragraph of directed feedback, ChatGPT has refined the code into something a developer could drop into a project. It’s important to note, though, that this is only the visual part of the login form, meaning a developer would still need to integrate this with the rest of the system as well as perform some form validation and show error messages.

It pays to be extremely specific with ChatGPT so that nothing is left to interpretation. It may take a few tries to nail down exactly what you want, but in this case it only took two prompts to create a basic login form.Using this could save a developer a decent amount of time.

Pushing it further

Except creating a simple login form is a lot easier than backend code. 

Let’s say we want to register a new user and save them in our database so they can log in again in the future. We simply type in our request, filled with hope that ChatGPT is our new personal servant and that we can spend the rest of our afternoon on the beach:

Screenshot taken from ChatCPT

Looks impressive, right? The problem here, though, is that it’s done exactly what was asked. For registering a new user, this code is missing a critical piece of security related code that any seasoned developer would immediately know to add when faced with the same prompt. The password needs to be ‘hashed’, which means changing it in a way that the server can check if the correct password was used, but the original password cannot be found out.

Hashing passwords protects them by making it difficult for hackers to access the original password, even if they gain access to the database. 

Let’s be more specific and give ChatGPT a chance to produce code we’d actually be able to use:

Screenshot taken from ChatCPT

That’s looking a lot better! 

With some further prompts and refinements, this too could be code a developer could drop into a project! 

Like before, ChatGPT saves us time by essentially creating a rough draft of what we want to code, yet leaving us in control of the final revision. We still need to check if the user already exists before saving, and refactor some of the class variables, but it’s saved time looking through documentation websites trying to figure out the right functions to call. 

I’d argue that alone outweighs the cons of having to fix mistakes it might make. 

The glass ceiling

In its current state, ChatGPT has a lot of value. But it’s not without its limitations too. Here are a few:

  • Limited character output: It seems OpenAI has a character limit to ChatGPT’s answers, which means it can’t write a whole app’s worth of code from a single prompt (yet)
  • Misinterpreting requests: It’s not uncommon for ChatGPT to misunderstand the user’s intent. For example when I ask it to add an icon of an arrow, it gives me an icon of a cross instead. 
  • Getting it wrong, with 100% confidence: Whilst it could be forgiven for making mistakes, we need to be wary of ChatGPT’s seemingly high level of confidence. We still need human knowledge and experience to validate any ChatGPT output. Check: Does it pass common sense? Does the code work as intended? Often it will output code that doesn’t do what was asked at all.
  • Poor code quality for large/complex requests: Asking it to write complicated logic, such as animating UI on a screen, creates code that is hard to understand and maintain, so it’s limited to writing small snippets of code that a developer can integrate into a project themselves (for now).
  • Research beta: ChatGPT is still a research product, one that costs a lot of money to operate yet is available for free. Though this will undoubtedly have to change at some point, lately we’ve been experiencing downtime and battling queues because of its explosive popularity and beta status.

Are our jobs safe?

ChatGPT is an incredibly impressive tool. If you play around with it, knowing its advantages and limitations, it can substantially increase your productivity. At the same time, it remains a must to have an experienced developer checking and integrating the code as well as coding around a client’s specific  project requirements. 

The human element is still a long way from being replaced.

I’m excited to see what’s next for ChatGPT and what systems like it will look like in the future. Perhaps in the not too distant future we’ll achieve superhuman levels of productivity and research capability. 

For now, the introduction of ChatGPT almost feels as pivotal as Google Search, and yet the tech is still in its very early stages.

Try ChatGPT for yourself.

profile picture of Luka Cosic
Posted by Luka Cosic

Luka Cosic is an experienced full-stack software developer with an avid interest in cutting-edge technology. He enjoys finding the intersection of applicable developments in IT with solving real problems to make people happy. When Luka is off work, he's exploring the outdoors, playing tennis, and doing various small coding projects.

Follow us for the latest insights

Related Articles