AI tools have advanced significantly and can now serve as more than just shiny new toys for tech enthusiasts. In fact, they have found their place in production environments, especially for coding. Many AI tools, like Github Copilot, New Bing, and ChatGPT, can aid in production-level coding. To illustrate this, I will be using ChatGPT as an example throughout this post.

 

As a software developer with a decade of experience, I've found that AI can simplify daily coding tasks. The conventional coding process often involves determining what needs to be built, drafting necessary logic designs, coding, refining, and ensuring the code is clean and readable. This process can become even more complicated when you have to understand code written by others. Fortunately, AI can assist in each of these stages, but it shines brightest in the following scenarios:

 

1) Code reading: If you've ever been confronted with a chunk of 'unreadable' code, AI can be a game-changer. By letting AI explain the code or even refactor it for readability, you can save a significant amount of time. The key here is to provide precise and correct input and output to the AI. In fact, AI can even generate unit tests for your code, leaving you to simply verify the input and output.

 

2) Doing the dirty work: Tasks like adding comments or doc strings, which improve code readability but can be tedious, can now be handed over to AI. This leads to improved efficiency and higher quality output.

 

3) Finding bugs and performance issues: Simply paste your code into ChatGPT and ask it to find bugs or identify performance bottlenecks. It's like having your own personal coding assistant. Do note that you need to verify the correctness of AI's findings, as we'll discuss later.

 

4) Code review: ChatGPT can also play the role of a code reviewer. Paste your code into ChatGPT and watch the magic happen!

 

5) Programming language translation: If you're not familiar with a specific programming language, simply copy the code into ChatGPT and ask it to convert the code into the language you're comfortable with. This can drastically reduce the learning curve associated with a new language.

 

6) Output translation: Interpreting outputs from some programs, especially legacy programs, can be challenging. AI can convert these outputs into human-readable formats, or even explain the output in natural language. For example, when I needed to check my program's thread-CPU allocation mapping for a Linux server, ChatGPT helped me with the commands, and even wrote a Python program to automate the process for future use. This led to a significantly more efficient experience.

 

7) Quick search, quick help: As you get familiar with using ChatGPT for coding, you may find yourself using resources like StackOverflow less frequently.

 

What about large-scale tasks like coding an entire project? The strategy remains simple: divide and conquer. Create a framework and let AI write the chunks of code within that framework. This is a broad topic that I may cover in a future post.

 

One important caveat is the issue of AI's potential for creating 'made-up' facts, such as inventing non-existent shell commands. To avoid this pitfall, always have some baseline knowledge of what you're doing and cross-check AI's outputs if they seem untrustworthy. Platforms like Google Search and StackOverflow can help here.

 

Please note, this post does not delve into the legal aspects of copying your code into AI. Before proceeding, ensure that you're allowed to do so, as some corporations may have restrictions against copying code into AI.

 

In conclusion, AI is not just a novel gadget. It's a powerful tool that can significantly enhance your coding efficiency and productivity.

Use Some AI for Coding: Accelerate Your Software Development with AI Tools