I have a huge survey tool that I’ve been working on for a long time. It’s a dynamic system that lets you add as many questions as you like to a survey, and has some standard abilities for error checking, being nice when it finds you missed a field that was required, uh, a gigantic and growing administration tool and reporting engine with n-level drill down, all with graphs, charts, excel export, etc, etc, etc.
The unfortunate scenario I’m in here is that when I’ve failed to anticipate a contact info field that someone’s going to want to ask for, it’s extremely difficult to add them, system wide. The system wasn’t built from the beginning to be very dynamic. There’s 3 tables to alter, and at least 9 processors (so far that I’ve found) that need to be touched when the contact info fields list grows. This is 3 year old code… php web code, so that’s like 15 dog years. (and do the math from there…) Fortunately, the list of possible contact info fields is getting to a ridiculous level… I’m having a hard time imaging needing to do this again in the future, but… just in case…
This round, I’m creating a wiki page to document the entire process, and I’m dynamizing code where I can so that it’s a non-issue moving forward for some of these cogs. I just shaved 800 lines of code out of my survey processor by stepping through fieldnames and values dynamically and then checking that fieldname against the contact-info-field-required-list table dynamically too. Even special casing fields like “state”, “shipping state”, and an “exclude” list for fields that we just never really need to check – “address 2″, “shipping address 2″, et cetera.
It’s staggering how much code I’ve written for this engine, and it’s not even close to zoomerang yet. It might be if I could roll out an easier deployment system. Right now it’s still pretty manual for me to have to roll a survey out. That’s really not such a bad thing right now, but, it’s an obvious problem, long term. There’s still some not-so-basic features (like asking different questions based on responses), and some scalability concerns before I can really open it up company-wide. Some of our potential company-wide surveyable audiences number in the hundreds of millions. I seriously doubt my little survey tool would stand up to an onslaught like that.
Maybe someday… some… day.
Anyway, hardcoding bad, dynamic code good. Yay, brain. Go me.