Skip to main content
SearchLoginLogin or Signup

How developers can apply AI to work smarter, not harder

A real-world walkthrough of using AI software assistants to save hours of manual work

Published onAug 14, 2024
How developers can apply AI to work smarter, not harder
·

In today's fast-paced technology landscape, leveraging artificial intelligence (AI) has become essential for enhancing productivity and creativity. Here, we highlight which of these tools coders can benefit from, how the different features will improve their workflow, and potential issues they should be aware of.

Copilot/Codeium: AI-Assisted Coding

Coding can be complex and requires attention to detail.  AI-powered coding assistants have become game-changers for software development. These tools, integrated directly with code editors, offer more than just code completions; they provide valuable suggestions and act like an expert coding partner right by your side. Examples of such tools include services like Codeium or GitHub Copilot, which help streamline the coding process and enhance productivity.

Unit Testing:

While AI tools aren’t perfect, they can auto-generate unit tests that serve as activation energy - saving hours of manual work.  By being specific about how you want your tests written, one can say, for example::  “Write a unit test using pytest and use pytest parametrize for this function”

def get_phi_cutoff(unit):

   switcher = {

       "day": math.floor(89*365),

       "month": math.floor(89*12),

       "year": 89

   }

   return(switcher.get(unit, "Invalid unit"))

Auto Documentation

Creating and starting documentation is often tedious. AI tools allow us to generate an initial draft of documentation, lowering the activation energy.  It is also essential to document each function that you write, which you can also do with these tools:

Code Explanations

Understanding complex code or legacy systems can be daunting. AI tools provide clear explanations for code snippets, making it easier to grasp the implementation of functions or algorithms.

Code Refactoring

AI tools can be used like a “grammar checker” for your code. Asking Codeium to refactor and clean up your code can help improve code cleanliness and readability. For example, here the tool identifies an opportunity to use list comprehension instead of a basic for loop to create a list of names, while also recommending that the constant defined at the top of the script follows an all-caps naming convention:

Auto-Completions

AI tools provide intelligent suggestions that accelerate code writing and result in fewer errors, significantly reducing the time spent on commonly written code blocks. 

A Case Study

Recently, I wanted to understand the distribution of Synapse command line client versions used within our data warehouse.  It turns out that none of the versions were being captured!  To determine how to capture the versions with SQL, I asked copilot:

Copilot sped up the process of solving the problem, giving me more time to investigate the versions being used. While it's subjective to say that "split_part" is "prettier" than "regex_substr," being as specific as possible helps the AI tool deliver higher quality and more accurate results. 

By using this approach, we were able to uncover a bug in our client code that was incorrectly sending data to our data warehouse, ultimately leading to improved data integrity. Furthermore, understanding the versions our users rely on is also crucial for planning when to deprecate older versions. Even though this example involved a relatively simple SQL statement, I was still able to write it faster with AI assistance.

What AI Can Miss

Incorporating AI into our engineering processes has certainly made our work more efficient, but it also comes with some important considerations. First and foremost, we have to be vigilant about data privacy and retention, ensuring that we follow strict governance and ethical guidelines to protect sensitive information. When using open-source AI tools, it’s crucial to be aware of licensing and IP issues, as overlooking these can lead to legal headaches.

We also need to keep an eye on potential biases in AI models, as they can skew results and unintentionally reinforce inequalities. And while AI is a powerful tool, we can’t forget the importance of human oversight; relying too much on algorithms without human input can lead to decisions that lack the nuance and context that only people can provide.  It is still important to double check the work of AI to ensure the highest data quality.

Our Final Thoughts

As technology continues to advance, integrating these tools into our work has led to improved efficiency and quality of work. These tools offer personalized assistance that adapts to our needs and learning style. As we move forward, the role of AI in professional and creative endeavors becomes even more pivotal. By embracing these tools, we can unlock new levels of innovation and excellence in our work.

Comments
0
comment
No comments here
Why not start the discussion?