Do not repeat yourselves or DRY way of working with AMC
Version 1 (Pieter Van den Hombergh, 01/19/2013 12:06 am)
1 | 1 | h1. Do not repeat yourselves or DRY way of working with AMC |
|
---|---|---|---|
2 | 1 | ||
3 | 1 | I am from a object oriented software engineering school and one main principle if OO is do not repeat yourselves (DRY principle), that is, |
|
4 | 1 | optimize your design in such a way that you do not duplicate (your work on) anything. |
|
5 | 1 | Some people could say it is a way of being lazy, which is fine by me, as long as you compensate that with sufficient cleverness. |
|
6 | 1 | ||
7 | 1 | The way I use AMC in multiple courses is a follows: |
|
8 | 1 | ||
9 | 1 | I keep all questions in separate files, organised by course as subject. |
|
10 | 1 | I also keep them in a version control system. At the moment that is subversion. |
|
11 | 1 | ||
12 | 1 | Say I teach course LNX, MOD and SEN. |
|
13 | 1 | Then for instance the my directory structure looks a lot like this. |
|
14 | 1 | <pre> |
|
15 | 1 | ||
16 | 1 | âââ lnx |
|
17 | 1 | â  âââ exam |
|
18 | 1 | â  âââ builds |
|
19 | 1 | â  â  âââ 20110624 |
|
20 | 1 | â  â  âââ 20120627 |
|
21 | 1 | â  âââ questions |
|
22 | 1 | â  âââ chap1 |
|
23 | 1 | â  âââ chap2 |
|
24 | 1 | â  âââ chap3 |
|
25 | 1 | â  âââ chap4 |
|
26 | 1 | â  âââ chap5 |
|
27 | 1 | â  âââ chap6 |
|
28 | 1 | â  âââ chap7 |
|
29 | 1 | âââ mod |
|
30 | 1 | â  âââ exam |
|
31 | 1 | â  âââ builds |
|
32 | 1 | â  âââ questions |
|
33 | 1 | âââ se |
|
34 | 1 | âââ exam |
|
35 | 1 | âââ builds |
|
36 | 1 | âââ questions |
|
37 | 1 | </pre> |
|
38 | 1 | ||
39 | 1 | I keep the question below the questions directory as in lnx/exam/questions/chap1/cmdline1.tex, which contain the normal |
|
40 | 1 | amc *question* and *questionmult* environments. I prepare the questions with a normal editor (I normally use _emacs_, yes, I am already that old). |
|
41 | 1 | ||
42 | 1 | For each exam that I build from this I create one *exam.tex*, one *questions.tex* and one *students.csv* file in a sub directory specific to the exam instance or exam event. |
|
43 | 1 | I have the convention to use date in short iso8601 format, so 20120627 would be for the exam on 27th of June 2012. |
|
44 | 1 | ||
45 | 1 | The *exam.tex* file defines all the things that describe the exam and these details are put mostly on the frontpage of each exam. |
|
46 | 1 | Think of date, time of the exam, target group, subject title, teachers name and such. |
|
47 | 1 | ||
48 | 1 | The *questions.tex* file is a more or less simple file with one line specifying the question and the AMC-element group. (the element group is what AMC uses to randomize the question order.) A questions.tex file for a tyical exam contains 30 or 40 such lines. |
|
49 | 1 | A line looks like this: |
|
50 | 1 | <pre> |
|
51 | 1 | \element{general}{\inputQ{lpic101-101-1/o004.tex}} |
|
52 | 1 | </pre> |
|
53 | 1 | Keeping the questions separate from the exam file ease a the way to create it, for instance from an spread sheet or a database query and also eases the comparison of earlier exams, |
|
54 | 1 | so one can easily see if there is not to much overlap in questions for instance for a resit of an exam with (a subset) of the same audience. |
|
55 | 1 | ||
56 | 1 | The *students.csv* file contains the id's and names (and I my case also the exam language) for the participating students. |
|
57 | 1 | ||
58 | 1 | I can run (and do it for testing purposes of the exams) pfflatex on the *exam.tex* file, but for a real production I use the MC-projects directory and the AMC gui to do all the |
|
59 | 1 | nice things that AMC provides. |
|
60 | 1 | ||
61 | 1 | To make this work I use a symbolic link *source.tex* pointing to *exam.tex* the tree explained above, for instance in the lnx exam that would be |
|
62 | 1 | <pre> |
|
63 | 1 | hom@threehundred:~/MC-Projects/lnx_20120629 |
|
64 | 1 | $ ls -la |
|
65 | 1 | . |
|
66 | 1 | . |
|
67 | 1 | source.tex -> ../courses/lnx/exam/builds/20120629/exam.tex |
|
68 | 1 | </pre> |
|
69 | 1 | but you could point anywhere. |
|
70 | 1 | To make sure AMC (or more precisely, pdflatex) can find the files to link and include I define a few macros that help latex. |
|
71 | 1 | These macros are |
|
72 | 1 | <pre> |
|
73 | 1 | \def\CourseDir{/home/hom/fthv/lnx/exam} |
|
74 | 1 | \def\QuestionBaseDir{\CourseDir/questions} |
|
75 | 1 | \def\ExamInstanceDir{\CourseDir/builds/20120629} |
|
76 | 1 | </pre> |
|
77 | 1 | ||
78 | 1 | *\CourseDir* specifies the course, the *\QuestionsBaseDir* should be obvious as is the *\ExamInstanceDir*. |
|
79 | 1 | Note that they specify absolute paths, so that pdflatex can find them, where ever your working directory and latex process directory is. |