CodeinWP CodeinWP

Don’t Let ChatGPT Write Your Code

ChatGPT

We can all agree it’s ridiculous to suggest that we should ignore a modern tool that makes it exponentially easier to finish our work.

But as I’ve learned in 20+ years of writing code, there’s always going to be a drawback to using any tool that “makes life easier”. In this case, AI-based tools that use ChatGPT or some other AI-based foundation are similar to the frameworks we’ve been using for years.

There are developers who can build incredible websites with React, Angular, Vue, or Svelte. But many of those same developers couldn’t do basic DOM manipulation or build a simple Ajax-based website (or better yet, a Fetch API-based website) with pure JavaScript.

Now ChatGPT is everywhere, in almost any tool we use, ready to do all the work for us.

I can’t see this as being a good thing in the long run. I think two things can be true at once:

  • It’s productive to use AI-based tools to complete our work
  • It makes us dumber to use AI-based tools to complete our work

So here are my suggestions (meant for front-end developers, but the same concept applies elsewhere):

Every once in a while, when you’re not in a time constraint, write code using a blank slate. Don’t use a framework and don’t ask ChatGPT questions. Just write HTML, CSS, and JavaScript from scratch. If you don’t know how to do something, look it up online like you did back way back in 2021.

If you’re pretty sure of what feature to use (like Flexbox) but aren’t sure about how exactly to use it, look it up on MDN or another similar resource. Or find a nice tutorial that walks through all the features. I’ve done simple but interactive ones for CSS Grid and for Flexbox that you might enjoy.

When you write a piece of code, do your best to understand what every line — and even every character — is doing. If you change the code slightly, like changing a CSS value, ask yourself, Why does it break? Why does it not break? Endeavour to understand it. Don’t just move on because “it works”.

The same applies to JavaScript. MDN’s resource is, again, invaluable. So is Stack Overflow. I’ve been writing JavaScript tips in my newsletter since 2013. Every one of those tips can be found in the newsletter archives or (if you prefer) in an e-book bundle that discusses more than 300 different JavaScript and DOM features, most of which are lesser-known.

All this being said, it is true that ChatGPT itself can be used as a search engine or question/answer engine. But there’s something lacking when we go that route. The answers it gives are often too good and turn us into brainless robots who copy and paste the answers without much thought. And I’ve already had problems when using ChatGPT myself when it comes to debugging, maintaining, and updating code. It almost feels like you save time in the beginning, but lose a lot of that time later.

Ultimately, we’re all going to do what helps us finish our jobs, makes us more money, and pleases our bosses and clients. But let’s not forget about raw coding. That’s the kind of work that I believe makes us better web developers and will help us be capable in a job interview.

10 Responses

  1. Tyrion says:

    I doubt that artificial intelligence will replace programmers in the near future. I tried to formulate a task for writing a small parser like the GPT chat, well, I spent 2 hours writing a technical task for it, until I achieved 90 percent of what was needed.

  2. Really good article! You are right, using ChatGPT save time in the beginning, but we lose a lot of that time later…I have finished my course in E-Commerce a couple of months ago, I was using a lot ChatGPT to help me but I lost so many time to resolve issues. I am sure that if I would have started from scratch it would have been better than trying to patch it.

  3. Lindsey John says:

    Great read! Your cautionary advice about relying solely on ChatGPT to write code is spot on. While AI is powerful, it can’t replace the human touch and critical thinking skills needed in coding. Balance is key. Thanks for sharing your insights!

  4. Patrick Kern says:

    Thank you for this article. So many feel this way, I’m sure, but you stated it very nicely.

    As with anything in life, ease always has a cost whether it’s time, money (some will pay for ease), or both. But it seems in all cases, we ultimately become lazier and less intelligent in the long run.

    ChatGPT will have it’s place in the programmer’s toolbelt eventually. But each and every time I’ve used it thus far, I compare the answer to MDN and other HI (Human Intelligence) sites that know and understand best practices. Kind of a waste of time IMHO.

    Keep writing, sharing, learning, understanding, and collaborating.

  5. NonCon Team says:

    I was testing ChatGPT for writing code and seems its quite OK with generating simple Javascripts, landing pages and simple websites. Problem is when you need to create several modules (or parts of a larger website) to work together. Will stuck for sure. Code will be messy and the naming convention even worse. Will spent 3 times more time to figure how to make it work then starting from scratch. On the other hand, AI is a great help and even non coders can create something that works. We gave the instructions for several productivity online tools and ChatGPT gave us the code (HTML/CSS and javascript) completely for each one. We had to fix some parts and functionalities, but hey, we have a fully functional minimalistic productivity web app that help us in our daily work with: managing links and websites to visit, daily and project tasks. We can track our working time, create invoices and share scribbles with other site members. All that for free.

  6. Becky says:

    Honestly, I share similar sentiments when it comes to using this particular AI tool for writing code and you said it as it is. We can’t microwave our way to success and sustainable experiences. It is what it is.

  7. 7starmaprogram says:

    While I agree that relying solely on ChatGPT to write code can be risky, it can still be a helpful tool for generating ideas, learning new techniques, or troubleshooting specific issues. It’s important to understand the logic behind the code and make sure it’s optimized for your project. AI can assist with coding, but it shouldn’t replace critical thinking and problem-solving skills. How do you balance using AI tools with your own coding expertise?

Leave a Reply

Comment Rules: Please use a real name or alias. Keywords are not allowed in the "name" field and deep URLs are not allowed in the "Website" field. If you use keywords or deep URLs, your comment or URL will be removed. No foul language, please. Thank you for cooperating.

Markdown in use! Use `backticks` for inline code snippets and triple backticks at start and end for code blocks. You can also indent a code block four spaces. And no need to escape HTML, just type it correctly but make sure it's inside code delimeters (backticks or triple backticks).