Concrete Code for a Quick Configuration, Page 2
The Non-Configuration Solution
Now that you've seen the code, it's time to evaluate how complicated this would be to implement as if/then statements. For the example file I gave, there are only 7 if statements that would be necessary. It's probably shorter to hard code the questions into the body of the program - however; the true power of this questionnaire solution is that it can be used with any questionnaire containing any number of questions.
If there are 500 questions in the database - the code remains the same code that you've seen here. This code is much less complicated and much easier to maintain than 500 if statements.
In Conclusion
What makes this solution configuration based is its ability to create new solutions based on a different configuration (or input) file. This is incredibly powerful when applied to your day-to-day programming tasks.
Downloads
Questionnaire.zip - Source code for questionnaire with question configuration.About the Author
Robert Bogue, MCSE (NT4/W2K), MCSA:Security, A+, Network+, Server+, I-Net+, IT Project+, E-Biz+, CDIA+ has contributed to more than 100 book projects and numerous other publishing projects. He was recently honored to become a Microsoft MVP for Microsoft Commerce Server and before that Microsoft Windows Servers-Networking. Robert blogs at http://www.thorprojects.com/blog. You can reach Robert at Rob.Bogue@thorprojects.com.
