Knight Technologies LLC

The misadventures of a veteran technology professional.

7 ways I use Generative AI while writing code 

I see a lot of mixed emotions when it comes to incorporating AI into the workflow of a software developer. Although I am not worried about Generative or Agentic AI taking my job (have you seen Devin in action?), I decided a couple of years ago to embrace it and…

I see a lot of mixed emotions when it comes to incorporating AI into the workflow of a software developer. Although I am not worried about Generative or Agentic AI taking my job (have you seen Devin in action?), I decided a couple of years ago to embrace it and make AI another tool in my toolkit. On my current project, we’ve been given access to GitHub Copilot which I use both in Visual Studio Code and Visual Studio 2022. It’s been a fun ride thus far. 

Here are the 7 ways I use Generative AI daily: 

1. Code completion and suggestions – This feature somewhat existed before I started using AI, however, it is much more sophisticated nowadays. Although I’ve been writing code for over 30 years, I love the fact that suggestions are given, and I don’t have to rummage around on Stack Overflow to find just the right syntax. Make no mistake, sometimes Copilot gets it wrong, but that’s why you need an experienced developer to oversee code generation by LLMs. 

2. Training – I’ve been a C# developer for the last 25 years and have been building web-based solutions since the days of classic ASP (VBScript). React and Angular are not new to me but sometimes I need to better understand syntax or a concept when something isn’t working as expected. The fact that I can highlight syntax and ask for help right in the codebase is fantastic. I no longer need to spend a lot of time reading countless articles or posts to get the answers I need. 

3. Creating T-SQL statements – At this point in my career, I would consider myself an expert in SQL. I’m a huge fan of using ORM’s whenever I can but sometimes one just needs some good old-fashioned T-SQL to get the job done especially with using things like Dapper. Being able to copy the needed columns right from a Jira story, creating a simple prompt explaining table structure and joins, pasting in the columns, and then hitting enter is instrumental and a huge time saver. 

4. Translations – One of the requirements for the application I’ve been working on for the last several months, is the UI must be available in English and in Spanish. Obviously React takes care of switching between the two languages by way of translation files on the front-end and the back end will emit data in both languages as needed. Another area where Generative AI shines, is handling the translations. I can choose any text that will be displayed in the UI, highlight it, and prompt with “use a translation here” and Copilot will create the proper syntax. Then I simply switch over the English translation file, create the entry, and Copilot will typically suggest the correct message. I copy that and then drop that into the Spanish translation file and then prompt Copilot to translate the English message to Spanish. Voila! Just for fun one day, I asked for a translation from English to Klingon. Copilot deftly honored my request with a perfect translation. Worf, son of Mogh, would approve! 

5. Documenting code – I am a huge proponent of documenting code especially on the C# side of the house. A simple prompt produces excellent documentation. I think back to the many times I’ve been refactoring entire codebases and had to hand type every XML comment. Now I can use a prompt to have an entire class file documented in my preferred style. 

6. Creating class files – This is another huge time saver especially if one is using models and DTOs in a project. I will typically copy and paste documentation if available to provide the properties and then have Copilot do the heavy lifting with not only creating a model but also the DTO and conversion methods for each class type. And yes, I ask for documentation to be created, too. 

7. Creating fluent migrations – Finally another area that has been a huge time saver for me on this project is having Copilot create the syntax for fluent migrations. If you aren’t using FluentMigrator, I would encourage you to check it out. FluentMigrator makes creating SQL Server assets such as tables, columns, and constraints in code incredibly simple. Couple that with having Copilot write the syntax including defensive programming techniques like checking for the existence of a table or column before making changes and you have a well-oiled machine so to speak. 

The list above demonstrates a few ways that I use Generative AI daily to make my job as a Senior Software Engineer easier. I don’t feel like AI will replace my job as I see it just being another tool in my vast coding arsenal. Will it replace junior developers? I don’t see that happening either because in many ways it behaves much better than a junior developer and does what it’s told. 

Leave a comment