Using AI to Make Basic Programming Faster

Yeah, of course. AI is everywhere, so why wouldn’t I check it out, too?

As of this writing, I have been writing code for the web for roughly 25 years. I know how to do it.

But I also don’t do the same thing over and over, and often switch back and forth between languages (luckily mostly only between JavaScript and PHP, very occasionally Python).

But during these switches, I regularly make stupid mistakes where I use code that works fine in one language inside another language where it doesn’t, like trying to create an Object in PHP like this:

$myVar = {
   "key" : $value
}

And don’t even get me started with things like for loops…

So when I need to do some of these simple things in one language or the other, I typically just Google something like “js for loop” so that I get the correct syntax in the first go-round rather than waste time (probably) getting it wrong a few times and having to look it up later anyhow…

Well, I recently had to jump back into PHP for something that I knew I could code, but also knew I would bang my head against a bunch of errors while trying to re-familiarize myself with PHP.

Specifically, I had to make an API request using an authentication header, then loop through the response and create an associative array out of two specific key/value pairs.

I have done stuff like this a bunch of times, but not enough that I could just sit down and crank it out, correctly, without a bunch of simple, annoying/frustrating errors.

So, with all this AI stuff flying around, and after reading this article from Eric Elliott, I thought, “Hmm, wonder how quickly I could get the code I need that way?”

Turns out, pretty f-ing quickly… (And to be honest, it is better than I would have written, including error handling that I usually only add when something breaks…)

The auth header is not correct for security reasons, but I was able to type that simple pseudo code into a text box and get that PHP in mere seconds, then copy & paste it into my PHP file, apply the correct auth header and fetch my data. No fuss, no muss, no swearing out loud at my own inadequacies.

I do not see a time soon where AI will be able to handle extremely complex, complete code, but maybe I am naive, having barely dabbled…

But I can absolutely say that I will be using AI like this for creating simple function blocks (or writing Regex for the love of all that is holy!) to save myself hours of time and frustration…

For me, it comes back to “letting the computers do what they do best: compute”…

Does this make me a worse developer? I don’t think so, at least not yet.

I still have to know what I need to do to get what my project needs, and I still need to know how I to put varying pieces of knowledge together to “construct” the project.

But I would be a fool not to take advantage of new tools that can help me do that.

To me, this is akin to switching from Notepad to an IDE or adding code completion plugins to that IDE… Let the tools help you!

If you have not yet done so, I highly recommend that you at least give it a try, because I think we all could benefit from this, and there is no doubt this will become our future.

Happy coding (AI),
Atg

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.