
 
not applicable if a programming assignment does not 
compile and run to produce an output. In this case, 
no matter how the assignment is good it will receive 
a zero mark. Moreover, using dynamic-based 
approach does not ensure that the assignment 
producing correct output is following the required 
criteria. Examples of dynamic-based systems are 
Kassandra (Von Matt, 1994) and RoboProf (Daly & 
Waldron, 2004). 
The semantic similarity-based (SS-APAG) 
approach overcomes the drawbacks of the dynamic-
based approach. Using this approach the grading of a 
student's program is achieved by calculating 
semantic similarities between the student's program 
and each correct model program after they are 
standardized. This approach evaluates how close a 
student's source code to a correct solution? 
However, this approach can become expensive in 
terms of time and memory requirements if the 
program size and problem complexity increase. ELP 
(Troung et al., 2002) and SSBG (Wang et al., 2007) 
are two examples of this approach. 
The graph based approach is a promising one 
which overcomes the drawbacks of other 
approaches. This approach represents source code as 
a graph with edges representing dependencies 
between different components of the program. 
Graph representation provides abstract information 
that is not only supports comparing source codes 
with lower cost (than semantic similarity approach) 
but also enables assessing source code quality 
through analyzing software metrics. Comparing 
graph representations for two programs is done on 
the structure level of the program. This approach has 
been applied in two different ways: graph 
transformation such as in (Truong, 2004) and graph 
similarity such as in (Naude, 2010). 
3 METHODOLGY 
eGrader can efficiently and accurately grade a Java 
source code using both dynamic and static analysis. 
The dynamic analysis process is carried out using 
the JUnit framework (Massol & Husted, 2003) 
which is proved to be effective, complete and 
precise. It provides features that do not only ease the 
dynamic analysis process but also makes it flexible 
to generate dynamic tests for different types of 
problems in several ways. 
 The static analysis process consists of two parts: 
the structural-similarity which is based on the graph 
representation of the program and the quality which 
is measured by software metrics. The graph 
representation is based on the Control Dependence 
Graphs (CDG) and Method Call Dependencies 
(MCD) which are constructed from the abstract 
syntax tree of the source code. From the graph 
representation, structure and software metrics are 
specified along with control structures’ positions and 
represented as a code which we call it Identification 
Pattern. The result of static analysis is the output of 
the matching process between students’ 
identification pattern and models’ identification 
patterns.  
3.1 Identification Pattern 
The identification pattern is a representation of the 
structure and software engineering metrics of a 
program. The structure is presented in the 
identification pattern based on the program tracing 
(without executing it) starting from the main 
method. The structure and software engineering are 
two major components of any identification pattern. 
3.1.1  The Structure Component 
Table 1: Basic Categories and Controls of the structure 
component of the identification pattern.
 
Basic 
Category 
Code Control Code 
Conditions 1 
if_statement 1 
elseif_statement 2 
else_statement 3 
switch_statement 4 
case_statement 5 
General_statement * 
Loops 2 
for_loop 1 
while_loop 2 
dowhile_loop 3 
General_loop * 
Method 
calls 
3 
Recursive method call  1 
Non recursive method call  2 
General_method_call * 
Exceptions 4 
try_block 1 
catch_block 2 
finally_block 3 
General_block 4 
The structure component consists of several sub 
components represented with a mask of digits. Each 
sub-component represents a control structure or a 
method call in the program structure. Each sub-
component is composed of three types of codes: 
basic category, control and position.  
 Table 1 shows the code representation for basic 
categories and controls of the structure components. 
eGRADER - The Programming Solutions' Grader in Introductory Java Courses
37