Skip to main content
Ben Nadel at BFusion / BFLEX 2010 (Bloomington, Indiana) with: Matt Boles
Ben Nadel at BFusion / BFLEX 2010 (Bloomington, Indiana) with: Matt Boles

Learning In Public: Small Refactoring With Claude Code Models

By
Published in Comments (1)

Although I've started to dip my toe into the agentic coding pond, I've been slow to do any cross-model comparisons. So far, I've only used the Claude Code Opus model since it's the default; and is supposed to have the most robust reasoning capabilities. But, I don't really know when I need "reasoning". When is it OK to use something fast like Haiku? Or something more measured like Sonnet?

As a first trial, I wanted to do a small refactoring in Big Sexy Poems. While small refactorings aren't the sexiest operations, they are a big part of how software gets made: you try something, it doesn't quite feel right, you refactor to something that looks and feels more appropriate.

In Big Sexy Poems, I have a custom tag in a globally shared folder which really should be in a subsystem shared folder. Refactoring this would mean:

  1. Moving the custom tag (composed of three collocated files) from a global folder to a local folder.

  2. Removing the import for the global folder (local imports are automatically detected).

  3. Updating the existing references to this custom tag to point to the new local folder location.

To keep things straightforward, I created a PROMPT.md file which I then fed into each model (adding line-breaks for readability):

# Refactor the code.

Take the @cfml/client/_shared/tag/poemPreviewInTable.cfm and move it to the
@cfml/client/member/_shared/tag/ folder. This includes all of the associated
files (`.view.cfm`, `.view.less`, `.view.js` if present); move them to the
member subsystem; and refactor any code that references these files.

Part of me feels like maybe I was too explicit in my directions here. But, if nothing else, it gives me a better sense of what the models can do when directed clearly. A junior developer could follow these directions, no questions asked.

The Results

If you watch the video, all three models did exactly the same change (character for character). I'm not sure how to best capture the timing since each trial had to block-and-wait for me to give it permission at one point (and I don't know if that's part of the "bake" time). But, here's the timing that it reported in the the CLI output:

  • Haiku 4.5 - 49s
  • Sonnet 4.6 - 1m 18s
  • Opus 4.6 - 1m 0s

Again, these were 100% the same code changes in each model. But, I think that Haiku burns less tokens and was 20% faster than Opus. That's a promising outcome. Though, I have to remember that this was an extremely small test (vis-a-vis scope of change and ambiguity of outcome).

Here's the full git diff so you can see that it was a very small change:

diff --git a/cfml/app/client/_shared/tag/poemPreviewInTable.cfm b/cfml/app/client/member/_shared/tag/poemPreviewInTable.cfm
similarity index 100%
rename from cfml/app/client/_shared/tag/poemPreviewInTable.cfm
rename to cfml/app/client/member/_shared/tag/poemPreviewInTable.cfm

diff --git a/cfml/app/client/_shared/tag/poemPreviewInTable.view.cfm b/cfml/app/client/member/_shared/tag/poemPreviewInTable.view.cfm
similarity index 100%
rename from cfml/app/client/_shared/tag/poemPreviewInTable.view.cfm
rename to cfml/app/client/member/_shared/tag/poemPreviewInTable.view.cfm

diff --git a/cfml/app/client/_shared/tag/poemPreviewInTable.view.less b/cfml/app/client/member/_shared/tag/poemPreviewInTable.view.less
similarity index 100%
rename from cfml/app/client/_shared/tag/poemPreviewInTable.view.less
rename to cfml/app/client/member/_shared/tag/poemPreviewInTable.view.less

diff --git a/cfml/app/client/member/collection/view/view.view.cfm b/cfml/app/client/member/collection/view/view.view.cfm
index adea26d..630e11c 100644
--- a/cfml/app/client/member/collection/view/view.view.cfm
+++ b/cfml/app/client/member/collection/view/view.view.cfm
@@ -55,7 +55,7 @@
 						</td>
 						<td>
 							<cfmodule
-								template="/client/_shared/tag/poemPreviewInTable.cfm"
+								template="/client/member/_shared/tag/poemPreviewInTable.cfm"
 								content="#poem.content#"
 							/>
 						</td>

diff --git a/cfml/app/client/member/member.js b/cfml/app/client/member/member.js
index 0bc44da..4ad6416 100644
--- a/cfml/app/client/member/member.js
+++ b/cfml/app/client/member/member.js
@@ -11,7 +11,6 @@ import "../_shared/tag/errorMessage.view.{js,less}";
 import "../_shared/tag/flashMessage.view.{js,less}";
 import "../_shared/tag/localDevelopment.view.{js,less}";
 import "../_shared/tag/markdownDisclosure.view.{js,less}";
-import "../_shared/tag/poemPreviewInTable.view.{js,less}";
 import "../_shared/tag/skipToMain.view.{js,less}";
 import "../_shared/tag/speechTools.view.{js,less}";
 import "../_shared/tag/svgSprite.view.{js,less}";

diff --git a/cfml/app/client/member/poem/list/poemTable.view.cfm b/cfml/app/client/member/poem/list/poemTable.view.cfm
index 4217276..1b02734 100644
--- a/cfml/app/client/member/poem/list/poemTable.view.cfm
+++ b/cfml/app/client/member/poem/list/poemTable.view.cfm
@@ -27,7 +27,7 @@
 				</td>
 				<td>
 					<cfmodule
-						template="/client/_shared/tag/poemPreviewInTable.cfm"
+						template="/client/member/_shared/tag/poemPreviewInTable.cfm"
 						content="#poem.content#"
 					/>
 				</td>

diff --git a/cfml/app/client/member/poem/revision/list/list.view.cfm b/cfml/app/client/member/poem/revision/list/list.view.cfm
index 04cad18..197badc 100644
--- a/cfml/app/client/member/poem/revision/list/list.view.cfm
+++ b/cfml/app/client/member/poem/revision/list/list.view.cfm
@@ -39,7 +39,7 @@
 						</td>
 						<td>
 							<cfmodule
-								template="/client/_shared/tag/poemPreviewInTable.cfm"
+								template="/client/member/_shared/tag/poemPreviewInTable.cfm"
 								content="#revision.content#">
 							</cfmodule>
 						</td>

See, very small. But, more explorations to come!

Want to use code from this post? Check out the license.

Reader Comments

1 Comments

I have been using cursor as mu editor for about a year, and left it in the "default" mode so it would pick what agent best fits my use case (idk how that magic works at all).

On a daily usage basis it was fairly meh... it felt more like teaching it to code than asking it to do it for me and then checking it. Sometimes it would do ok, sometimes it would amazing, but most of the time it was just wrong or would remove entire parts of code and replace it with a comment that said "... existing code"

I switched over to Antigravity the day it was released, and it is so much better at understanding the codebase and executing commands, and the way it presents a list of preparation steps before it does anything and I can look though it and be like "not quite like that, more like this" and it will update it is way better than just letting an AI do whatever it thinks is right.

I have never used Python for any real application, but had a thing I wanted to make and decided to make it on Python. I had Antigravity build it from nothing in a few hours, and it works great.

Post A Comment — I'd Love To Hear From You!

Post a Comment

I believe in love. I believe in compassion. I believe in human rights. I believe that we can afford to give more of these gifts to the world around us because it costs us nothing to be decent and kind and understanding. And, I want you to know that when you land on this site, you are accepted for who you are, no matter how you identify, what truths you live, or whatever kind of goofy shit makes you feel alive! Rock on with your bad self!
Ben Nadel
Managed ColdFusion hosting services provided by:
xByte Cloud Logo