Monday, December 8, 2008

Releasing DueDates 2.0

For the last couple of weeks, I have been busy, busy, and busy. I just had a first of a two-part final for Ethnic Studies last week Friday. I heard from an English professor I took couple of semesters back that the last two weeks before finals, instructors cannot schedule quizzes, and finals. So I was thinking if that rule is a school policy then why my Ethnic Studies instructor is is violating it. Still have to take the second part of the final, also there is a five-page essay due on the same day as final.
In my software development class, we been grouped with new classmates, it is now a team of four people. Our project was to improve on our DueDates system, make it as a web application. At the beginning of this project, it can only be run on command prompt/terminal. This project we have to move it from the command prompt to a functional web application. We were able to do just that and added some cool features like filtering the libraries, books, date, and sending it to email. I ran into some problems, one of my classpath variables in Eclipse was pointing to a folder in my Program Files directory when it should’ve been pointing to another folder; forgetting to make a .duedates directory and a duedates.xml file. I was trying to do one of the extra credits, the progress bar extra credit. It was suppose to be a loading pinwheel, but it was a hassle, so I stop working on it.

We had a group meeting almost every day; we were meeting at the Sinclair library at University of Hawaii. Discuss tasks to do, debug, and sometimes space out. It was already, the meeting was not a 30 minute thing, sometime it last five to six hours, and one day we met for 13 hours. I think the group meetings should be spaced out to have four or five hours of meetings instead of one day meeting for 13 hours, the next day meeting for eight hours.
Working on 2.0 release was a lot harder than the previous releases. The previous releases had small requirements, while this latest release has bigger requirements. Plus the fact we had to transition the program from running in a command prompt to running in a web browser. Working with a group of four was a lot different than with two. You have more people working on the system. But working with a group of four people can also cause trouble, like waiting for a piece of program from another member.

The software ICU automatically checks for method coverage, coupling, and other things. It was good to have automated tools to check on the health of the project. Some flaws we my group experienced was some information not showing up on the ICU. Case sensitivity between programmers’ local directories and ICU’s directories. The software ICU did show accurate dad representing individual member participation. Some group members in my group contributed more. One of the problem was a task was assign to one member, another member will start working on the task when the task is not his. Let us say I did a file and was about to upload it to main repository, but another member told me going to do everything in his – that means I wasted those programming time on a useless file.

Time management is a key; everything has to be managed correctly. I do not program at the same level as every other programmer, so I except to have time to finish up my task.

DueDates-Ahinahina 2.0 Project Page: http://code.google.com/p/duedates-ahinahina/
Read the user guide if you want to try out this awesome system: http://code.google.com/p/duedates-ahinahina/wiki/UserGuide

Monday, November 24, 2008

Learning to use Wicket

