Monday, 7 December 2009

Abstract Classes - nonsense behaviour?

I have improved the ExerciseClass a bit. An Exercise must have a button that the program can listen to. When clicking on that button, a function is triggered to calculate and submit the current result of the exercise.

If the class is correctly written that will allow for faster develoment when adding new classes to the program.

Sunday, 6 December 2009

SVN Problems

Note to self: enter the correct svn-repository address to avoid headaches, frustrations and anger:

Friday, 4 December 2009

Class Test Class

A Teacher should be able to create a test with a group of problems or exercises. I have thought some about that, and it looks like we can solve it in a nice way with our current inheritance-approach. If we let our test implement the ExerciseClass, we can use and acces it just like any other exercise from the sidebara-menu.
A standard exercise takes a string as a setting argument, so if we let our test take a comma-separated string as input with class-names and setting-strings, we can create exercise instances within our test. A nice way to do this would be with dynamic class loading, Reflection, but that is not fully compatible with GWT.. and there is some drawbacks too. Dynamic classloading would probably decrease the code modifications to zero when new exercise-classes is to be added. We will have to solve the problem in a more static way, but with a nice code-layout it should be very clear where to manually add code for new exercises.

A test displays its exercises one at a time, stores the results from the individual exercises and uploads a testresult once the test is completed. A simple 'exercise' can be used to generate parameters for tests.

An idea that I want to think more of, is that all settings and statistic functionalities should be accessed like exercises, and the type of the user should determine which options that show up in the sidebar. Admins should see statistics and settings, teachers should see test generators and users should only see the exercises.
This way of constructing the site is similar to how facebook is built up, just a shell with applications for everything but the basic functionallities. The users decides what applications to see and use.

Tuesday, 1 December 2009

Text problems now online

Text problems are now online. I have created a TextExercise-class, so textproblems now behave just like all other types of exercises.
Support for the previously mentioned TextProblemSets is not yet implemented.

Notes on Sudoku:
I create lists containing all the elements in a row, column or square, and then check if all numbers from one to nine occurs in all those lists. Selecting lines or columns in two for-loops are pretty straightforward, however squrares are more difficult. This is how to select a square given a sudoku-matrix, if i is square number from 0 to 8 and j goes from 0 to 8 you get:

int row = (i / 3) * 3 + j/3;
int col = j%3 + (i%3)*3;

Text Problems now in (not online yet)

Text problems are now working. There are two kinds of such problems: one involving random variables and a numeric answer, and one simply a question/answer type problem. Both of these are supported by the same class, and both problems support solution comments, and a TextProblemSet object can be stored in the database, thus making it easy to add new problems from the web, for instance.
What really happens is that a TextProblemSet contains all of the problem strings, and when one wants a new problem, one can request one from the problem set. A random problem is chosen, and then a TextProblem itself is created with those strings. The TextProblem will take care of randomising numbers and computing the result by parsing and computing the supplied formula (if it is a numerical problem).
My original intention was that we should create TextProblems, and store these, but the way it tuned out might actually be better. We add problems to the TextProblemSet, which is kind of a database, that can spawn TextProblems.