When "Good coding days" equals "deleting code"

August 07, 2007

Don't you just love those days when you get into a "groove" and are able to be extremely productive? Today was one of those days. I _finally_ finished 2 features in my framework that had been driving me nuts for some time now. The key thing for me ended up being "knowing when to just draw a line in the sand and delete old code". In this case, that included scrapping my ideas for the Spry framework. I downloaded Spry maybe 2 weeks ago and began playing with it. At first it seemed like this would be the exact solution to my problems. And in all fairness, it did _mostly_ work pretty much straight out of the box. I followed the few examples I could find (mostly via the copy of Raymond Camden's Lighthouse that we're currently using, and of course the Adobe site), built a couple proof-of-concept pages and it seemed fine. When I started using my new Spry functions in "the real world" (i.e. when I integrated them into my app), things started to kind of fall apart. I found myself battling too many edge cases, and weird behaviors. I fully admit that part of these may very well be just my lack of knowledge on Spry...but after a week plus, and looking through all the info I could find on the web, I had to draw a line in the sand. This turned out to be the best decision I would make while trying to solve the problem. After getting frustrated with my Spry-enabled-but-only-kinda-working-CFC, I said to myself "Self, let's step back for a second, what _really_ do we need the Ajax/Spry layer to be doing for us here?" After spec'ing it out again, I realized that I can get away with deleting Spry altogether (for now -- I'll probably revisit it at a later time), and can replace it's XML/Data Set magic with 1 homegrown Ajax call, and about 10 lines of JavaScript (building upon another JS library that my teammate had written recently). And that was all it took. Two big features in the app are now complete and running nicely, allowing us to move forward. My "CCompositeDropDownControl" and the "dynamic add button" libraries are finally working (not that those names mean anything to you. *g*) That old rule still rings true: never be afraid to throw code out!