Using code without knowing how: leveraging Generative AI to build basic, usable code for daily use

18

September

2023

No ratings yet.

Last summer I did an internship at a bank in Germany during my gap-year. I was tasked with building a monitoring tool that would save information about the market and the competitors of the bank. Since I had limited resources, I decided to build a database in Excel and create a couple of dashboards with PivotTables and -Charts, while installing a level of automation so the future user did not have to perform many tasks.

My supervisor recommended me to embed some Macros in my sheets and link them to buttons to make the tool user-friendly. For example, the idea was to create a button that would update all the tables and charts, reorder the data and reformat all tables, in case a user played around with the file and changed everything. Personally, I have never used Macros in my life and started with the simplest ways of building them: recording. After some time, my supervisor told me I could code in VBA (Visual Basic for Applications) instead of recording. As I never used it, I decided to try and build the code from scratch. I didn’t have the resources to learn a programming language that was only useful for MS Office, but I remembered reading online that people use generative AI to quickly build code, with little knowledge of the language. The Blog post on a website called “Medium” describes how the author used ChatGPT to write code in Python and after a couple attempts, it worked (Tsui, 2023). I presented my boss with this Idea, and he had a couple of requests:

  • To build this code with the next user in mind, so that they would understand what I was doing (Documentation was key).
  • For the code to be standardized in syntax.
  • For the code to be easily changeable in the future.

Seemed reasonable. I started by identifying the necessary information: where did I want the actions to be done in the Excel sheet and what exactly needed to happen. Then I navigated to OpenAI’s website, opened ChatGPT, and started with the prompt:

Quickly the AI gave me a code as a response which was documented with comments (without my request!):

This whole task took me about 5 minutes and the result had zero errors. The code worked without a problem, and I could insert it into my sheet. If I had to record my actions, I would have been prone to errors which meant I would have had to start over. Additionally, I would have a code which needed to be read, understood, and then documented for my superior and future users.

Now, with the assumption that I had 25 other PivotTables, I could just copy this code, change a couple of entries and it would work perfectly for those too. With one entry in ChatGPT I managed to do the following:

  • Build a documented code.
  • Have a standardized syntax.
  • Have it easily changeable for further use.

Since its release to the public, numerous experts have debated whether ChatGPT is a disruptive technology. By definition, a disruptive innovation transforms a product that historically was expensive and inaccessible, to be more attainable for a larger group of potential customers (Christensen, 2012). This example illustrates how an information good, such as code, can now be attained for free with a device capable of accessing the Internet. It could be argued that this technology is even an innovation which decouples an information good from a traditional business model, as learning how to write code or buying code from third parties costs resources, while asking a generative AI takes little time (Teixeira, 2017).

As managers, it will often be our job to quickly get acquainted with new technologies, unknown tools and resources. Generative AI may be able to help us navigate through the difficulty of uncertainty and quickly generate viable results.

Do you have experience in writing code with generative AI? How did it go? Are there other tools that may be more useful? Leave a comment down below!

References

Christensen, C. (2012). Disruptive Innovation Explained. Harvard Business Review.

Teixeira, T. (2017). How to respond to the digital disruption? Harvard Business School.

Tsui, T. (2023, January 17). Coding with chatGPT. Retrieved from Medium: https://medium.com/@tanyamarleytsui/coding-with-chatgpt-b50ab3fcb45f

Please rate this

Leave a Reply

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