This week, I am learning how to use Wicket (http://wicket.apache.org/). It is Java web frameworks lets you do web application programming (in Java). There are many other programs out there that can do it, but Wicket is better than the majority of those out there. Even the software development class’ professor, Dr. P. Johnson wants us to learn Wicket. I was looking through examples from the book Wicket In Action by Martijn Dashorst and Eelco Hillenius. Looking at the examples and trying them out on a computer gives a better understanding of how Wicket works and what necessary files needed to make it work.

To start things off, I did not finish the assignment. I am planning on completing it by the end of tonight or the latest Tuesday night. Throughout Thursday my nose was bleeding out blood, twice in the morning and one in the afternoon. I was freaking out because this was so random so I stayed in bed. Went to the physician and got some medicines. I worked on it Friday night for about 30-45 minutes, got the program’s environment variables running, and got some of the necessary files working. I am depressed from Sunday, got into some personal problems. Also, I lost my earring when I took it off in the shower so I can wash my hair.

One problem was that I did not know where to start, what files to make. So I asked some fellow classmates who were also working on it. This is the first time I am programming web application in Java. All these years, I have been programming in HTML, dynamic HTML, and one period been using ColdFusion. I am learning a lot of things from Wicket, making sessions, displaying things and etc.

Following is the distributable file containing the program (still not finish): http://sites.google.com/site/phillipkhlau/files/stack-wicket-klau4-1.0.1124.zip

Monday, November 17, 2008

DueDates-Red System release 1.2

This week proves another challenging task – our DueDates system should be able to mail out an e-mail with a report stating books that are checked out, second it should be able to “wakeup” to do the search and email a report. The other member in this team includes C. Okada. I was in charge of having the system generate an e-mail and sending out a report in the body that includes books that are checked out and libraries. The task at first was easy to do, but thinking on how to do got me a little confused. At the end, the system is able to send out an e-mail. C. Okada did the wakeup, and he sent an e-mail stating that it is up and working.

One problem I had was one of the library, UH Manoa’s Hamilton Library, was not printing out a list of books checked out for my e-mail report. C. Okada got that part fixed, I do not know what the problem was and it just printed out a blank page. My team member also got the third-party command line parser going, so he was able to get some of the if and else statements out. My other problem was when I made test cases for UH Manoa’s Hamilton Library class, it worked Eclipse’s JUnit Testing, and it also passed verify on my laptop. BUT Hudson failed to build the system because of two test cases. I do not know why it did not work on Hudson, but passed on my local Eclipse and verify tests. It is also hard to maintain a high level of coverage, as we expand the system adding more lines to it, our coverage level goes down and we have to add in more test cases to boost back the coverage level.

My team member and me met after our software development class every other day to discuss about the tasks we have to do. Any problems we deal with it over Google mail, extreme problems we deal with it in person. This is working effectively, I do not know how else to improve this group process for our team.

Working on this latest release 1.2 was a little easier than working on release 1.1. One part is that I had a template to look at when doing the e-mail portion for the DueDates system. I am still learning how to use the third-party command line parser that my team partner installed and using for the system.

The software intensive care unit is alright; at least we know if the system was committed regularly, the development time on the system, how much the system was tested and if the system is in a “healthy” state. One problem I had with Hudson was that it failed on my test cases for UH Manoa’s Hamilton library. It worked on my laptop – passed verify and Eclipse’s JUnit testing. I do not know why it failed in Hudson, I had to put ‘@Ignore’ into two test cases so Hudson will pass verify build.

I, as a software developer have to work more effectively and time manages better. There were so much things going on last week that lasted to the weekend that it was not able to get things done.

Wednesday, November 5, 2008

Software Intensive Care Unit

I am continuing to work on the DueDates system with a fellow classmate C. Okada. For some of you who are not familiar with the project, it is a program that will display a list of books checked out from a list of libraries that is listed in the system. As of now the Hawaii State and University of Hawaii Libraries are on the list.

Our software engineering professor, Dr. P. Johnson, showed us automated quality-assurance tools (PMD, checkstyle, JUnit, findbugs, and etc…) to help our system along the way. Next he showed us an automated quality-assurance system (Hudson, https://hudson.dev.java.net/) that uses all those tools and sends an e-mail if there are warnings in the results. All those tools are great for program development. Now we are introduced with a NEW system that maintains the “health” of the DueDates system.

Hudson's List of projects

It is called a Software I.C.U (Intensive Care Unit) a.k.a. Hackystat (http://code.google.com/p/hackystat/). The system maintains the “health” of the DueDates project by checking on vital information – does all members contribute code at least one a day, does the system work and compiles with the help of Hudson, if there are any warnings from PMD, findbugs, checkstyle, etc, how is the line coverage from Emma tool, and other things that will keep the system in a “green” state. The software ICU displays little histograms next to each tool like Emma’s line coverage, lines of code, and etc… and it is color coded like red means need to look at A.S.A.P., yellow means cautious, and green means fine. Personally, I think this is a great tool for us, it shows us the areas we need make improvements and also the history we made on each area. This is great; I like this “health” status system that checks the state of the DueDates system.

Hackystat's Main

In order to get this software ICU software working, I had to install and configure my local computer. I am using a laptop with Windows XP Pro operating system. The software ICU works by gathering data from my laptop and sends it over to a server where Hudson will process all the data. So I was able to install all the required sensors (Eclipse sensor, ANT sensor, and so on). One problem I encountered was looking for the darn .hackystat folder; I did not know where the heck that folder was. In order to solve that problem, I invoke ANT in my command prompt and it will display an error saying unable to find sensor properties file in C:\Documents and Settings… So I found the folder and all is working properly. My team member, C. Okada, set up the systems Hackystat and Hudson to generate a result page from all the data that is gather. I went in to double check everything is good, and to see if my local machine was sending information to Hackystat server.

Hackystat's telemetry chart of a system

As of now, the DueDates system’s line coverage is really low; we have to make some more test cases for the system. We are submitting code to the system daily. Our code issue is in a green state (awesome, like our professor said at least we got something that is green, ha ha ha). I can say we are at an unstable condition; we have to make some major improvements to have the system back in a stable state. A lot of work ahead of us, cannot slack off on this system. I am looking forward to have the system out to the public.

Monday, November 3, 2008

Second Release for DueDates-Red System

As of now, I am working on a program with fellow classmate C. Okada. As you may now know, this program will list all books that are checked out from a list of libraries in the program. Right now, the program only has the Hawaii State and University of Hawaii Hamilton Library systems. Our professor, P. Johnson, introduced to us to Hudson (Hudson monitors executions of repeated jobs, such as building a software project or jobs run by cron; https://hudson.dev.java.net/), a software monitor that will test the program to see if there are any errors in Findbugs, JUnit, PMD, and so on. It is an awesome monitoring system, I liked the fact it builds our system and generates an e-mail if it fails to build. Using Hudson was a great experience in continuous integration, I commit my system to Google Project Hosting and it will build the system for me. Hudson is like an assistant to me for building and checking any failures in the system.

Today is our second release of the Due Dates system; we accomplished a lot but now enough. This release was harder to do than our previous release, because we have to add three capabilities to our system – supporting more than one library, sorting, and within. Our system still does not sort by books and library; I think it is my fault for not knowing that it was my task to do it – so it should be there on the next release. My group member, C. Okada, finish with the “within” method. That method will display all books that are within a day range, like one day or three days or more from the current day on the user’s computer. The system also has the ability of displaying more than one library, so it is able to grab two libraries’ credentials and generate the list of those libraries.

We downloaded and use a third-party command line parser, the first time around it did not work well with our system. Also, we had to make the third-party file available for users and developers and how to install and use on their system. So that generates a lot of hassle for their end so we scrap that from the system. JUnit error checking will generate warnings when we create sub-packages in our system, still figuring a way to go around the warnings.

We were meeting at the University of Hawaii’s Hamilton Library every other day last week for one to 2 hours at the most. This is good because we were able to discuss about the system, I had a problem with the third-party command line parser so my group member was able to solve. I think this is better than communicating with only instant messaging and e-mails. We probably will keep the Hamilton library as the meeting place, our secondary meeting place is the Salt Lake Public Library because it have Wi-Fi connection for public library card holders.

Cannot slack off, have to time manage everything. I think I did not time manage well during this release. I cannot let it happen again before our next release will be really behind on features.

Saturday, November 1, 2008

Google Project and Reviewing Code Part 2

As of now, I am working on a program (with team member C. Okada) that supposes to display books checked out from libraries that are listed in the program. We already let other programmers (who are in our software development class) to review our system. We got back the results and are pleased at what the reviewers found and commented on. We also had a chance in looking at our classmates’ system (we all are working on the similar idea) and gain some knowledge on what to improve in our own.

Since the reviews we did some improvements to our system. So we had another review session to see if what other things have to be done. This time around, my team had a chance to look at Team Violet’s system. We were getting ideas on making packages and sub-packages since their system is structure with packages. We are having problems in making sub-packages, every time we have sub-packages in our system, one of the automated error checking tools (PMD, findbugs, checkstyle, and JUnit) gives a warning. So we are figuring out a way to correct the warning.

I had a chance to look into Team Violet’s library code. I was looking for a way to find the length of tables displayed on a given web page but did not know what the command to find the length is. Team Violet had the answer: response.getTables().length; I did not know that this works, but now I know and I can change my part of the system without using try and catch statements.

We had Team Yellow’s members review our system. One of the members (J. Zhou) did not review our system – C. Okada and I still cannot find any reviews made by him and still did not receive an e-mail stating that he reviewed our system. We sent out e-mails to all Team Yellow’s members, and only J. Zhou did not review. We did get a feedback from other Team Yellow member, he was able to catch Javadoc errors, JUnit warning, also suggested us to look at another team’s system on how to improve our Emma line coverage (automated error tool).

We are using Google Project Host’s built-in review tool. The first time around I had some complications in using the review tool. There were some points where it did not let me publish my comments into the code, and other times where I did not need any comments to be published. This time around, I had no problems in publishing my comments, but I hated the fact that I have to look for a file all over again starting from the system’s main directory. Only if it stays in the same directory that I am on, it will make life a little easier. I also want my comments to be published with one of the issues, in the Google Project Host’s Issue Manager, instead of seeing my comments in one of the commit logs. If the review tool let us pick where we want to post our comments, in one of the issues or in the commit log, it will be excellent in my standards. For now, Google Code Host’s review tool is awesome, but will be better with my ideas in (ha ha ha ha!).

Thursday, October 23, 2008

Google Project and Reviewing Code

From my previous blog, as of right now I am working with another programmer, C. Okada, on a program project that generates a list of books checked out from libraries using user’s input credentials. Currently, the program only works with the University of Hawaii and Hawaii State Library Systems. This project needed some feedback, so some nice programmers from one of my software development class were able to provide some feedback on how the project can be improve. In return I provide feedbacks to their projects, so this is a win-win solution.

Reviewing other projects (DueDates-Purple, DueDates-Yellow, and DueDates-Silver) was a good experience in getting new ideas for our own project. One example will be that our project, we did not put each library methods into their own class file. That will be a problem if we continue on with the project and add more lines of code. This is a big problem and my partner already fixing it, he already moved one of the library codes into another class file, thus making the main file have only the main stuff. I also notice some of the projects separate methods of printing, looking for checked out books, and stuff into their own files. This is good in the future when the project gets book and there is an error, it will be easier to find the problem and quarantine that file.

Other programmers (R. Reeves, J. Jung, A. Shum, D. Tian, and M. Flestado) reviewing our project is also awesome. One of the programmers caught a runtime error – my loop that prints out a list of book only prints out the last book. I did not catch it, and it is a good thing someone did. There were some good comments, and there were one or two comments that I do not understand why that programmer suggested that idea. Only one programmer (J. Zhou) did not comment on our project, I do not know if he had trouble posting or what, still did not recieve any comments from the programmer.

Google Project Hosting, the site where I can post open-source projects, checkout open-source projects, and review other projects. I had a lot of trouble publishing my review comments on a project. Sometimes it will let me publish, and sometimes it will not let me publish. I had to click on a “start review” link in one of the messages before I can get my comments publish in the code. At least it lets you put comments in the code. The bad part is that sometimes it works and other times it does not. Hopefully, there is a better reviewing tool that lets you publish your comments first time around.

Next time around, our projects will grow and expand. There will be more things to learn from other programmers. Make our projects more efficient and in the future it will be an excellent program for everybody to use.

Monday, October 20, 2008

Open-source development: DueDates-Red

As of now, I am working on a program project called DueDates with a partner. The program supposes to display books that are checked out from the Hawaii State Public Library Systems and the University of Hawaii Library Systems with the user’s library number and password.

The program uses a webpage scraping technology with the help of HTTPUnit (HttpUnit emulates the relevant portions of browser behavior, including form submission, JavaScript, basic http authentication, cookies and automatic page redirection, and allows Java test code to examine returned pages either as text, an XML DOM, or containers of forms, tables, and links. From http://httpunit.sourceforge.net/)


From the beginning of the project, our professor, Dr. Philip Johnson, tells us not to slack. He was correct to not procrastinate, because there are many parts to this project. My partner, C. Okada, and I was able to get the program to get information from the Hawaii Public Library and UH Library.

One of the problems I came across was my UH Library account does not have anything checked out. I also did not have any blocks (books on hold, etc.) for that account. So I called F. Allen, who was in charge of the UH Online Library systems, if he had some accounts I could use for testing purposes. So yes, he lends me some library accounts that they use for testing. So I was able to complete my part of the part in looking up the correct table to display.

In order to keep in touch with my partner, we arraigned meetings at Zippy’s Restaurant for 30 minutes – I am able to order something to eat while I was there. The in the person meetings were great, we were able to talk about the problems we are encountering, and enhancements we need to put in before the release date. The only problem meeting at Zippy’s is that there is no wireless connection for us to connect to our Google code hosting main page. We might have to change the meeting place to McDonald’s or UH’s Hamilton Library.


A thing that I found out is that it can be a hassle if group members do not meet in person, because you cannot really “talk” if talking through online messaging. Another thing is that Google Hosting is perfect for novices like me in learning about open source development and working on a project with group members.

Link to DueDates-Red’s Google Host Project Main Page: http://code.google.com/p/duedates-red/

Wednesday, October 8, 2008

Learning to Use Configuration Management Part 2

This is my second time using Google Project Hosting and the awesome SVN (subversion - a version control system that is used to maintain current and historical versions of files such as source code, web pages, and documentation. define from http://subversion.tigris.org/faq.html) program called TortoiseSVN. This time I got the basics on how to use the both, so I was able to retrieve my partner’s files from his Google Project main repository with TortoiseSVN. I think TortoiseSVN is an awesome program with Google Project – this is the first program I use with SVN.


So I have my partner’s files on my local computer. I changed the path for Eclipse build (ANT build directories) to a folder called bin, and re-word Javadoc comments. I check to make sure my modified codes will not break, and commit back to my partner’s main repository. The same procedures go with my partner handling my files in my main repository on Google Project.


I think using subversion for group projects is an excellent way in getting the updates from each member. I do not need have my group members online to send over the files, all they have to do is commit to the main repository and I can get it from there. I worked in groups before and it was a pain in the butt to get files from group members, plus the fact I have files that I worked on. With a main repository I can upload my changes and/or get the updated version that my group members worked on.

This will save time from waiting for a group member to send files over. Also, I do not need to worry if my files are up-to-date because now I can just update from the main repository – awesome, no more waiting for a group member to send over files, and no more stressing about my partner getting my updated files from me.

Learning to Use Configuration Management

When I first started to learned to program in Java, I never ever have to use SVN (subversion: is a version control system that is used to maintain current and historical versions of files such as source code, web pages, and documentation. define from http://subversion.tigris.org/faq.html) or any project hosting sites, Google Code Hosting (http://code.google.com/hosting/), SourceForge.com, and etc. Until today, where I learn about and use SVN with Google Code Hosting site. I heard of SVN from a fellow classmate and programmer, but I never research it to see if it will benefit me. Today is the day I learn more about SVN and Google Project Hosting.


So I installed TortoiseSVN for the Windows operating system. What an awesome program, it is integrated to the Windows’ Explorer – fabulous. The integrated program is great; all I have to do is right-click on a folder that I want to upload (commit) or download (update/get) from Google Project. Another window will pop up for the site address, username, and password. BOOM! I get the files from the main repository.


Using the TortoiseSVN, I went to download to Professor P. Johnson’s stack project. Got the files with TortoiseSVN and also shows a log of people who committed and what they done. I changed one of the files’ Java documentation, and upload it back to the Google Project. I find that TortoiseSVN mark downloaded files with a green check mark, and files that I changed with a red exclamation mark. I find that this is useful and an excellent way to let users know what local files was changed.

After getting a hang of using the awesome TortoiseSVN and learning how to download and commit files to Google Project, NOW it is my turn to make a Project in Google Projects. I created a new project host site, and uploaded my source codes and .XML files of a stack project. BAM! Got TortoiseSVN to commit my files to my new project site, and now it is there (http://code.google.com/p/stack-klau4/).

After some time of tweaking on Google Projects and TortoiseSVN, I got the feel of how to download (update) and how to commit (upload) files to a project’s main repository. It was not that simple to learn because I took some time in learning the different tools and features of both. At the end, I think I am proficient at using Google Projects and TortoiseSVN. There is a great deal of resources out on the web, but the two things I used are http://ics-software-engineering-fall-2008.googlegroups.com/web/10.svn.pdf and http://tortoisesvn.net/docs/release/TortoiseSVN_en/index.html

Wednesday, October 1, 2008

Still get a bug with 100% line coverage

On my previous blog “Using Emma for code coverage,” I used Emma as my code coverage tool in a program that I am working on. You can also use google.com (or another search engine) about code coverage if you want to learn more about it. Code coverage is the measure of a program code. It is a form of testing that looks at the code directly and measure if a line is being use by the program. So I am at 100% code coverage in my program.


So the test that I am going to do is to write some more code into my program and make it crash but still get 100% code coverage with Emma. An excellent idea created by Professor Philip Johnson is to have a static Array List of ten elements. Using that array list and “break” the array list by going over the limit (which is 10). So I done that went over the limit by 1000000. When I run the program it contains the bug, but Emma still gives my program 100% code coverage.


Like I said in my previous blog “Using Emma for code coverage,” using Emma is great; it saves time in debugging. What I learn from using a code coverage tool like Emma is that it does not show all the bugs in the code. For example input and output of results, Emma say the program have 100% coverage, but the program can crash if it is not correctly use. What I like to say is that code coverage tool is like a thin protection, but it does not expose all the flaws in a program.

In my program, Emma stated that it have 100% coverage, but there is a bug in it that it does not know unless the program is run. The best solution is to know what inputs are going to use and what outputs that are going to be generated. Knowing those then you will have a program that satisfy what you want it to do and no bugs.
Here is the .ZIP containing the source and build files: http://sites.google.com/site/phillipkhlau/files/stack-JUnit-Lab-klau4-6.0.1001.zip

Using Emma for Code Coverage

This is my first time using a code coverage program like Emma. Code coverage is the measure of a program code. It is a form of testing that looks at the code directly and measure if a line is being use by the program. When I started to learn and write Java Programs, I did not know there were tools for code coverage.

I was optimistic when I heard there were Java code coverage tools like Emma. Emma is a great code tool, it generates an .HTML report that I can view on a browser. Emma highlights lines that are 100% coverage green and lines that have little or no coverage red and yellow. I ran Emma on a program that involves using a stack and list. It was a pain correcting lines that was red; I had to write new code that will “use” a line that was in red. For example:


I have a method called “isEmpty()” that method checks if a object (stack, list.) is empty. If the stack is empty then it will give true, if not empty then it will give a false. Emma highlighted that method; I think it was saying that the method was not use in anyway. The solution was this:


assertTrue(“Testing stack is empty”, stack.isEmpty());


So I use the method in checking if the stack is empty, assume that it is empty.
There were lines of code that I add to satisfy Emma, and making the code 100% coverage.


Using Emma is great; it saves time in debugging. What I learn from using a code coverage tool like Emma is that it does not show all the bugs in the code. For example input and output of results, Emma say the program have 100% coverage, but the program can crash if it is not correctly use. What I like to say is that code coverage tool is like a thin protection, but it does not expose all the flaws in a program. Like Emma, it was worth using it and the other tools that help make life easier when debugging a program.

Here is my .ZIP file containing source files, and build files: http://sites.google.com/site/phillipkhlau/files/stack-klau4-v2-6.0.1001.zip

Wednesday, September 24, 2008

Automated Quality Assurance tools VS. Manual QA

For this entry, I am comparing automated quality assurance tools with manual (human) quality assurance. I ran CheckStyle, PMD, and FindBugs on my CodeRuler code. I was amazed at how much warnings and errors that the automated quality assurance tools found compared to a fellow classmate found. Everyone is human, so there are things that we will see them as correct coding while the computer will see it as bad coding.

First I ran CheckStyle on my CodeRuler code. The automated tool generated 383 warnings/errors. Most of them were tab character, some of them missing Javadoc tag comments, and some were warnings of passing the 100 characters marker. Comparing this to a fellow classmate that checked my code, both CheckStyle and fellow classmate found the same errors (missing @param, @author, Javadoc comments, passed the 100 characters marker, and lines that contains tab character instead of spaces. I think the fellow classmate would give up if he has to find all 383 warnings that CheckStyle did and list the line number.


Next I ran the FindBugs. FindBugs did not find any bugs in the code, so that was a good thing. I mean the code worked and it did pass Eclipse’s quality check. Yeah, did not have to worry about FindBugs since it did not find any bugs in the code. I think the fellow classmate did not find any bugs as well, it executed fine on his computer.
Last I used PMD. PMD gave 34 warnings, 19 of them was first priority and 15 of them was third priority. Most of the warnings were for creating empty method and returning empty variables instead of nulls. The rest were avoid implementing this type of coding and instead use this coding. PMD is great in making the code readable and reducing the lines of code. Well the fellow classmate did find empty methods, and use if/else block statements, but he did say to re-code certain part to make it not as confusing.


Automated quality assurance sure beats out manual quality assurance. But there are some things that human can tell and computer cannot, vice versa. With automated quality assurance tools, it is less time consuming (that equals to saving money and headaches) compare to manual checking.

Using Ant and automated quality assurance tools

This is my first time using the ANT build system, and open-source automated quality assurance tools (CheckStyle, FindBugs, PMD). At first I did not know where to create new environment variables, got that out of the way after learning it must by created in Windows Computer’s properties. One of the environment variables that we have to create but was not on the ICS 413’s Standards page is JAVA_HOME – for people who installed the Sun’s Java JRE too with the Java JDK.

When I heard that Ant and automated quality assurance tools was going to save me a lot of time. I was pessimistic at first, like how will this going to help me. Well, it sure helped a lot; I was able to change come “obsolete” code to “modern” code. It gave warnings and also hints on how to solve them.


I was able to complete all the tasks successfully and was able to pass the verification test. The three easiest errors to correct were the checkstyle, findbugs, and junit. I had one hard error that I did not know what to do; it was from the PMD test. So I went to watch some television for a little while and came back to tackle the error. I discussed with a fellow classmate on the problem, and finally able to come up with a solution. There were errors ranging from basic, use Integer.valueOf() instead of new Integer(), to challenging, replace the empty catch exception block. PMD have a site that links each error to it. I think that is great, but I did use google.com to look for tips on errors that were not hyperlinks.


Ant is an excellent tool to have when using automated quality assurance tools and distributing source files to others. It should help me a lot with this assignment. Since there is no standards for programmers to follow, with the Ant build system and automated quality assurance tools it is useful when distributing to others.

Here is my distributable .ZIP file: http://sites.google.com/site/phillipkhlau/files/stack-klau4-6.0.924.zip

Monday, September 15, 2008

CodeRuler Review

I am reviewing John Ly’s & Yasuyuki Kaneshige’s code for the CodeRuler program. Just for people who do not know what the CodeRuler program is. CodeRuler is a Java game that uses Eclipse Editor. Programmers control their knights, to fight and capture castle, and peasants to claim land. Programmers code the knights’ and peasants’ “duties” in Java. CodeRuler will run their code and that is where the game begins against the programmers’ ruler and the CodeRuler’s own rulers.

I downloaded John’s and Yasuyuki’s ZIP file. Place their code into CodeRuler and ran it couple of time against CodeRuler’s rulers. Their ruler did an excellent job against the CodeRuler’s rulers. I was using Capture Castle Ruler, Split up Ruler, Gang Up Ruler, Smart Split Up Ruler, and Pawn Evasion. Comparing their strategy with ours (Lau-Sanchez’s Ruler), their plan works well than what we have.

Taking a look at their JavaDocs, they are clear and concise. I was able to understand how each method work. Their documentation comments are to the point and not ambiguous. The class is structured logically, broke up the task of the knights and peasants into their own methods and not both in one method.

File

Lines

Violation

Comments

MyRuler.java

3

EJS-100

import java.util.Iterator is never used in the code.

MyRuler.java

10

EJS-46

Do not have @author and/or @version in the documentation comment.

MyRuler.java

16

ICS-SE-Java-8

Use this instead:

ArrayList<\IObject\> enemies = new ArrayList<\IObject\>();


**NOTE: those "\" not suppose to be there

MyRuler.java

24, 25

EJS-34

Do not need those comments if it is already in the comments couple lines above it.

MyRuler.java

19, 53

EJS-35

Use documentation comments instead of standard comments for comments above methods.

MyRuler.java

27,29,31,*

EJS-31

Gave the numbers a constant name so the code speaks for itself

MyRuler.java

180,187,189,196,198

EJS-76

Use block statements for the if and else.


Conculsion:
Even there was violation of the Elements of Java Style book and ICS413 standard, the code was still readable and concise. Should have some white spaces here and there, but overall I was able to read the code. The comments within the methods were useful, if I was to maintain this code I will be able to understand it with the help of the comments they had.

Monday, September 8, 2008

Lessons learned from Code Ruler

I had problem communicating with my original partner, but I found out a fellow classmate (S. Sanchez) who did not have a partner to join our group. I was able to make progress with my partner on the assignment. We met up and were able to code the assignment. My partner was tackling the movement and attacking of the knights. We implemented some code from the code ruler website because we got stuck with our own code. I did the peasants – making them move, check if the land is already ours, if not then claim that land. I was able to communicate with my partner through AOL instant messenger.

Plan:
Our plan for the code ruler is to the have our knights to attack the nearest castle and take over that castle. From there we order the knights to attack the next nearest castle. With the each castle, we use them to make more knights and peasants. The peasants are used to cover land that is around the castle. We made unlimited knights, but we limited our peasants to 25.

The link the .ZIP with the javadoc and myRuler.java is: http://www2.hawaii.edu/~klau4/lau-sanchez.zip

The following table is the results of our ruler against the Random, Migrant, and Gang up rulers, all nine tests were one-on-one our ruler against each sample ruler.



lau-sanchez VS random

lau-sanchez VS migrant

Lau-sanchez VS gang-up

Test 1

694/2

656/4

261/146

Test 2

651/2

387/9

214/189

Test 3

399/26

441/18

142/234
















Lessons learned:
I agreed with the fellow classmate who said to start the assignment early. There was a lot of thinking involved to get the ruler to beat the sample rulers. This class does take a lot of your time, so time manage is a must to balance between school and personal stuff. My partner and I got stuck at the beginning, so we redo the assignment from the bottom up. Eclipse is excellent, all-in-one product. It made functions for me and I was able to create javadoc from it. Emacs and UHunix was great. Eclipse is better, makes my life easier.