Topic: High-level architecture advice for a student-teacher-q&a web app

My application needs to keep track of:

1. Teachers
2. Students
3. Courses
4. Classes
5. Questions

There can also be many students associated with a given teacher and a student can also have many teachers.  Students and teachers are associated through courses that are taught by the teachers and that the students enroll in.

Each course consists of many classes, but a class can only be associated with one course.

"Questions" are multiple-choice questions with between 2 and 7 options for the answer, labelled A - G.  There are limitless questions and people will be allowed to create their own.

In the course of a class, a teacher may select a question and pose it to the students enrolled in the course.  This is intended to happen in an immediate and time-sensitive manner.  For instance, imagine that there are 10 students enrolled in a course and that each time they meet the teacher sits at the front of the class with a laptop and the 10 students sit facing him, each with a laptop.  All of them are connected to the internet and have my website open and are logged in to it.  The teacher is logged in as a "teacher" and the students are logged in as "students" because the application keeps track of these two types of users.  When the teacher selects a question and poses it to the students, it should appear on their laptops only after the teacher hits the "Pose" button.  The application also needs to give the teacher the option to pose the question with a time limit.  Finally, the teacher should also be able to pose questions in bulk that the students will then answer at their leisure, perhaps for homework, or perhaps timed as a take-home test.

Note that the question should only be posed to the students in the course at that time, not to all the students of that teacher (of course).

The application has two types of users (aside from me, the super-user). They are:

1. Teachers
2. Students

Once a teacher has created an account on the system, the teacher can then create courses.  All courses will have a calendar of meeting times associated with them.  Once a student has created an account the student can register for one or more courses.  (A teacher may need to give approval before a student can fully join a course).

The goal of the application is to allow the teachers to get a more statistically rigorous view of how their students are doing with various kinds of questions.  So producing useful reports and charts of student performance on the questions is the goal.  Questions need to be broken down into sub-types and sub-sub-types and the application should be able to highlight trends and spotlight various discrepancies, and so forth.

I would like to build the above application using Ruby on Rails.  I have a Macbook Pro, a desk, the Ruby on Rails 3 Tutorial book, The Ruby Programming Language book by O'Reilly, and some software such as Textmate and Git.  I'm pretty much a newbie at designing applications, however.

Also, perhaps I'm being paranoid, but I would like my database to be in third normal form.

I think this qualifies:

TEACHER_TABLE: teacher_name, teacher_id

STUDENT_TABLE: student_name, student_id

COURSE_TABLE: course_name, course_id, teacher_id, meeting_schedule, location

CLASS_TABLE: class_id (class number), course_id

ENROLLMENT_TABLE: course_id, student_id

QUESTION_TABLE: question_id, question, choice_a, choice_b, choice_c, choice_d, choice_e, choice_f, choice_g, correct_choice (a-g)

ANSWER_TABLE: student_id, question_id, choice, course_id, class_id, timestamp.

(The student can answer the same question in different courses or classes -- these are different entries in the answer table.)

Before I set all this up in rails, is there anything I should carefully think about?

Thanks,

deonomo

Last edited by deonomo (2011-08-01 14:16:34)

Re: High-level architecture advice for a student-teacher-q&a web app

Hello,

I'm pretty new to programming so take what I say lightly.
1. Would it make sense to make a reference to a class or course in the QUESTION_TABLE? That way you can query on that when the teachers have to pick a question to present to their class?

2. Should course_id be class_id in the ENROLLMENT_TABLE? or is

Re: High-level architecture advice for a student-teacher-q&a web app

Not really: start doing it.

If you have no ruby programming experience it would be beneficial to play around with ruby until you feel pretty comfortable -- so that later you won't be distracted by syntax and basic concepts (modules, classes, methods (class and instance), basic object types (like hash, array, etc), most common control structures and the like).  No need to be an expert but a solid foundation helps.

I'm sorry to say but chances are you have to trash your first project(s) -- it's absolutely normal, especially if you have little background.  So build sandboxes for many things that you want to do and get comfortable again.  Build little stuff each time, and make it work (things like the first RoR app should it do anything with one or two models, understanding how has_many-belongs_to works (models, controllers), understanding partials, understanding the not-absolute-basics-but-a-little-more of activerecord, etc.).  Don't be afraid to ask questions but before you do make sure you read the manuals (e.g. at guides.rubyonrails.org) and do your due diligence with google: there're lots of good sources all around.  (BTW: I suggest that you use ruby 1.8.7 and Rails 3.0.x -- this is perhaps the combo with both enough edge and enough community experience.)

Then start building your app -- again little by little.  Make a small set of functionality work and only then go on.  It doesn't have to be perfect, you can always come back to any part later.  Leave the beautifying for later: it takes a lot of time unless you're very experienced and has little to do with architecting the app.  It's a lot of fun to see how it gets a shape; I've done it umpteen times and still it is.

The most important advice: Have fun all the way.

Re: High-level architecture advice for a student-teacher-q&a web app

Hi Finges and Boomerang.  Thanks for your responses to my post.  I'm sorry it has taken me a few days to reply -- I meant to write as soon as I had made some good progress on my application, but I haven't yet felt far enough along.  I did think about the decision on whether to use Ruby 1.9.2 or 1.8.7.  I guess I can still switch, since I don't have anything permanent that I've coded.  I think I'm going to stick with 1.9.2 because the book on which I will be relying heavily (Ruby on Rails 3 Tutorial by Hartl) uses 1.9.2 as part of the configuration it assumes.  I guess I also have a mentality that prefers the newer version numbers since I figure they must be improved in some way.  I've noticed in the past that being too fast to upgrade has been a source of weakness in my programming, but since I'm starting everything out fresh here and 1.9.2 is well established (if not widely prevalent), is there some particular reason why 1.8.7 would be a better choice?  I guess the main concern I have would be some extensive libraries that are crucial for something or other, but are only available in 1.8.7.  If it is just a matter of the syntax, then I'm assuming 1.9.2 will be more widely used down the road, so I may as well learn that if I'm going to start fresh with Ruby.

Finges -- I think you're right that the Question table seems a bit disconnected from the other tables.  Perhaps I haven't fully thought through how my application is going to work.  I think that I do want to associate questions with courses.  At the same time, I want the questions to be a set unto their own to which more questions can easily be added.  I'm envisioning that questions will be reused, so a single questions may appear in dozens of courses.  I think what I need is a "staging area," which I guess would be a course+question table which would consist of the questions that have been selected for a particular course.  So maybe I should add something like:

COURSE_QUESTION_TABLE: course_id, question_id

(This makes me think of the nuisances that are undoubtedly going to arise when someone wants to remove a question from a course after some student has already answered it and various statistics have been calculated, but I guess I'll cross that bridge when I get to it.)

Thanks for the feedback so far.  Any advice you can give me on how to build sandboxes would be much appreciated.  That sounds like a good idea, but I'm not familiar enough with the Ruby on Rails ecosystem to have much in the way of particular ideas on how to go about that.  I am using git for my version control and am going to be learning that along the way as well.  It does feel like a steep learning curve, actually.