RHODES UNIVERSITY


Computer Science 301 - 2013 - Programming Language Translation


Preliminary to the examination

As you may have noticed, there are currently some 5000+ students writing examinations at this University. As you can imagine, some considerable effort is required of the academic staff to assess the some 25000+ examination scripts that will be generated by these students - something that has to be done under extreme pressure to enable the results to be released in time to spoil the holidays of some students and delight the parents of some others. What you may not know is that a crucial part of this process - and one that has to be accomplished over a period of only two or three days immediately prior to the release of results - is an analysis by the Deans of the Faculties of the collated results, so that students who are to be excluded, congratulated, awarded degrees, put on probation and so on can be identified and their results annotated with these decisions.

Over the years Yours Truly has been instrumental in designing computer programs to help with this "Dean's Analysis". For some years this has taken the preparation of a huge text file of summaries for each student, on the lines of that illustrated below. These files can run to over 800 pages of closely printed small text.

Fayled-Badleigh, HE  10L9876 BSCS 3 (3)  39.0 Pts 14 s/crs (Fails G7)

  INF 301 1 4207301 Information Systems 301           2B  61
  INF 302 2 4207302 Information Systems 302           2B  65
  CSC 201 1 5101201 Computer Science 201              F2  38
  CSC 202 2 5101202 Computer Science 202              DPR
  MAT 1C1 1 540101A Mathematics 1C1                   F1  48      F1 or F1S ?
            Passed 2/5 courses outright.  Average mark  42.00  Weighted  42.0
  +++++++++ OVER HALF THE COURSES FAILED +++++
            Full firsts 0, Full upper seconds 0, Full credits 1, Full F1 0, AEG 0, Supps 0, DPR 1
  +++++++++ On probation - READMIT AP: MUST COMPLETE BSCS 2 IN 2012

  Has ACC 101 2A  ACC 102 3   CSC 101 3   CSC 102 3   ECO 1   ACR ECO 101 3
  Has INF 2   ACR INF 202 2A  MAN 101 2B  MAN 102 2B  PHY 1E2 3   STA 1D  3

   1 Acc  ** CSc  ** Eco  **         Man  ** St1D  * PhyE  *  (10)
   2                         Inf  **                          ( 2)
   3                         Inf  **                          ( 2)

More recently the program that produces these summaries has also tried to assess or predict a set of actions for each student that the Deans will recommend to their Faculty Boards for approval. In principle this is not too difficult - after all, students who are deserving of congratulations are easily identified, as are those who, sadly, have failed too many courses to be allowed to return.

In practice, one has a maintenance nightmare. Hard-coding the criteria that apply (differently) to each degree, each year of study, each faculty, into a program that now runs to many thousand lines of C# code, demands the attention of a grey haired retired programmer, who may not always be available for last minute, dangerous hacks to the code. So this ASP (Ancient Skilled Programmer) has recommended that the Deans be asked to draw up a specification of the actions that should be applied to the students in their Faculty, on the lines of the following example (found in the file criteria.1 - more examples are to be found in your "kit"):

  Humanities
    FirstYear :
      Exclude : Total_Credits < 2 and (Average < 40.0 or DPR >=2);
                Lowest_Mark < 10.
      Merit_List :
                Average > 75 and Lowest_Mark > 60 and Year_Firsts >= 2 and Fails = 0.
    ThirdYear :
      AP_Complete_In_One :
                Total_Credits < 10.0 and Years_Here > 3.
    AnyYear :
      Congratulate :
                Weighted_Average > 90.0 and Fails = 0.

This specification can act as input to a converter program that will read it and construct a C# method (or an equivalent Java version, which would be fairly similar) on the lines of the following:

  class ActionSetBuilder {

    public static void BuildSet(Student s, OutFile logFile) {
    // Build up a set of numeric tags for Student s based on an analysis of his or her record
    // logFile may be used to record problems, results, anomalies (none demonstrated here).
      s.actions = new IntSet();
      if (s.academicYear == 1) {
        if (s.fullTotalCredits < 2 && (s.rawAverage < 40.0 || s.DPRthisYear >= 2))
          s.actions.Incl(10);
        if (s.lowestMark < 10)
          s.actions.Incl(10);
        if (s.rawAverage > 75 && s.lowestMark > 60 && s.yearFirstsThisYear >= 2 && s.failsThisYear == 0)
          s.actions.Incl(16);
      }
      if (s.academicYear == 3) {
        if (s.fullTotalCredits < 10.0 && s.yearsOfStudy > 3)
          s.actions.Incl(21);
      }
      {
        if (s.weightedAverage > 90.0 && s.failsThisYear == 0)
          s.actions.Incl(11);
      }

    } // ActionSetBuilder.BuildSet

  } // Class ActionSetBuilder

The method thus generated can then easily be compiled along with the rest of the source of the RAP (Result Analyser Program). If the criteria are augmented, or changed in some other way, then the revised specification file can easily be "recompiled" into C# code and then the complete RAP recompiled with the new method. Note that the Deans who design the criteria specifications do not have to be C# or Java programmers - they simply have to be able to write specifications in a simple, though rigid form, using identifiers that they would find published in a guide, with examples like the one just given. These identifiers, as can be seen from the example, correspond closely to fields in an object s of the Student class that will be populated from the university database as the the RAP is executed, passing each in turn to ActionSetBuilder.BuildSet(s, logFile).

The ASP can't complete this on his own in the time available. Only some 24 hours remain until the deadline, and so he has made you an Offer You Can't Refuse to join the team to help him.

It is suggested that, as an MYSP (Much Younger Skilled Programmer), you proceed as follows:

In adopting this approach you can (and should) make use of the files provided in the examination kit free1j.zip (Java version) or free1c.zip (C# version) which you will find on the course website. In particular, you will find

That should keep you busy for a few hours... In fact some of you may find that you RAP around the clock!

Have fun, and good luck!

(Although the actual system used by the Deans was written in C#, this whole exercise could all be done in Java or in C#, and you are free to experiment in either language).


Home  © P.D. Terry