Using AI to generate code is like a WYSIWYG editor

Way back in the late 1990s (showing my age here…) I learned how to build websites.

It was a choice between Dreamweaver - a WYSIWYG editor - or writing HTML by hand.

I took the “HTML by hand” route, using Windows Notepad as my editor for years.

Hiding the code

WYSIWYG - or “what you see is what you get” - gives you a way to write a web page without thinking about the underlying language. So, no need to write HTML.

However, you are at the limits of the editor. If you’ve ever had bold text that won’t turn off, a heading that affects all of a paragraph, or a preformatted code block that you can’t exit - these are all examples where you end up fighting with the editor. If you have a code editor, and you understand the code you’re editing - these editor issues quickly go away.

(I’ve seen all of these editor issues happening even today, in tools such as WordPress, or Notion.)

Taking shortcuts

Using a WYSIWYG editor is a shortcut that can get you started. But it’s helpful if you know how to edit the code directly, so you can change it as much as you like.

I find this is similar to using AI to generate code. A big difference is in the generation, which you wouldn’t see with a WYSIWYG editor.

You can ask ChatGPT to generate code for a new React project. But if you don’t know enough about React to be able to edit the code, you’ll be creating a project you won’t be able to change.

Also, the code may have bugs or security holes.

AI can help you make changes, but it’s not going to run the site for you.

Why use AI?

To learn something like React, there are loads of tutorials and courses you can follow.

With AI, you can ask what the code would look like for any project of your choice. It may not be the best code to use in production, but I always found it easier to learn something new if I could use a new skill on a real project.

I tried the following prompt in ChatGPT:

Can you write some React code for a music website? I want to give users a way to log in and post their track links.

ChatGPT prompt

And this gave me a series of steps, and code, to include in my project.

Pretty remarkable. But, I’ll still need to edit it.

A starting point

AI can give you a starting point for a coding language, framework, or project.

Instead of spending hours going through dozens of tutorials or a lengthy online course, generating code can be done quickly.

Courses still have their place - but AI may be a faster way to try something new, right now.