Monday, October 22, 2007

MyISERN-1.2

Project page: http://code.google.com/p/myisern-1-ivory/

All tasks have been completed.

This assignment is not a technical difficult one. All it needs is to read command line input in runtime and put it into data. There are many field in each of 3 objects and adding codes are very similar, but not similar enough to use some methods to group them all. Though we can divide our job by different input part, we cannot divide it into different file. So this comes the first time we try hacking into the same file in the same time, but with different part. Though we try our best to not modify any codes in others part, we still get a commit error. At last, I have to put my partner's hacking by copy and paste into my code to make it a whole.

After built the first runnable version, we got lots of bugs and fixed them. One of the most critical bug is cause by Java's parameter passing mechanism. When doing input in multi value fields, it comes out to input a List of String, so we use a method to deal with all these fields. At first, we send the original one as parameter, and try modify it directly inside the method, but the result came out to be incorrect. Then we found out that is because we use the expression like currentList = inputList. Later we change it to return the result List of String and it finally work well. This is because Java pass the parameter by pass the pointers of the object by value, not the object itself. So we doing currentList = inputList, it actually change the value of the pointer passed from parameter, but not the original object. Now I know that if we need to modify the object from parameter to a new one, we need to use the method within the instance, not the "=".

During the next milestone, we will probably add more help and make input more convenient.

No comments: