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