Experience with Wicket
Monday, December 8, 2008
Wicket Experience With Existing Project
Experience with Wicket
Saturday, November 22, 2008
Display a Java Program on The Web Browser
Preparing for the Wicket
For using Wicket with your Java Project, I needed to download few tools below.
Jetty 6.1.9
Wicket 1.3.5
Slf4J 1.5.0
Problems Encountered During The Development
Setting environmental variables and classpath for this project was also as difficult as other project. I spent pretty much time to make sure program runs both on command window and eclipse environment. Also adding session to the project so that many users can using the stack project with their own session was challenge to me. I also had a small problem when I tried to display lastly pooped item on the screen. It was impossible to make a local variable and save popped item into that, because the java file renewed when any button clicked. So, I created a variable in the application java file and saved and retrieved the item from the application . By doing this, I clearly understood the why we need to have a application file when we using Wicket. The biggest challenging part was fix bugs from PMD. When I tried to verify the system, the PMD reported error for Jetty.java below:
All methods are static. Consider using Singleton instead. Alternatively,
you could add a private constructor or make the class abstract to
silence this warning.
I could not remove this warning for a while, and I finally added a method like below:
public void doNothing() {
System.out.println("Should not use this method");
}
ConclusionWicket is very useful tool when we need to run the application using Java and display the output of the program on the Web browser. I believe this was really good project to be done before doing duedates projects with Wicket.
Download Link
www2.hawaii.edu/~jeho/ICS413/stack-johnson-5.0.1124.zip
ICS Industry Day at UH Manoa
Final Thought
I am an international student and I found that most of companies are hiring only US citizen. Even though I am planning to go back to Korea after my gradution, it was really good chance to learn how the local companies doing in here Hawaii.
Monday, November 17, 2008
Continue Integration Practices With The Hudson CI Tool
Our group has been worked on modifying previous version of DueDates project from the last week. The new feature of this project is below:
- support "-console" option.
- support "-email" option.
- support "-wakeup" option.
Upgraded version of the program can be downloaded at below:
executable jar file : http://duedates-green.googlecode.com/files/DueDates.jar
distributed version of the project: http://duedates-green.googlecode.com/files/DueDates-1.2.1117.zip
Problems that our group went into during the development
Our group met 3 times last week to work together. We usually went each other's home to do pair programming. Most of the code work was done by my computer because we were little worried about conflict and merge the source files. When I ran -verify.build.xml before commit a small changes of source file, it was pretty easy to fix bugs from checkstyle, pmd and findbugs. However, it took really longer time to fix bugs when I tried to verify.build.xml before commit. Thus, I had hard time to decide a appropriate time for commit and verify.
About the Hudson CI Tool
Hudson CI tool helps users to keep their project healthy. Currently, information about our group project shows that our project is in bad healthy status. First of all, our group project has very low coverage rates. We need to increase the coverage rates before the next development. Also, the complexity of the program has increased through the week because we used many loops in the program. Except Coverage and Complexity, other status still looked good.
Friday, November 7, 2008
Experience with Software ICU
Churn
Size
Friday, October 24, 2008
Review Other Group's Code
DueDate project is currently developing by many groups. I and my partner have been developing the project from last week. The detail of the project is described here. This week, we are assigned to review other group so that we can interact with other group members.
What I Learned From The Review
This was not the first time to review other people's code, however, at this time I had much more chances to learn about the tools for review other project. The first thing I did for the review was make our project on google to be ready for review from other group members. We copied our original source codes into the tag directory for this step. By doing this, I and my partner can keep developing our project without worry other people. After that I started to review other groups' project. During the reviews on the other group's work, I realized that why the wiki pages and JavaDoc are so important to satisfy the prime objective 2 and 3. Fortunately, all groups that I reviewed had pretty well written javaDocs and wiki pages on google project and this helped me to understand their code easier and faster.
On the other hand, our group has six reviewer and we got many advices and comments from them. It was so good to show our work to other people so that we can get useful thoughts and advices because it will save us a lot time to fix our source by ourselves.
Conclusion
I learned and found many good things from reviewing other groups' project for the same project. I was also exciting to find various approaches and solutions to the same problem that I had hard time to solve.
Monday, October 20, 2008
Developing DueDate Project Using Google Project
Related Links:
Google Project address: http://code.google.com/p/duedates-green/
DueDate-green project executable jar file: http://duedates-green.googlecode.com/files/DueDates.jar
DueDate-green Project Developer Version:
http://duedates-green.googlecode.com/files/DueDates-1.0.1020.zip
For the pair programming, it was pretty hard to set up a meeting time for everyday. We could start pair programming after 2 days passed from the project released.
The preparation of the project also took more time than we thought. It was pretty challenge to me to set up correct classpaths in the build.xml. The new thing that I found through this project was that how the Google Project is efficient for the online based group development programming. Google Project has many tools and I liked the tools called Wiki and Issue. Wiki helps developers to write a instruction of the project more faster. Also, Issue tool helps developers to interact with other developers more efficiently.
For the programming part, I had hard time to figure out how to run the project with the eclipse because our classpath did not work perpectly. To solve this program I set up a class path in the 'Run Configuration'. By run the program on the eclipse, I could save a lot time to spent to type in the command.
Tips for the Pair Programming
Bring your eclipse in your Laptop and eclipse in your pocket for the pair programming!
Tuesday, October 7, 2008
Working with a partner on Google Code.
For how to create and use Google Projects, please see last posting. With Google project, the owner of the project can invite other member into the project using e-mail address. The invited person will become a member of the project once the person accept the request. After became a member of a project, all members can check out the source code and commit after they fixed the code. Owner can setup a
Download Partner's Code and Build
There is one important thing that we working on a team project using SVN client that we always need to check the source code passes the verify tests. This need to be done before commit a project and after updated a project. In this way, each members can start their improving of the project without worrying about other member's mistake. The owner of the project can also setup a mailing lists so that all group members will be notified when there is a new commit of the project or issues. To test the partner's project, I checked out a project from my partner's Google Project. After Downloaded, I ran "ant -f verify.build.xml" on his project but the build was not successful because there were some errors from checkstyle. Thus, I contacted to my partner and asked him to fix the original source code. He fixed his little mistake in a minute and I was notified by e-mail when he committed newer version of the project. I know this will be happen every day in programming job and this was really good experience for me as a programmer. After I finished my small improvements on the project, I checked "ant -f verify.build.xml" passes and committed my project. My Partner Tyler Wolff's project can be downloaded from http://code.google.com/p/stack-tylerwolff/
SVN Update
Before start the improving on the downloaded project, there is one more important thing to do that we need to update the directory so that make sure we have newest version of the project. Since I setup a mailing list with my project on Google, I also notified by e-mail when my partner committed my project. So, I updated my project directory using Tortose SVN client and ran verify and it passed. I could figure out what he changed by watching his commit message. My project located at http://code.google.com/p/stack-jeho/
Exploring the Google Hosting with SVN
Google provides a great open source development environment to users with free cost. Google also provides SVN server, Mailing lists, and Issue tracker. In order to access to SVN server, we need to install a SVN client program that will works on our operating system. SVN client program is so useful and powerful when we need to work on a network-based team project.
How to Install an SVN Client?
SVN Client can be downloaded from below depends on the operating system.
For Windows: http://tortoisesvn.net/downloads
For Mac: http://www.syntevo.com/smartsvn/download.html
I am a Window user, so I downloaded tortoiseSVN and all installation went smoothly. However, after the installation, tortoiseSVN requests users to restart the computer because the tortoiseSVN is a shell extension that means it is integrated into the Windows explorer. To use tortoiseSVN, we can open a Windows Explorer and right-click on any folder we like to bring up the context.
How to Modify an Existing Google Project?
In order to check out a project from Google Project, we need to be a member of a project at code.google.com. We can see a "SVN Check out" menu after open a Windows Explorer and right-click on any folder. The address I used to download the stack projece was http://code.google.com/p/stack-johnson/. After the Check out, the first thing we need to do is that make sure that the "verify" target passes. If the "verify" target passes, we are ready to fix the project. From given project, I found few checkstyle errors and fixed it. After the improving the original project, we need to "verify" target still passes so that other project members can keep developing after we commit the improved project.
How to Create a new Google Hosting Project?
In order to create a project on code.google.com, we need to have a Google account. Creating a new Google Hosting is easy to follow and pretty straightforward. We need to decide a project name, summary for the project, description, source code licence and Labels when we create a new project. After the creating a new project on Google, we can invite another member to the project. we can also using mailing lists when there is new commit or issue changes.
Wednesday, October 1, 2008
Exploring the limitations of test coverage
A BUG that inserted into Stack.java
I have been fixed the original Stack project so that the program passes all the automated QA tools and has 100% of coverage. My fixed Stack project, which has 100% coverage can be downloaded from here. I fixed toString() method that originally convert all elements in the stack into a string. the code I inserted is
return "[Stack [1, 2, 3]]";
This line simply return the string '[stack [1, 2, 3]]' no matter what is inside the stack. My JUnit test class checks toString() method after pushing 1, 2, 3. Therefore, there will be no error in JUnit test and coverage is still 100%.Writing a new test case to catch the bug
In order to find the bug in the source program, I had to fix the test cases so that JUnit reports the error. The fixed case is
@Test
public void testToString() {
Stack stack = new Stack();
stack.push(one);
stack.push(two);
stack.push(three);
stack.push(four);
assertEquals("Testing stack toString", "[Stack [1, 2, 3, 4]]",stack.toString());
}
This test case failed because the actural output "[Stack [1, 2, 3]]" did not match to expected out put "[Stack [1, 2, 3, 4]". This source can be downloaded from http://www2.hawaii.edu/~jeho/ICS413/stack-JUnit-Lab-jeho-6.0.930.zip
Lessons from Emma and JUnit
Although Emma and JUnit are great tools to find bugs and check expected out put of the source code, there still a posiblities that a code has logical bugs but can pass those tools. Therefore both Automated and Manual QA are still important and need to be checked together.
Tuesday, September 30, 2008
Testing Experience with Emma and JUnit
To become get familiar with testing tools such as Emma and JUnit. Also fix the Stack project so that the Stack project has 100% of coverage.
Improve Coverage
Emma is powerful tool that shows how many percentage of the original source code tested for expected output. Even the Stack project has fixed in order to pass the CheckStyle, FindBugs, JUnit and PMD tools, it had only 73% of coverage for method, 69% of coverage for block, and 75% of coverage for line on EMMA Coverage Report. In order to improve coverage on the source code, users can click the link for each class and Emma shows uncovered parts in red block. All fixed source file can be downloaded from http://www2.hawaii.edu/~jeho/ICS413/stack-jeho-6.0.930.zip
Added Test Cases
For testing toString method in the Stack class returns expected output:
assertEquals("Testing stack toString", "[Stack [1, 2, 3]]",stack.toString());
For testing EmptyStackException method in the Stack class returns expected output:@Test(expected = EmptyStackException.class)
public void testIllegalTop() throws EmptyStackException {
Stack stack = new Stack();
stack.top();
fail("Top of empty stack did not generate exception.");
}
For testing isEmpty in the ClearStack class returns expected boolean return value:assertSame("Testing for isEmpty",true, stack.isEmpty());
assertSame("Testing for isEmpty when it is not empty", false, stack.isEmpty());
For testing getTop throws EmptyStackException:@Test(expected = EmptyStackException.class)
public void testIllegalgetTop() throws EmptyStackException {
ClearStack stack = new ClearStack();
stack.getTop();
fail("Top of empty stack did not generate exception.");
}
Reflect on CoverageEmma is very useful tool because it automatically produce a report that shows which method or block need to be tested. The report was well organized and easy to understand. I believe improving the coverage of the original Stack project to 100% actually improved the quality of the system because I had to write additional test cases, which is actually needed to improve the quality of the system. I had little problem that the eclipse did not recognize other classes when I tried to change code with eclipse. This problem solved by clicking project - clean button and change the Java Build Path from /build/ to /bin/ .
Wednesday, September 24, 2008
Automated QA vs. Manual QA
Compare the results of Checkstyle, PMD and FindBugs to the Manual QA that is written by a classmate on the CodeRuler Project.
Automated QA vs. Manual QA
I got 644 errors with Checkstyle tools on my CodeRuler Project. Most of Errors occured because the original source files contain tap characters, which is not supposed to use when we coding. There were also few errors for the documantation because I did not make few comments for the Javadoc. I also did not used {}s for if statements and Checkstyle reported errors on this, too. PMD tools also reported on the same problem of my code that I did not used curly braces for if statements. On the other hands, there were no erros reported with FindBugs QA target.
I learned that I had many problems with correct coding style from Manual QA, too.
Conclusion
Automated QA is good for reporting more specific and detail information about the errors that the source code has, however, it takes time to write and edit ".xml" files for build and other tools. On the other hand, Manual QA is good for checking the flow of the logic in the source program. In conclusion, I believe we can always use both Automated QA and Manual QA for better programming.
Experience with Ant - Stack
This assignment was my firs time to using ant to build a system. I have some experience with Make build tool for other classes, which was pretty difficult to use. During the studying for Ant, I learned that I can download and use open source Java automated quality assurance tools(QA tools) such as FindBugs, Checkstyle, PMD, and etc. Each automated QA tools have own purpose and tasks to the source files and these functions are very useful when we build a system.
Installation
In order to use Ant build tools with JUnit, PMD, FindBugs, Checkstyle, and Emma, we need to download each QA tools from sourceforge.net. Since the Ant tools does not like spaces in the directory name, is is recommended to unzip into a directory without spaces. After the unzip all files into correct directory, it requires users to define environmental variables for each QA tools. It took about 2 hours for me to make all environmental variables and classpath works correctly. After set up all installation and environmental, finally we can try to run ant build system with stack project. The given targets was following
All of targets above was successful but the verify target was fail because the example provided contains few warnings with Checkstyle, JUnit, PMD, and FindBugs.
Using Stack as a Template to create a new Project
Create my own project from the provided example was pretty much straight forwarded and I did not encountered any problem during this step. The most important part of this step was that I edited the system.name property from "stack" to "stack-jeho" in the build.xml file.
Fixing the problems in Stack so that "verify" target passes the build
When I ran each QA tools for the stack project, it produced automated directories and report html files. All report html files were well organized and easy to read. It also displays the errors or warnings with correct source names and line number in the source file. To fix the problems that the original source has pretty easy. The most difficult part to fix was that fix the TestStack.java that has empty catch block because I did not know how to write a test that passes when an expected exception is thrown. After fixing all the problems reported by Checkstyle, JUnit, PMD, and FindBugs, I ran "ant -f verify.build.xml", which create a distribution zip file in the build directory. This file can be downloaded from here.
Monday, September 15, 2008
Code Review - Code Ruler
To identifying violations of Java coding and documentation standards.
To look at how the code perform the task in efficient and effective manner.
Reviewed code - Mari-Lee Flestado
File | Lines | Violation | Comments |
MyRuler.java | 1 | ICS-SE-Java-2 | Used wildcards"*" in import statements. |
MyRuler.java | 95 | EJS-5 | Code has wrong indent for "}" |
MyRuler.java | 12,13,14,* | EJS-8 | Used "hard" tabs. |
MyRuler.java | 109, 119 | EJS-9 | Did not use meaningful name |
MyRuler.java | 91 | EJS-61 | Used end-line Comment |
Summary
The entire documentation was understandable enough, except some missing JavaDocs for class and methods. During the excution of the CodeRuler, it constantly throws ArrayIndexOutOfBoundsException when the ruler has no castles. This is because the code tries to command to a castles which is not exists. Her strategy for peasants was same as mine which find a random direction for the next move and this works fine in the competition. Her strategy for knights has a small logical error that all knights actually try to only attack enemy's castles which she was not intended to. This is because there are three commands to each knight in one turn. Therefore, the program always try to run the last command to the knights which attack the enemies' castle. Overall, other than the issues with some logical errors, the code was readable and easy to understand.
Link to Mari-Lee Flestado's code
http://www2.hawaii.edu/~flestado/marilee.zip
Link to Mari-Lee Flestado's Blog
http://mari-leeflestado.blogspot.com/
Monday, September 8, 2008
Lessons learned from Code Ruler
Overview
CordRuler is Java based programming game based on Eclipse IDE. CordRuler designed for competition of student programers between universities. Each participants need to implement MyRuler.java which controls all personal Knights, Peasants, and Castles that the Ruler has. Knights can kill enemy's Knight or Peasants, or take enemy's Castle. Peasants can take a land by moving to that position. Castles can produce Knights or Peasants depends on the amount of the land.Results
VS Migrate Ruler | Vs Gang Up Ruler | VS Split Up Ruler | |
First Try | 502 : 45 | 536 : 57 | 552 : 56 |
Second Try | 534 : 45 | 503 : 76 | 314 : 63 |
Third Try | 543 : 42 | 548 : 70 | 532 : 104 |
Stratege
Knights
When indivisual Knight's strength is below 30:The Knight try to attack enemy's Peasant or Castle.
When indivisual Knight's strength is over 30;
The Knight try to attack enemy's Knight.
Peasants
Randomly move to other points.
Castles
Produce Knights when the number of Knights are insufficient.
Produce Peasants when the number of Peasants are insufficient.
My Source
Source Download
Monday, September 1, 2008
Open Source Systems Experience
Sweet Home 3D is an Java-based open source system for interior design which helps quickly choosing and placing furniture on a house 2D plan drawn by the end-user, with a final 3d preview. Sweet Home 3D executable version can be downloaded at http://sourceforge.net/project/platformdownload.php?group_id=152568. We can also download source files by clicking http://downloads.sourceforge.net/sweethome3d/SweetHome3D-1.3.1-src.zip?modtime=1219874511&big_mirror=0&filesize=14746696.
Prime Directive 1 - The system successfully accomplishes a useful task.
Sweet Home 3D does accomplish a useful task which is 3D Modeling. When users need to redecorate their apartment or rearrange the existing furniture, Sweet Home 3D helps a lot. This program provides 75 furniture models that users can place in the virtual room. Also all furniture represented by a small picture and are categorized according to their placement in the real house. I tried to rearrange my living room on this program and I could found all furniture that I have in the category named "Living room". First, I tried to set all furniture in the two dimensional windows and the program correctly shown three dimensional images. After this step, I could rearrange furniture on the two-dimensional windows and three dimensional windows changed as well.
Prime Directive 2 - An external user can successfully install and use the system.
I downloaded Sweet Home 3D and tried to install it on the Windows XP Professional. According to the program description, it supports 32-bits Windows, Linux, and OS X. The installation of Sweet Home 3D was fast and smooth. It was just same as other formal program installation.
Prime Directive 3 - An external developer can successfully understand and enhance the system.
I could download Sweet Home source files from http://downloads.sourceforge.net/sweethome3d/SweetHome3D-1.3.1-src.zip?modtime=1219874511&big_mirror=0&filesize=14746696. The zip file contains README.TXT file which includes how to use the source code and how to compile using Eclipse project or with Ant. All source code classes are compatible with Java SE 5, and the directory contains all the information required to compile. Therefore, Prime Directive 3 is satisfied.
Wednesday, August 27, 2008
Coding FIZZBUZZ using Eclipse
Tasks
The tasks was to coding a simple java program called "FIZZBUZZ" which print out all of the numbers from 1 to 100, one per line, except that when the number is a multiple of 3, print "Fizz", when a multiple of 5, print "Buzz", and when a multiple of both 3 and 5, print "FizzBuzz". From the moment I opened the eclipse program, It took 6minutes to get a results that looks correct.
public class FizzBuzz {
public static void main(String[] args) {
for (int i = 1; i<=100; i++){
if ((i%15)==0){
System.out.println("FIZZBUZZ");
}
else if ((i%3)==0){
System.out.println("FIZZ");
}
else if ((i%5)==0){
System.out.println("BUZZ");
}
else{
System.out.println(i);
}
}
}
}
Results
1
2
FIZZ
4
BUZZ
FIZZ
7
8
FIZZ
BUZZ
11
FIZZ
13
14
FIZZBUZZ
16
17
FIZZ
19
BUZZ
FIZZ
22
23
FIZZ
BUZZ
26
FIZZ
28
29
FIZZBUZZ
31
32
FIZZ
34
BUZZ
FIZZ
37
38
FIZZ
BUZZ
41
FIZZ
43
44
FIZZBUZZ
46
47
FIZZ
49
BUZZ
FIZZ
52
53
FIZZ
BUZZ
56
FIZZ
58
59
FIZZBUZZ
61
62
FIZZ
64
BUZZ
FIZZ
67
68
FIZZ
BUZZ
71
FIZZ
73
74
FIZZBUZZ
76
77
FIZZ
79
BUZZ
FIZZ
82
83
FIZZ
BUZZ
86
FIZZ
88
89
FIZZBUZZ
91
92
FIZZ
94
BUZZ
FIZZ
97
98
FIZZ
BUZZ
Problems
I thought I can write this program very easily. After I opened Eclipse, however, I realized that I forgot how to start a java program. I tried to open some previous java projects that I wrote for other projects and finally figured out how to start a java program. Except that, I remembered how to implement a loop for counting 1 through 100 and other things too.