“I’m not writing shitty code; I’m creating refactoring opportunities.” [conaldtrah]

On the farcry-dev mailing list M Wheeler recently asked how to get his custom admins looking nice in farcry 3 and, as Gav and I are currently converting the Board of Studies’ largest farcry site over to farcry 3, I thought I’d document the process we used for future hackers like Mr Wheeler.
Firstly I must say; there’s no simple answer on how to do this, so I’m just going to run through what I did.
To begin the process of moving to the v3 look and feel I took a deep breath, checked my flickr contacts one last time, and started with the following:
- Looked at the new core type edit.cfm files
- Made our edit.cfm files look like theirs by manual compare and merge
- Refactored all the garbage in edit.cfm after
<cfif isDefined("bComplete") and bComplete>into common includes
I then started editing the PLP steps themselves to use the new widget custom tags.
Here was when I smelt the pungent aroma of redundant code — we’d rarely modified the core plp steps (such as body.cfm) and had just made a copy of the core file in our custom types’ _plpEdit directory. Bad bad us!

So I took out my 12 gauge, loaded one in each barrel and went on a code massacre, and ended up with most custom types having nothing more than their own edit.cfm files. No _plpEdit directories. No copied core files. This was a beer worthy moment.
If some of your plp steps are straight copies of the core code then just delete them and instead of referring to your local copy:
<widget:plpstep name="body" template="body.cfm">refer to the core copy using the stepDir attribute:
<widget:plpstep name="body" template="body.cfm" stepDir="/farcry/farcry_core/packages/types/_dmhtml/plpEdit">
The rest of the process is just a matter of getting your hands dirty, so I’ll leave you here on this somewhat relevant quote:
Programming is looking at a feature request in the morning, thinking “I can do that in one line of code”, and then six hours later having refactored the rest of the codebase sufficiently that you can implement the feature… in one line of code. [the fishbowl]