Rubrics
A rubric defines how student code is evaluated in an assignment or challenge.
Why rubrics exist
Programming assignments are rarely judged by only one factor.
A good solution should consider multiple aspects such as:
- Correctness
- Code quality
- Complexity
- Security
- Performance
Rubrics allow professors to combine all these aspects into a structured evaluation model. This makes grading more transparent, consistent, and focused on learning.
How rubrics work (high-level)
A rubric is composed of:
Assignment / Challenge
└── Rubrics (weighted)
└── Tests (weighted)
└── Score
- A piece of content (assignment or challenge) contains one or more rubrics.
- Each rubric contains one or more tests and a weight.
- Each test produces a score between 0 and 1.
- Scores are combined using weights to produce the final grade.
Rubric structure
Each rubric contains:
| Field | Description |
|---|---|
| Title | Short name of the evaluation criterion |
| Description | Explanation of what students should aim for |
| Weight | How much this rubric contributes to the final grade |
| Tests | The automated checks that evaluate this rubric |
Rubric weights and grading
Rubrics determine how much each aspect contributes to the final score. A student’s final grade is calculated as the weighted sum of rubric scores. The sum of all rubric weights must equal 100%.
Example:
| Rubric | Weight | Score |
|---|---|---|
| Correctness | 50% | 100% |
| Code Quality | 20% | 80% |
| Complexity | 15% | 90% |
| Security | 15% | 70% |
| Final Grade | 90% |
Final Grade = (0.5 * 1.0) + (0.2 * 0.8) + (0.15 * 0.9) + (0.15 * 0.7) = 0.9 (90%)
Tests inside rubrics
Rubrics do not directly evaluate code. Instead, they contain tests that automatically check specific conditions. The rubric score is calculated from the combined score of its tests.
Examples of tests:
- Output matches expected result
- Unit test passed
- Cyclomatic complexity within range
- No critical vulnerabilities detected
Each test has its own weight inside the rubric, controlling how much it contributes to the rubric score.
Example rubric
- Title: Apply good coding practices
- Description: Keep functions small, follow code style conventions and avoid security issues.
- Weight: 100%
Tests inside the rubric:
| Test | Metric | Range | Type | Weight |
|---|---|---|---|---|
| Complexity Test | Average Lines of Code per Function | 5–50 | Lower | 30% |
| Security Test | Number of vulnerabilities | 0-3 | Lower | 30% |
| Unit Test | my_unit_test | N/A | N/A | 40% |
This rubric evaluates 3 aspects with custom weights.
- Whether students keep their functions concise and readable.
- Students must have 5 or fewer lines of code on average, to get the full score. Having more than 50 lines of code per function will result in a score of 0.
- Whether they avoid security issues in their code
- Students must have 0 vulnerabilities to get the full score. Having 3 or more vulnerabilities will result in a score of 0.
- Whether they pass a specific unit test
- Students must pass the unit test to get the full score. Failing the test will result in a score of 0.
The final score of the rubric is calculated as the weighted sum of the test scores.
Rubric Score = (0.3 * Complexity Score) + (0.3 * Security Score) + (0.4 * Unit Test Score)