Coding with ChatGPT : A Retrospective

"Curious how ChatGPT handles real-world coding? Discover my journey building a Python web service—from AI boosts to debugging detours—and see if AI is the coding partner you need.

Coding with ChatGPT : A Retrospective
Photo by Emmanuel Edward / Unsplash

I recently set out to build a simple Python web service—a tool that could interact with a PostgreSQL database, generate reports, and present them in a straightforward format. My aim was to manage and visualize backup data for Bareos, an open-source backup system, in a way that would save time and keep the data organized. While I’ve worked with web services in Python before and have some JavaScript experience, I hoped ChatGPT might help me tackle the configuration faster and minimize some of the legwork that typically makes this kind of project time-consuming.

ChatGPT Canvas

With the new ChatGPT-4 Canvas (available to Plus paying users), I was interested in seeing if its interface, which provides more spatial context, could streamline the back-and-forth required for building this project. I started by asking ChatGPT to help me create a basic Python web service using Flask, and we worked in Canvas to set up the core structure. From there, I moved on to specific requests, asking ChatGPT for a file organization structure, a .gitignore file, and a shell script for deployment. Each response was tailored directly to my project’s needs, which helped lay a solid foundation faster than I could have done through self-guided research alone.

Sample of ChatGPT Prompts Used to in this Project

> We are writting some python today. I need to create a mini web server that runs a particular sql querty when a page is access and returns the result in a table. I want that page to leverage bootstrap. The sql server is postgresql.

> Ok, the flask sql bootstrap, can you split it into 2 file, the template and the programCan the credentials be in a seperate file?

> Can the credentials be in a json file?

> Can I have the requirement.txt?

> In true mvc form, can you seperate the controller from the main app?

> Ok, lets do a major change. Lets change all the non-index page to output a json response of the query. Can we update index to pull the data from those json endpoint instead of running the queries?

> Can you give me the directory structure for this program?

> Can I have a bash script to run the thing?

> Can I have a bash script to add or remove the program from systemctl so that it can start a bootup?

> How do I format the sql so that it is readable? Should I use seperaete sql files?

The Canvas setup, while an improvement over previous interfaces, was still not perfect for a full coding project. Copying and pasting updated code between ChatGPT and Visual Code was still necessary, but the Canvas layout helped keep things organized, making this manual transfer a bit more manageable. However, as the project evolved, ChatGPT sometimes lost track of previous context, resulting in suggestions that no longer fit the project’s latest state. To fix this, I occasionally had to copy whole files back into ChatGPT for a “resync.” This step felt a bit clunky but was ultimately effective in realigning ChatGPT’s advice with my actual code.

The Bareos Reporter App, built with the help of ChatGPT

Debugging

Once the core functionality was in place, I moved on to debugging. Here, ChatGPT’s help was hit or miss. About half the time, its suggestions were spot-on, quickly diagnosing issues like empty JavaScript files not serving properly or HTTP responses not behaving as expected. When it worked, ChatGPT’s accuracy was almost uncanny, cutting down the usual trial-and-error. But for other issues, its advice led me down paths that were more distracting than useful, like suggesting fixes that didn’t align with my setup. Eventually, I learned to be selective about which advice to follow, especially when my main goal was saving time.

404 File Not Found, pretty common error when you have a typo in your routes

This mix of successes and detours showed ChatGPT’s potential as a debugging assistant but highlighted its occasional limitations in giving targeted solutions. That said, for straightforward questions, it remained a reliable time-saver.

Reflections on AI Assistance

One of the biggest time-savers from working with ChatGPT was getting example code tailored exactly to my project’s specifications, a process that otherwise would have involved piecing together snippets from sources like StackOverflow and adapting them to my needs—assuming they worked at all. The ability to get focused, relevant examples without extensive search time made a real difference in moving the project forward.

In the end, building this web service with ChatGPT took just two evenings—a timeline that likely would’ve been closer to two or three days without AI assistance. ChatGPT’s contextual answers, code samples, and guidance helped to streamline the development process without excessive sidetracking.

Overall, ChatGPT’s support wasn’t seamless, but it was a resourceful assistant that aided in structuring the program and troubleshooting in ways that reduced friction. While it’s not a replacement for hands-on coding or debugging, ChatGPT can be a valuable partner, especially when you need support to accelerate the development process.

💡
Have you tried using ChatGPT or another AI tool to assist with programming? What was your experience—did it save you time or lead you down unexpected paths? I’d love to hear your thoughts in the comments! If you found this article useful, you might also enjoy [How to Simplify Debugging with AI-Powered Tools], where I dive into other practical ways AI can assist in development workflows. And to stay updated on the latest tech insights and tutorials, consider subscribing to our newsletter.