About a month and a half ago, I complained about being creatively hungover. I've slowly recovered from it, and I have been chipping away at some work.
One thing that jolted me out of my website-building slump was the adoption of a third-party framework to replace one I built over the past five years. In the office, I built a number of web applications using code I fashioned for my personal projects, and now I'm moving them over to CodeIgniter. I should have done it years ago, but even as recently as 2005, I felt I needed to build everything from scratch because I wanted to be familiar with how every little detail works.
Then I started learning more about MVC patterns and took a look at code that implements it far more effectively than my own. I saw two options:
- Turn my patchy framework into something comparable to Ruby on Rails or CakePHP
- Actually move my applications to Ruby on Rails or CakePHP
But I knew the amount of work to adapt existing code to a new structure took just as much — if not more — time than writing from scratch. And I have a lot of code — code which has gone through numerous rewrites before. Reinventing the wheel just didn't sound appealing.
The work applications, however, have a glaring Achilles heel — I'm the only person who knows what's going on. It would take more time than is worth for someone else to go in and figure it all out. If I didn't move all that code to something already documented — and my patchy framework is not documented very well — it would rot.
I was immediately sold on CodeIgniter because integrating the Smarty template engine was easy and quick. CakePHP doesn't seem to encourage such integration. (Some developers believe a framework with its own template engine shouldn't need to use Smarty in the first place.) That's important because I have far too many templates to adapt to a new templating engine.
Once I started moving the code over, it felt good finally to impose a better sense of structure on what was quickly turning into reams of spaghetti code. My framework was kind of, sort of object-oriented in spirit but not in practice.
When I managed to move over a registration and login system in three days, I felt engaged with code again.
Of course, this means I'm essentially trashing five years of my own work. But honestly? I'm so ready to move on.
I'm past the point of wanting to learn the ins and outs of functions, control structures, logic and data types. I read articles on weblogs extolling the virtues of good developers, and they all described me three years ago. I'm not so eagar to code after work, to refactor applications over and over again, to keep up with the proverbial Joneses. Eight years ago, it was all new to me, and it tapped into a part of my creativity that craves logic over expression.
Since 2005 — not coincidentally when I started making music again — the figurative pendulum has done its proverbial swing. I have a good idea of what I'm doing now. I don't need to prove much more to myself.