Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help creating a ~300-item web survey

Status
Not open for further replies.

rushnp774

Programmer
Feb 28, 2009
4
I'm building my first real C# project, and need just a little guidance about the best way to do it. The website is pretty simple, pretty much just a few static pages, but one is going to be a nearly 300-item survey of the activities a person enjoys. The data will be stored in a table (massive one, I know), and I'll perform different statistical analyses on it as I accumulate a large enough sample size.

The survey is set up in four columns:

-Name of the activity
-A dropdown box populated with a few choices regarding their level of experience
-A dropdown box populated with a few choices about their level of interest in the activity
-A small input box for comments & additional explanation of their answers for each activity.

As it stands now, I have 45 items set up, and the page is SLOW (both on my computer and in the browser), and bloated. There HAS to be a more efficient way to do it. I'm thinking about generating the form on the fly (because I have the activities loaded into a database table), but don't really know where to start, because I want to be able to easily store all the data in another table record that's created upon submitting the form.

Here are my questions:

-Should I go ahead and hard-code 300 items on the form? That would make my page massive, make it very difficult to find the corresponding dropdown & input boxes for my answers when I go to store the form, and it seems like it'd be difficult to change if I wanted to modify my page structure later.
-Should I break up the form into multiple pages? That may help the loading times and page sizes, but I have the form broken up by section into a sweet jQuery accordion that works well.
-Is there an even more efficient way to do this? There probably is, but I just don't have enough experience to know.
-Is a database table with over 600 columns poor database design? I haven't read anything stating that it's too big, but I can't think of any other way to store the data the way I want to.

I don't mind reading tutorials and books (perhaps I should pick up a LINQ & SQL book?), and am not expecting a long, detailed response. Any quick tidbits to point me in the right direction would be MASSIVELY appreciated.

Thanks so much in advance!
 
Should I go ahead and hard-code 300 items on the form?
absolutely not. one key concept in programming is DRY (don't repeat yourself). creating the form on the fly using a repeatable template is the best choice.
Should I break up the form into multiple pages?
yes. if I were asked to complete 300 questions on one form I would just stop filling out the form all together.

I would have a page to display a single question and answer. when the user answers the question send them to the next one.
One question per page is very easy to understand.

now with 300 questions this would get tedious. so maybe grouping questions into common theme with no more than 5 to a page would be appropriate.

Is a database table with over 600 columns poor database design? /quote]
I'm fairly confident, yes. there may be fringe cases where this is necessary, but a survey database is not one of them.

applying DRY to the database design. do you have columns like this
question_1,answer_1,question_2,answer_2...question_n,answer_n

if so then this should be normalized like so
id,question,answer

now each question is it's own row, instead of it's own column. you can add/remove questions without changing the db schema.

Is there an even more efficient way to do this?
yes, but without having a conversation about what you really need and how you really want it to work. anything offered is just pure conjecture.

perhaps I should pick up a LINQ & SQL book?
don't. Linq to Sql is a dead project. now I would recommend learning an ORM. the big 3 are NHibernate, ActiveRecord and LLBL Gen Pro.

I've used all three. my personal favorite is NHibernate, but the approach to using this tool is not in the traditional MS approach. (similar to driving on the left side of the road instead of the right in foreign countries. it's a different approach to designing systems).

ActiveRecord is built on top of NHibernate and offers ease of use to mapping entities. I feel this benefit is negated with the FluentNhibernate project though.

LLBL is more MS methodology friendly. There is a fee to use the product, but it's nominal for the amount of power it offers. I think it's around $350 US.

in closing think there is one major road block in this project. You're trying to model the GUI, logic and Database all the same. And there may not be any logic, just Database to GUI. Either way, you can store data and present data independently of each other. using a series of mapping object(that you create) to can transform the data into presentable information.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Rush, I would consider a few more things. A dropdown box to make a choice is more of an ergonomic investment than a set of option buttons (or check boxes if more than one choice is allowed). Think about it: you have to open the box, scroll down to your selection and click. Maybe you miss and have to do it again. With option buttons, you see all the choices without having to click anything first, and you make one click on the one you want. The tradeoff is that a dropdown box takes up a lot less space.

Jason is quite right about what he's telling you, that it would be best to come up with groups of questions and put them on different pages. As such, you might want to consider using option buttons instead of dropdown boxes, as you should have the needed space.

Finally, you need to read up a bit on general database theory. You're violating the "first normal form." :) Here's a link:
HTH

Bob
 
Jason, are you saying that LINQ is falling by the wayside? I'm seeing it a lot in job requisitions.

 
not LINQ. LINQ to SQL.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top