Generative AI: A catalyst for change or historical amnesia (Software Engineering)

Harry Hathorn
4 min readFeb 16, 2024

Let’s focus on how AI is changing how we do software engineering.

Google, StackOverflow, and annoying your seniors are fond memories of any aged engineer. But what about the youngins of today? Have we succumbed to the laziness-induced ChatGPT spoon-feed? Have we forgotten how to properly search Google, namely:

https://www.google.com/search?q=Microsoft.ML.ModelBuilder.AutoMLService.Experiments.MultiClassificationExperiment.%3CExecuteAsync%3Ed__14.MoveNext()+in+%2F_%2Fsrc%2FMicrosoft.ML.ModelBuilder.AutoMLService%2FExperiments%2FMultiClassificationExperiment.cs%3Aline+140&oq=Microsoft.ML.ModelBuilder.AutoMLService.Experiments.MultiClassificationExperiment.%3CExecuteAsync%3Ed__14.MoveNext()+in+%2F_%2Fsrc%2FMicrosoft.ML.ModelBuilder.AutoMLService%2FExperiments%2FMultiClassificationExperiment.cs%3Aline+140&gs_lcrp=EgZjaHJvbWUyBggAEEUYOTIGCAEQRRg7MgYIAhAuGEDSAQcxNjlqMGo5qAIAsAIA&sourceid=chrome&ie=UTF-8

Notice the genuinely helpful results I get from Google. There is an art to it, and I'm worried that young engineers might not learn it.

With that said, Chat GPT is an excellent tool for software engineers. It can efficiently perform a variety of tasks which eliminates toil from your work day. You can ask your “dumb” questions without being downvoted. It opened up new avenues and shattered what I thought was possible.

But back to the point.

A blog written by an expert, explaining a concept will almost always be better than what Chat GPT spews out. If you just took an extra 2 minutes to google you could have found that blog and learned something more valuable.

So my word to you, especially young engineers is to do your due diligence. Research the questions you’re asking beyond the quick answers. Use Chat GPT but also create a StackOverflow account. Ask your questions, get downvoted, get into arguments in the comments, and search for others facing the same problems. Lo and behold you could ask a peer for help, read documentation or search Github issues. You might learn something.

Here’s the thing:

If you are doing the wrong thing, which you probably are, Chat GPT will just help you to do the wrong thing better.

It will use your prompt to generate an answer without using the proper interpretation.

For example, Enlarge Dog Bowl Hole

Me: The hole in my concrete I use for a dog bowl is not big enough, please can you help me to improve this

ChatGPT: Certainly! If the hole in your concrete for the dog bowl is not big enough, you can follow these steps to improve it:

Materials Needed:

Appropriate safety gear (gloves, safety glasses)
Concrete drill bit (appropriate size for the desired hole)….

This is a terrible answer, It would have been badly downvoted if answered on pets.stackexchange.com for example. Anyone could tell you “Get a bowl.”

Now what about code? There are plenty of times we are doing the wrong thing, here’s an example:

EF Renaming Table Issue

Me: EF I have generated migrations and it is dropping my table instead of renaming it

ChatGPT: … Disable automatic migrations by setting AutomaticMigrationsEnabled to false in the Configuration…Ensure that you are explicitly using the RenameTable method in your migration to rename the table instead of relying on automatic renaming

I wouldn’t approve that pull request and I don’t think your team will be too happy either. I googled the same problem with the same phrase “EF I have generated migrations and it is dropping my table instead of renaming it” and after reading a few different answers from humans I much prefer the answers I get.

Here’s an excellent blog by an expert Mitchel Sellers:

One method to get around this is to temporarily utilize Data Annotations to guide Entity Framework with what you would like to do; then, after creating a proper migration, you can rename the objects properly and create a blank migration to finalize the change…

Here’s a trustworthy stack overflow answer, upvoted by many, full of comments and information

(1) Before renaming the entity, “rename” the table and the PK column by using either ToTable and HasColumnName fluent API or data annotations. Also do the same for FK columns referencing the entit

(2) Add new migration. It will correctly rename the table, PK column, FK columns and the associated constraints

(3) Remove the annotations / fluent configuration and do the actual class/property rename:

So is generative AI the paradigm shift we’ve all been waiting for or is it a distraction which stops us from getting the right answers? Are we becoming lazy and learning bad habits by relying on an easy way? It shattered the dome of possibility, it’s here to stay, and it’s a great help, but how do we use it? Do we use it safely?

I would like to do more research, gather more data and write another article which compares chat GPT answers to things I find on Google.

Happy coding 🤓

// Get your answer safely
string question = "Is a burger a sandwich?";
string answer = string.Empty;

if (TryGoogle(question, out answer) ||
TryStackOverflow(question, out answer) ||
TryDocumentation(question, out answer) ||
TryReadCode(question, out answer) ||
TryChatGpt(question, out answer) ||
TryTalkToYourSenior(question, out answer))
{
// You got an answer
}
else
{
// Go get some sleep and come back tomorrow.
}

--

--

Harry Hathorn
Harry Hathorn

No responses yet