anong ibig sabihin ng
"Automatically grading Java programming assignments"?
just use reflection, inheritance at regular expressions -- yan lng naman main requirements diba
implement the most basic uses ng bawat isa
inheritance:
sabi mo alam mo na to, just create objects na kailangan ng application mo -- extend mo ng konti (as needed) using classical inheritance
regular expression:
imbis na gumamit ka ng if else at looping constructs para mag-process/validate ng user string input -->> use REGEX instead
>>>> examples:
phone number format: 000-0000
date and time format: 30-01-2003 15:20
madami pwede ka pag-gamitan ng regex
reflection:
i don't know anything about reflection at hndi ako java programmer pero this example makes the most sense para sakin na walang alam sa java:
Isuru Jayakantha of StackOverflow said:
simple example for reflection. In a Chess Game, you do not know what will be moved by the user at run time. reflection can be used to call methods which are already implemented at run time.
http://stackoverflow.com/questions/37628/what-is-reflection-and-why-is-it-useful
Code:
public class Test {
public void [B][COLOR="#FF0000"]firstMoveChoice()[/COLOR][/B]{
System.out.println("First Move");
}
public void [B][COLOR="#FF0000"]secondMOveChoice()[/COLOR][/B]{
System.out.println("Second Move");
}
public void [COLOR="#FF0000"][B]thirdMoveChoice()[/B][/COLOR]{
System.out.println("Third Move");
}
public static void main(String[] args) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
Test test = new Test();
Method[] method = test.getClass().getMethods();
//firstMoveChoice
[B][COLOR="#FF0000"]method[0].invoke(test, null);[/COLOR][/B]
//secondMoveChoice
[B][COLOR="#FF0000"]method[1].invoke(test, null);[/COLOR][/B]
//thirdMoveChoice
[COLOR="#FF0000"][B]method[2].invoke(test, null);[/B][/COLOR]
}
}
insead of calling the methods directly using their names, pretend that you don't know they exist and use reflection to invoke them instead........
(in this example) -- reflection allows you to
inspect METHODS and CLASSES kahit hindi mo alam mga
names nila
yan reflection an agad yan lol
again, just implement the most basic uses ng bawat isa
make it neat and presentable at ok na ok na yan
dag dag ka mga comment explaining when u used them, examples:
// this helper function processes the user input and checks if it's a valid phone number using REGEX
// this is a method call to firstMoveChoice using RELECTION
// this class INHERITS from ........ etc etc
para mas malinaw sayo at sa prof mo na ginamit mo sila