Have to admit that I do think of myself as a coder, not a problem solver. According to Mike [I should be writing less code][lesscode].

> This is why I stick with the mantra “Write less code”. Whenever I feel like something is getting bigger than it should be or more complicated than it should be, I say “Write less code”. Whenever I write so much code that it gets hard to keep it in context, I refactor, I clean it up, all the while, thinking about “Write less code”.

The biggest issue I see with the above statement, is that clients have never really seemed to be all that interested in paying you to refactor code in the middle of a project. I’ve had a few large WordPress sites with a bunch of custom functionality and half way through I start to loose track of what does what where. Inevitable I find duplicate (or very similar) code. Really I should be stopping and sorting it all out, but I can’t do it for free and the client doesn’t really want to pay for it, so what to I do?

Maybe I need to be spending more time mapping it the function of the site? Maybe I need to be taking higher end clients that realize the need to refactor midstream? Maybe I need to work on my own projects more so I can take the time I want to craft the code I want to write? Maybe I’m a whiner and need to just keep working?

How do you deal with mid-project refactoring?

[lesscode]: http://mikegrouchy.com/blog/2012/06/write-less-code.html “Write Less Code”

2 responses to “Coding is Not My Job, I Solve Problems”

  1. Rae Arnold Avatar

    Curtis, I try to write under the idea of “make it as general as possible”. That way, when I find myself needing to write duplicate, or very similar code, I first check to see if I can just extend a function I’ve written elsewhere and call it in the new location.

    It doesn’t work quite as well in environments like WP, at least on the plug-in side, but my functions.php can get pretty large with helper functions that can be used by many templates, allowing me to keep my actual templates very streamlined.

    1. curtismchale Avatar

      I’m more often building “template tags” now as well and saving them in Codebox so I can find them later. Most of the tutorials on wpthemetutorial.com come from template tags I built.