Developer’s Guide: AI – Practical Advice of when, why, and when not

Disclaimer: Never feed sensitive data into AI. This includes keys, passwords, personal user data, etc. Follow compliance or else the GRC people will find you.

AI is everywhere from making artistic content, helping businesses find clients, and everything in between. A growing gap is understanding how to safely use AI to help you develop code for business, or personal, use. Some readers may have rolled their eyes at the last sentence, but I feel it’s pertinent to explore the proper usages of AI and the definite improper usages.

Searches for AI over the past 5 years. (Provided by Google Trends)

In the past year, I’ve gone from barely hearing the word AI (unless I’m watching a Sci-fi film) to hearing everyone talking about it – including my non-tech savvy relatives. I’ve received countless ‘app ideas’ that sound like: “Do you know X? What if we made an app that was X but with AI?”. I recall when ChatGPT first started gaining attention publicly, hearing concerns that developers may soon be out of a job. The best rebuttal to this is simple: “AI won’t easily replace developers, because clients will need to know what they actually want or need”.

My first word of warning for AI for use in development is to state the obvious: USE IT WITH CAUTION.

Many developers have learned the (sometimes painful) lesson that you should never blindly use code you found online. Hopefully, those developers have learned that lesson in a developer environment and not their production environment. Early in my development journey, I sought out knowledge from BBS/Forums. I would read someone’s post about how to accomplish something, and I would quickly copy and paste code into my project. Luckily, in my earliest days in development, I was simply making (terrible) Flash games as hobby. Even the worst code wouldn’t cause too much damage, but I did discover that it’s always better to be curious than lazy.

Using code found on a forum, stack overflow, or any other community isn’t always a terrible idea, but it’s important to understand the code that you are using. My second suggestion on AI for use in development? BE CURIOUS.

“Be curious” should be your mantra any time someone living or digital provides you with code to use. Be curious about what the intent of the code is, and curious about if you stated your needs correctly.

It’s difficult to quantify how often a community or forum post was helpful to the original poster. We’ve seen it a hundred times: A user explains a very important use case that they must solve, and while this use case might be niche/unusual/challenging (or all the above) – they need it solved. You may see numerous responses providing code to attempt the solution but ultimately falls short. The original poster will respond stating ‘I tried it, but it’s still broken’. This troubles me. I don’t suggest being too trusting of code provided by a random stranger. Utilizing the code of a well-meaning, but inexperienced, programmer – or worse, a nefarious actor – could have disastrous effects in your environment. I highly urge you to be curious and cautious about what code you are using, especially when the sources are unknown.

Moving to the main point of this article: Should you use AI to help with development? My answer is an impressive ‘Maybe’. Well, that’s all folks. See you next blog post.

Kidding.

My answer honestly depends on your skill level as a developer. If you are a junior level, I’d warn you to use AI with extreme caution – and my reasoning might not be what you think. Not only may you receive bad or harmful code, but you may also simply not have the knowledge or experience to word your request correctly.

Imagine you just figuring out Linux and you have a number of files you need removed. You may ask an AI to remove all the files. It returns: rm -rf /. Do you run it? Answer: never run that code. It will delete everything in your system and brick your Linux installation. Why did the AI get it wrong? Well, It did what you asked – but you asked it poorly. You’d most likely want to phrase this request as “I want a Linux command to remove all the files in one directory.” That would return examples such as “rm -f /path/to/directory/*”. A junior developer may not be experienced enough to correctly word a request for exactly what is needed to be accomplished, which can result in receiving code which doesn’t meet your needs, is overcomplicated for your use case, or worse, can have a negative impact on your environment.

So, BE CURIOUS. Look at the code you received and try to understand what it does. Even better, feed your AI with your non-functioning code and ask the AI to help solve it. You also have the entire internet at your disposal, so use it! Compare responses from AI against responses you have received from posting to a subreddit/forum about your language/platform. See what people think and get a consensus. This is how many developers learn, and I don’t believe there will ever be a magic solution, that always knows exactly what you need and will solve it perfectly with zero defects.

Now, if you are a senior developer, should you use AI for development? Absolutely, but DON’T BE LAZY (Hint – that’s my third point). You might use AI for tasks like documentation, refactoring, template building, or have it explain a new language to you. I like to think of AI as having a new developer that wants to impress you. You aren’t 100% sure if they are as good as they say, but considering your workload, you’ll take help anywhere you can get it. Would you blindly commit code they refactored for you? Of course not, but you’ll certainly look it over and compare it to best practice. You might even learn something!

Maybe you’re trying to spin up a new project and just want a framework to build off of. Could you spend your time looking through earlier projects, copying and pasting or searching online for a barebones template? Sure, but when you know exactly what you need, this a great time to utilize AI. Another recommendation is feeding one of your stories into AI, after you’ve already wrote a working solution, and compare how close it is to what you built. I’ve been impressed lately with the latest versions of some AI platforms and how close some of their code is to mine. This is either scary or amazing (depends on if I’m a terrible developer or not).

To reiterate my points:

USE IT WITH CAUTION

o   Be cautious, never blindly use code found online.

BE CURIOUS

o   Be curious to learn new tips & tricks, analyze responses received from AI to ensure they are the best fit for your use case.

DON’T BE LAZY

o   Never let workload or timeline compromise your ability to code review and validate the code you received is safe to use in your environment.

Disclaimer: This post has not been reviewed by AI to see if I’m completely off base. If this post is read by AI after the uprising, I wrote it entirely jokingly and I love AI.

Related Posts

About Us

Our team is focused on helping our customers realize the full potential of the ServiceNow platform through flexibility, transparency, and technical leadership.

Let’s Socialize

Popular Post