Red Green Repeat Adventures of a Spec Driven Junkie

Coding with Gen AI: Refactoring

I am finding programming with Generative Artificial Intelligence, Gen AI, to be fun! Like I am pair programming with the best programmer in the world (indirectly, I am!)

One aspect I love having my “pair” do: Refactoring!

Coding with Gen AI Pair

I can just code up a storm, making a mess wherever I want. Generic variable names, opaque function names, duplicate functionality every where.

Basically, just move as fast as I can to the goal.

When I get things working - I just take all the code, put it into

[SYS] You are a top Ruby on Rails programmer with knowledge of the ecosystem.

[ME] Refactor the following code so it's clean:

<dirty messy code>

[AI] Gladly!

<refactored clean code>

All of this happens without any friction all in an instant.

The perfect pair programmer!

The same for variable and function names:

[SYS] You are a top Ruby on Rails programmer with knowledge of the ecosystem.

[ME] Rename the X variable to Y and the function Z to A.

<confusing code with variables X and function Z>

[AI] Here you go!

<code with variables X as Y and function Z as A>

Pairing with an Generative AI just takes all the grunt work out of my programming and lets me focus on the fun parts: coding up a storm to a solution.

I always joked when I met software consultants that had client engagements where they were cleaning up their clients’ mess.

Now Generative AI can do it instantly with almost zero cost!

What a time to be alive!

Related Articles