CPSC 231: Assignment 3
Tabs and Spaces
MARKING RUBRIC


Table 1: Marking Rubric table for assignment 3. References functional and non-functional requirements given below. Not the use of positive marks for functional requirements and negative marks for non-functional requirements.
Functionality Criteria Value Assessment
+t correct, full functionality (passes all 5 of the "B" requirements) 1.0
passes at least 3 of the "B" requirements 0.7
implemented, but not correctly 0.3
-t correct, full functionality (passes all 4 of the "C" requirements) 1.0
passes at least 2 of the "C" requirements 0.7
implemented, but not correctly 0.3
+v correct, full functionality (passes all 3 of the "D" requirements) 1.0
passes at least one of the "D" requirements, may to ">>" instead of ">>\t" or "IP" instead of "IP\n" 0.7
implemented, but not correctly 0.3
-v correct, full functionality (passes all of the "inverse-D" requirements) 1.0
passes at least one of "inverse-D" requirements 0.7
implemented, but not correctly 0.3
command line & help correct, full functionality (passes at least 8 of the "A" requirements) 1.0
passes at least 4 of the "A" requirments 0.7
implemented, but not correctly 0.3
program logic (-ve) All NF-1 requirements done well
0
All NF-1 requirements done, but with reservations -0.3
At least one NF-1 requirement done, or both with serious reservations -0.7
NF-1 requirements done poorly or reflecting poor understanding of program decomposition
-1.0
Special assessment: no student-written functions (no program decomposition = fails NF (main) 2 requirement)
This assessment is counted independently of the main assessment in this category, and summed as a separate category.
-2.0
program style (-ve) All NF-2 requirements done well 0
At least 5 NF-2 requirements done well
-0.3
At least 3 NF-2 requirements done well -0.7
Less than 3 NF-2 requirements done well -1.0
Total

Mark (Max=4.3)

Functional requirements

A.  Command-line interface requirements

  1. Qualifiers +t and -t are incompatible.  If both appear on the command line, it is an error, and you should print "Qualifiers +t and -t cannot both be used together."
  2. Qualifiers +v and -v are incompatible.  If both appear on the command line, it is an error, and you should print "Qualifiers +v and -v cannot both be used together."
  3. If any argument on the command line is not recognized (whether it is prefixed by "-" or not), it is an error, and you should print "Unrecognized argument: " followed by the not-recognized argument.
  4. The -T qualifier must be followed immediately by an integer.  If it is not, it is an error and the program should print out "The -T qualifier must be immediately followed by an integer: -Txxx", were "xxx" is the offending text.
  5. The integer given after the -T qualifier must be between 2 and 8 inclusive. If it is not, it is an error and the program should print out "Tab sizes greater than 8 or less than 2 are disallowed : -Txxx", were "xxx" is the offending integer.
  6. If there is an error on the command line (see points 1 to 5), then the program should not run.  But ALL error messages (from points 1 to 5) should be printed, then the following helpful information should be printed:
    Synopsis:
       tabs [+t] [-t] [-T<integer>] [+v] [-v] [-help]
         +t    -replaces prefix sequences of spaces of length T with a single tab 
         -t    -replaces prefix tabs with sequences of T spaces
         -T<integer> -the <integer> defines the space-to-tab ratio, T (default=4) 
         +v    -changes all spaces, tabs, and newlines to printable (visible) characters 
         -v    -undoes the effects of +v 
         -help -prints out this help text 
      +t and -t are incompatible 
      +v and -v are incompatible 
  7. If the ONLY command-line qualifier is -help, then the program should print the help text and exit.
  8. If NO command-line qualifiers are present then the program just echos it's input to output.
  9. The -help qualifier will be recognized in any case (all caps, all lower, or any mix) and may be abbreviated -h, -he, or -hel (in any case).  There is no abbreviation or case tolerance for any of the other qualifiers.

B.  +t requirements

  1. Space replacement occurs ONLY on the indenting white space on a line, and stops as soon as the first printable character is encountered.
  2. Tab stops are based on the -T<integer> qualifier which defaults to -T4.  
  3. Tab stops are treated like tab stops: it's not the case that you can simply replace all sequences of N spaces by a tab.  For example, assuming -T4, the line "<space><space><tab>pass" will become "<tab>pass".
  4. Extra spaces at the end of indentation sequence should be left there.  For example, assuming -T4, the line "<space><space><space><space><space><space>pass" will become "<tab><space><space>pass".
  5. It is not necessarily true that a -t operation applied to a file followed by a +t operation applied to the resulting file will result in the original file and output being textually identical.  However this sequence WILL yield textually identical files if the original file was indented using tabs only.

C.  -t requirements

  1. Tab replacement occurs ONLY on the indenting white space on a line, and stops as soon as the first printable character is encountered.
  2. Tab stops are based on the -T<integer> qualifier which defaults to -T4.  
  3. Tab stops are treated like tab stops: it's not the case that you can simply replace all tabs by a sequence of N spaces.  For example, assuming -T4, the line "<space><space><tab>pass" will become "<space><space><space><space>pass". 
  4. It is not necessarily true that a +t operation applied to a file followed by a -t operation applied to the resulting file will result in the original file and output being textually identical.  However this sequence WILL yield textually identical files if the original file was indented using spaces only.

D.  +v requirements

  1. All space (ascii 32) characters will be replaced by a "·" (ascii 183) character.
  2. All tab characters will be replaced by a "»" (ascii 187) character, followed by a real tab character (to preserver formatting).
  3. All lines should end with a "¶" (ascii 182) character, followed by a real newline character (to preserve formatting).

E.  -v requirements

  1. -v should exactly undo all formatting done by +v.

F.  functionality interaction requirements

  1. Assume file F has been processed by a +v operation.  A -t or +t operation acting on a file F should produce output identical to file F.  However, if a -v qualifier is also included on the command line, the output should be as if F had never been processed with the +v qualifier.

Non-functional Requirements (NF)

  1. Your program must be written in Python 3 and function properly on the UNIX machines in the CPSC undergrad lab.
  2. This assignment is about functions and program decomposition, so besides your main function, and the getInput() function (given below), it is expected you will create AT LEAST 4 other functions (at least one function for each or the -v, +v, -t, and +t functionalities).  (The instructors' solution makes use of 8 additional functions, which is not to say that yours should necessarily use 8 -- it could use more or less.)

NF-1. Program logic

  1. Logical decomposition into functions
  2. Main program coded as a main function (called from outer code)

NF-2. Program style

  1. Used global constants
  2. Did NOT use global variables
  3. Meaningful variable and function names
  4. Correct variable and function name style (starting with lower case letter, camel case or lower case with underscores)
  5. Appropriate while space for readability
  6. Appropriate in-line commenting
  7. Appropriate function comments or doc-strings
  8. Appropriate file header comment or doc-string