From: Michael Judge Date: 2006-01-27T09:50:04+09:00 Subject: Re: Design problems (beginner) Thanks for your input, Gregory. I've been doing more reading on object-oriented design today and think you're right, I should revamp my project structure into: Interview Question Answer And any cross-talk that currently happens between questions and answers needs to be handled in Interview. So I'd have Interview.compile_question, but not Interview.question(name).compile. And I'd have Interview.answer[key].validate, but not Interview.question(name).validate. As a bonus, it's less typing too. * * * The project is a web-framework for online surveys. Already existing open-source projects (like PHPSurveyor) lack basic functionality required for survey research. The alternative, commercial packages, with basic ones starting at $5,000/year for a lease -- make it really tough for people with limited means like small business consultants and graduate students to do survey research. So I'm trying to give back to the research community by releasing the next version of my company's in-house interviewing system open-source. I'm excited about the project and the work I've done on it, but want the source code to be reasonably polished too since I expect someday others will be looking at it. Here's an example of my current test quesitonnaire script: Q-INTRODUCTION Q Thank you for your interest in this study. Once you have completed the study, please allow up to 7-10 business days for your [panel] credit to appear in your [panel] account. Thank you for your time and opinions! Q-SA1 Q Which of the following best describes your employment status? (MARK ONE ONLY.) X-1 Employed full-time outside of the home X-2 Employed full-time, working from my home X-3 Employed part-time outside of the home X-4 Employed part-time, working from my home X-5 Homemaker X-6 Retired X-7 Student X-8 Not currently employed post: self.validate :required skip 'Q-S1' if self.questions.current.answers.has_value? 8 Q-SA Q Which, if any, of the following items have you purchased or ordered in the past year for work purposes? (MARK ALL THAT APPLY.) M-1 Business Cards M-2 3-Ring Binders M-3 Mailing Labels M-4 File Folders M-5 None of these M-6 Not currently employed post: self.validate :required self.validate :multiple, :params => [1..4, 5..6, "none of these/not currently employed"] skip 'Q-SB' if self.questions.current.answers.has_value? 2 skip 'Q-S1' ...and so on... Supports ERB codes too, which is kind of neat. -- Posted via http://www.ruby-forum.com/.