0

After searching almost 3 days on the web I decided to post on here because I can't seem to find it on my own. My skills in Visual Basic are quite limited but I am learning.

My goal is to write a program that is able to analyse tests kids make in highschool. I have the first version done in VBA which works well, but I want to create something that does not depend on Excel hence the .NET version I am working on.

The way I see it I need to completely specify a test first. The year, the level, the amount of questions, the maximum score per question and a way to specifiy which of the questions belong to which chapters/skills. (For example, for my physics classes the chapters could be electricity/forces/pressure and the skills could be reproducing/insight/usage of formulas etc. The user should be free to specifiy these and later select which question belong to electricity, forces etc.)

After that there has to be a possibility to add a class to score every student on every question. It has to be possible to add more classes to one test, since it happens that several classes make thesame test. I can import the classes through xml since they can be generated from our school data base.

The read out of all of this is still in the far future...

So far I have a form which has some comboboxes, some radiobuttens, a textbox, and textboxes/checkboxes generated during runtime.

I need to be able to save the settings the user puts in, as they will define all the parameters of the test. It is exactely this saving part that is troubling me. I am in doubt on which way to go.

I have seen that some people use the my.settings way and save the settings in this manner. This seems like a nice option although I will have to research a bit into how to implement this with the dynamically generated text boxes and checkboxes.

On the other hand I have been experimenting with saving everything to one .xml file. I don't know if the .xml file format is handy for this sort of thing, it would have to contain tables of the scores, control values etc. If it is possible to have everything that I want in one xml file (test parameters and test results of no matter how many classes the user wishes to add) then that would be amazing. On the other hand, the my.settings seems like a simpler way to save settings, but then I would have to settle for a seperate .xml file that contains all the score data which the user would have to load into the program. I hope all of this makes sense...

Is there any sort of advice anyone can give me? Not really asking on how to code all of this, just struggling with the structure of how I wil implement the save and load functions of the app. If I can get that (save and load user input) it would start me off, but I am afraid to start the wrong way.

Thanks :-)

EDIT:

A bit more light on what I want to achieve:

Kids make a test on paper.

*Teacher puts into the program the name of the test.

*Teacher puts into the program the amount of questions.

*Teacher puts into the program which chapters the test includes, and which skills (e.g. "Forces" or "WWII". Skills could be "Grammar" or "using formula's"). These skills and chapters are entered in textboxes and output to a label.

*Teacher puts in the maximum score per question.

*Program generates a row with checkboxes after every label. Amount of checkboxes corresponds to the amount of questions.

Output could be something like this for a test with 9 questions

Forces □ □ □ □ □ □ □ □ □

pressure □ □ □ □ □ □ □ □ □

etc. (The textboxes might even be generated in a table... that might be more easy to retrieve :-)

*Teacher selects the checkboxes of the questions that belong to the category of the label in front of it.

After this is done, the test configuration is completed. This means the control values have to be saved. The challenge for me here is to load the values back since almost all the checkboxes were created in run time.

Next step for the teacher is to load a class into the program. The classes are available in xml format and I was able to import them into a datagridview to enter the points per student per question.

The classresults should be able to be saved, and indeed it seems more handy to not add them all to the test configuration file, but to have them as seperate files in a folder. The program could generate this folder without users knowing about it. I listbox with classes already added to chose from would be nice.

Then the read out of all this is supposed to be a diagram. First the teacher selects the class, after that the student from a pull down menu. Final result should be a diagram showing in percentages how the kid did on every category that the teacher specified in the first steps.

I have this whole thing working in VBA and it looks pretty slick. I found the programming of it so much fun that I decided to try and have a go at a .NET version :-)

1 Answers1

1

As this is a very open question I'm not sure if you can use my answer. But I'm willing to give it a shot.

First of all My.Settings is a VB option, which is unavailable for C#. So if you ever wanted to port your solution to C# this will make things difficult. Secondly My.Settings is just a easy overload of working with App.Config file. As you may already understand My.Settings is meant to be used for configuring your application. What you're asking is not really configuring, although the dynamic textboxes are in a gray area.

Nevertheless my gut feeling tells me My.Settings is not the way to go.

The file format (xml, json, text, binary, database, whatever) is actually not that interesting. I think the design is far more important.

If I understand correctly you have a dynamic setup of testing the students. While the framework for testing is the same for all kinds of questions?! Namely a test with multiple questions for which the answer are predefined. But not all (type of) tests will be loaded in a single go, let alone, all students will be loaded during a single test?! So storing all this information in a single file sounds pretty strange to me. Take in mind what will happen if the application will grow and you would have a single file: This would be real issues (and there are a lot more!!): - You loose the single file! - The single file would get corrupt - The single file would grow to a size when it will take several minutes to load - Multiple users are saving (or loading) information at the same time. How would you prevent this and even more challenging control this?

I would design the application around a bunch of SOLID classes (poco objects):

  • A class defining the test (from this you can generate your input form)
  • A class defining a single question (with reference to the test)
  • A class defining the class
  • A class defining the student (referencing the class class :-)
  • A class defining the result per question (therby referencing the student and question)

With this setup you simple serialize the classes to a file format of your choosing and store them in a strcutured way. You will probably have to think about a naming convention and/or directory structure. You let the user not open these files themselves, through windows explorer or something, but let the use case of your application decide which file needs to be loaded.

I prefer to use json as it is so simple to use, especially with the use NewtonSoft json serializer which you can pull into your solution from NuGet.

After typing all this, I think when your goal is as big as you describe you should directly start by using a database. With Entity Framework Code First and SQL local db this is easy enough to do. It will than give you all the benefits of querying and is easy to port to a SQL server in case the application would become big.

Community
  • 1
  • 1
Ric .Net
  • 5,540
  • 1
  • 20
  • 39
  • Hi Ric, this answer is more than I could have hoped for. I will defenately check out your suggestions and read up on the links. Thanks for that! I edited my OP since I think the idea was not completely clear should you be interested to read it. Thanks again :-) – Jordi Ollebek Feb 09 '15 at 17:40
  • I read your edit. Sounds like a good design. It does not change my answer though. I think you really should use a database, because files are just files. Especially your graph requirements need querying, which is much much easier using a database. – Ric .Net Feb 10 '15 at 13:37
  • And if you like my answer, you could Always accept it and/or upvote :-) – Ric .Net Feb 10 '15 at 13:37