Monday, December 10, 2007

MyISERN 2.0 Review

The code I reviewed is from team yellow.

1. Installation
I can download the distribution file without any problem. I also unzipped it with ease because I used the WinRAR, but my other team member had problem unzipping it while using the default window unzipper.

Since there is no installation guide, I followed the developer guide and tried to build the system. Since team yellow is using a whole new system, there is no easy runnable war file. I downloaded XAMPP and Symfony as the guide told me to. When I tried to install the XAMPP, I had problem of getting the Apache server running. However, my other team member do not have that problem. After googling several pages, I discovered that this is quite a common problem, and there are many ways to "tweak" around it. I use the word "tweak" because none of them seem to guarantee to fix the problem. I finally got the XAMPP homepage show up on my localhost after I turned off my firewall and stopped some of my IIS services, which I have no clue what those services are used for.

However, my journey is pretty much ended here. I tried to install the Symfony framework, which is a lot harder than the XAMPP. The link provided in team yellow's guide does not give any useful information and it is more suited for unix users. The "pear" command-line thing seems come up from nowhere. I searched inside the folders from XAMPP and Symfony, and I did find some things called "PEAR", I tried every single execuatable, but they did not give me any luck. I tried to refer to the guide from team lime, which is using the same framework, but team lime is using WAMP, which is something different from XAMPP, and thus did not go too well either.

My other team members are pretty much stuck as I do. I finally had to give up after like two hours of searching the internet and reading relevent materials. Although Edward is managed to get the Symfony working at the end, he did not get the web app running still.

2. Code format and conventions
I have no experience for programming in PHP, therefore I do not know how well-formatted the code is. I remember team yellow mentioned a PHP eqivalence of checkstyle in their demo, but due to the reason I couldn't get the system running, and there is no guideline on how to run the tool, I have no clue to test it out.

3. Test case
Black box perspective: Since the system is not built, I cannot evaluate this.
White box perspective: Same reason as above.
Break da buggah: Same reason as above.


4. User interface
Although I am not able to build the system, I am able to see part of the website in my browser from those PHP files. The interface is very clear, and I like the coloring of the table cells which makes the whole page pretty neat. However, since these are partially of the interface, I cannot really evaluate it.

5. Three Prime Directives

Since the program cannot be built, it does not accomplish a useful task. As an external user, I am not able to install and use the system. As an external developer, I am not able to enhance the system easily, maybe I could get it working after putting considerable amount of effort into it.


6. Summary and lesson learned
From this review, I once again realized how important the documentation can be to a system. I had terrible experience working with software that has bad documentations. I do admire the courage of team yellow to take on a brand new system. Here is one suggestion I have: create a detailed installation guides with A LOT of pictures in it, you can safely assume the users have no knowledge of any tools you have used here, which is probably true for most of the class. Do not refer to any other online guides, they might not suit your system the best.

Prime Directives Redux

For each tool or technique, please provide one or more concrete examples of how it satisfies each of the three prime directives. If you feel the tool or technique does not apply to one or more of the three prime directives, please discuss why.

1. Interactive Development Environments (Eclipse, VisualStudio, etc.)
These IDE tools satisfy PD 1 because they obviously accomplish the task of developing software by providing an integrated environment with editor and compiler. The programmer can easily write programs and test the code all within the IDE.

These IDE tools also satisfy PD 2 because in this case, the developer, or programmer, is the main user. Since programmer’s tasks are to write programs and test programs, and these IDE tools can successfully accomplish these tasks, it indicates that the user can install and use these tools.

In terms of PD 3, these IDE tools score differently. If the IDE is open source, it is quite easy for an external developer to enhance the system since the developer can know about what is going on inside the system, assuming the system provided sufficient documentation. On the other hand, if the IDE is not open source, then it all depends on how much documentations the IDE provides, and how much restriction is applied. For example, Plug-in, which is a small portion of code that attaches to the system to enhance certain ability of the system, is usually allowed, and it is often easy to write with the provided API of the system. However, redesign of the system, such as major algorithm change, is commonly prohibited for closed source systems.

2. Coding Standards and Coding Standards Compliance Tools (Checkstyle, etc.)
This technique and the corresponding tools satisfy the PD 1 because they accomplish the task of ensuring a standard, consistent, and readable coding style through out the program by either enforcing a formal coding standard or automatically formatting the code with software tools.

This technique and the corresponding tools satisfy the PD 2 because they provide an easy way to format the code of a program, without the developer level requirement. For example, the users just have to follow the coding standard to write consistent and readable code, and they are not required to understand the rational behind the standard. Also, the users just have to run the coding standard compliance tools without knowing how the tools reformat the code to make it match the standard.

This technique and the corresponding tools also satisfy the PD 3 by giving control to the developer. The developers can adjust the coding standard easily according to their needs. For example, the developer can simply add additional rules to the compliance tools when they need it, and the new rules would be automatically applied to the whole program when the tool runs.

3. Build Systems (Ant, Make, etc.)
These tools satisfy the PD 1 because they successfully accomplish the task of building up a runnable file for the project by breaking down the project to separate components and create dependency among these components.

These tools satisfy the PD 2 because the developers and programmers, as the users, can use them relatively easy. These tools are usually well-adopted in its own domain, so the documentation and support are sufficient to allow the first time users to install the tools successfully.

These tools also satisfy the PD 3 because the developers can customize the build files to fit the desire of different projects. It is also independent to the IDE, so the developer can choose whatever IDE they feel comfortable with to develop the project.

4. Automated Quality Assurance Tools (PMD and FindBugs, etc.)
These tools satisfy the PD 1 because they accomplish the task of improving the quality of a program. Base on the tools, different aspects of the quality can be improved: optimization, subtle bugs, logical error, code convention, etc.

These tools may not satisfy PD 2 too well because most of these tools do not run alone, and they need to integrate with some other build tools in order to be used easily. Although this is not hard for a programmer, it could be troublesome sometimes.

These tools satisfy PD 3 because the developers can configure the tools in various ways so that they can check whether some certain aspects, or quality, of the program have been obtained. It allows the developers to develop different projects but have an overall guaranteed production quality.

5. Black and White Box Testing
This technique satisfies the PD 1 with the assumption that the testing are useful testing. With useful black and white box testing, the quality of the program is improved. However, if the testing is not good or useful, it means nothing to the program and thus does not accomplish a useful task.

This technique satisfies the PD 2 to a certain degree because with good black box testing, it implies the system is usable, and with good white box testing, it implies the system is stable. Together it gives the ability to use the system for the users. Again, this is under the assumption of the testing is good and useful testing.

This technique satisfies the PD 3 with the same assumption. For example, the developers writing black box testing do not need to know the internal structure of the system, yet with sufficient and high-quality testing which simulates the users’ tasks, the quality of the system will be enhanced. The more testing the system can pass, the higher quality of the system will have. Of course, granted those testing are useful ones.

6. Automated Testing Tools (JUnit, HttpUnit, etc.)
These tools satisfy the PD 1 because they provide an easy way to write tests and run test for a program. They provide predefined functions which are frequently used and often helpful for writing tests, and it simplified the programmer’s job of building a test case from scratch.

These tools satisfy the PD 2 when they have sufficient documentation and support. After all, it is not helpful to have these testing tools but the programmers do not know how to write them.

These tools satisfy the PD 3 because these tools enable the developers to create test cases in a more consistent way and thus easier to maintain. With these tools, the scalability of the testing can be increased in a more efficient way because they are well-organized and automated through small incremental build-ups.

7. Configuration Management (CVS, SVN, etc.)
These tools satisfy the PD 1 because they accomplish the task of providing a way for collaborative software development. Different developers can cooperate efficiently by using these tools to maintain a master copy of the code and still develop on their own copies.

These tools satisfy the PD 2 and PD 3 together because as the developers use these tools, they can keep track of what the other developers are doing and ensure that everyone is staying on the same stage, which can help to produce more high quality code.

8. Issue Driven Project Management
This technique satisfies the PD 1 by providing a way to manage the project process.

This technique is not really applicable to the PD 2 since it is only a technique for software development.

This technique satisfies the PD 3 because it keep tracks of every step of the development by a series of issues, which makes it easier to trace back and modify in the code according to the issues, hence gives higher quality of code.

9. Use Cases
This technique satisfies the PD 1 because it provides an easy understanding of what the system is able to do and how should it be done by describing them in use cases, which are essentially user stories and scenarios.

This technique is not really applicable to the PD 2 since it is only a technique for software development.

This technique satisfies the PD 3 by guiding the design and implementation of the system toward the users, who determine if a system is useful or not. By applying this technique, the developer would have a higher chance to develop system that satisfies the users’ needs, in other words, a higher quality system.

10. Software Review
This technique satisfies the PD 1 because a review can give useful feedback to the developer. It accomplishes the task of acquiring feedback about the system.

This technique is not really applicable to the PD 2 but it is related to the PD 2 since the usability of a system is closely tied to how much the reviewer can use the system.

This technique satisfies the PD 3 because the feedback from a review of the system can help to improve the design and implementation of a system, which in turns brings up the quality of the system.

11. Agile Methods (XP, Scrum, etc.)
These techniques satisfy the PD 1 because they accomplish the task of allowing software development in an agile way: change is usual, frequent, and good, and it should not be hard to make change.

These techniques are not really applicable to the PD 2 since they are only techniques for software development.

These techniques satisfy the PD 3 by adding “agility” to the software development process, which allows the system to be changed frequently without too much penalty, and adopt the new requirement.

12. Open Source Licenses (GPL, CPL, etc.)
These licenses are not really applicable to the PD 1 because they have nothing to do with the functionality of a software system.

These licenses satisfy the PD 2 by allowing more people to use software freely that are open source, and thus create more usability.

These licenses satisfy the PD 3 by allowing developer to enhance or change the open source software the way they want without restrictions or with minimal restrictions.

13. Online Hosting Services (Google Project Hosting, SourceForge, etc.)
These tools satisfy the PD 1 because they provide an easy way to host a software development project.

These tools satisfy the PD 2 because they are well-adopted to specific domain and have great community support, thus they are very easy to use.

These tools satisfy the PD 3 because the developer can easily host their project without the hassle of setting a server. This would greatly increase the ability of personal or small group software development.

Friday, November 16, 2007

MyISERN 1.3 Review

The code I reviewed is from team blue.

1. Installation
I can download and install the code without any problem. There is a jar command to create a jar file, but I believe that is what is left from the last group since the file is named as "myisern-1-green.jar". All the QA tests are passed except for the Emma, which complains about the missing of the coverage.xml file. I would recommend the team to model their program after the StackStripes, which should easily fix this problem. There is a readme.html file comes with the package, but again, it is something from the last group.

2. Code format and conventions
The code do not violate much rules, however, there are some private variables are not commented in both the model and action bean. Other than this, there is no big problem.

3. Test case
Black box perspective: Only the listing functionality seems to be working correctly. Everything other than that seems incomplete. Adding or editing buttons would cause the program to crush.

White box perspective: Since Emma did not pass and there is currently no JUnit testing written, there is not much white box testing are being done.

Break da buggah: Clicking on the adding or editing button can crush the program.

4. User interface
The interface of website is very straight forward. The screen estate is well preserved since the program is still usable with only half of the monitor size. Although I would prefer some "Back" buttons that allows the users to navigate back to the previous page, as well as a link back to the homepage.

5. Summary and lesson learned
Overall, team blue's code still has a lot of work to be done in order to complete all the core functionalities. Consider this is only a work-in-progress result, it is acceptable. Besides that, the team seems to be on track and working towards the correct way.

Monday, November 5, 2007

Stack Stripes Extension

Source code

This assignment is very straight forward, and I have completed all the tasks. However, there are some obstacles I encountered during the process.

The first problem was the Emma error. It showed error on missing the coverage.ec file on the first time I ran verify test with the fresh code from the downloaded package. However, this error disappears after I try to run the junit test. According to the discussion on the class website, it might be caused by launching the Tomcat server besides the project’s directory. I tried to reproduce the error by launching Tomcat on the root directory, but it did not work somehow.

The second problem was the concurrent exception when I tried to create the action for the Double It button. Since this is a web application, we can only run it over the browser. The error message page was a blast for me when the first time it showed up. I was a little clueless at the beginning because I was expecting some error message in the console from eclipse. Then very soon I notice the error message was showed in the error page like they would in the console. With those messages, I was able to fix my bug very quickly.

There were also many minor problems while I tried to go through all the tasks, such as how to launch Tomcat server in different ways, or create new forms in the JSP page. However, they are very minor and got fixed very fast.

Overall, this assignment is quite easy, which is what it supposes to be. From this assignment, I have gained a rough image how the client-server application should work. Also, I learned many new concepts, such as servlets, JSP, JSTL, etc. This assignment only reflects a tiny portion of the web application, and I believe as the semester go on, I will learn a lot more about it.

WebAppQuestions

Questions:

1. Explain in your own words the meaning of the web "request-response cycle".
This is the cycle where the client, usually represented as a user, sends out a request to the server, usually represented as a website, and then the server gathers the necessary information to construct a response, and sends back the response the client and waits for the next request to complete the cycle.

2. Explain how servlets facilitate processing of the request-response cycle.
The servlets use the ServletRequest interface to define methods for getting information from the requests, which contains the data passed between a client and the servlet; and it uses the ServletResponse interface to defind methods for constructing responses, which contain data passed between a server and the client.

3. How do you login to the Tomcat Manager?
In order to login to the Tomcat Manager, the user must first start up the Tomcat server, then open the browser and type in http://localhost:8080, click on the Tomcat Manager link, where the user will be asked for user name and password for login. The information is defined in the file $CATALINA_HOME/conf/tomcat-user.xml.

4.What is the Tomcat Manager used for in the StackStripes application?
In the StackStripes application, the Tomcat Manager is used to deploy and undeploy the application and maintain the sessions for the application.

5. What is the directory and file layout of an installed web application like StackStripes? (This is NOT the same as the directory and file layout of the StackStripes distribution!)
The directory will be named after the application, for instance, StackStripes. Then inside the directory, there are META-INF and WEB-INF folders, and some jsp files which might be under some subfolders. The jsp files define how the web application will look like in the browser. The META-INF folder contains the manifest file for the application, and the WEB-INF folder contains the classes files for the application, and the library used in the application, which usually are jar files. The WEB-INF folder also contains a web.xml file, which is the configuration for the Stripes.

6. How do you build a war directory structure in Ant? Where is this accomplished in the StackStripes application?
To build a war directory structure in Ant, a target must be created. This target must invoke the Ant task “war” to create a war file and specifies a configuration file usually named web.xml. In the StackStripe application, this is done inside the war taget in the build.xml file.

7. How do you install a war directory in a running Tomcat server? What information does the Ant task need to accomplish this?
One way to deploy the application in a running Tomcat server is to set the autoDeploy attribute to “true”. Alternative way is to do it via an Ant task. The necessary information for the task include: the war file, and the deploy parameters and the install URL.

8. What is the "Model2" architecture? What are its advantages?
Model2 is an architectural pattern used in software engineering. It separates the data (model) and user interfaces (view), and uses a controller to connect the two components, so that they do not affect each other when modified. It has the greater scalability and modularity.

9. What are JSP pages? How are they related to servlets?
JSP pages are used to create web content that has both static and dynamic components. It relates to the servlets by accepting the dynamic request.

10. Why is there a delay when retrieving a JSP page for the first time? Where is the Java code for that page stored?
This is because the JSP page must be compiled into a Java Servlet, which is a piece of pure Java code to go through, and it does not require this process after the first time access. It is store under the $J2EE_HOME directory.

11. What are JSTL tags? Why are they useful? What is an example JSTL tag from the StackStripes system?
JSTL tags are a collection of tag libraries that provide common functionality while writing JSP pages. They are useful because they fit in HTML better than Java code, and provide reusability as well as Expression Language, which is very convenient. In the StackStripes system, the
JSTL tag is used.

12. What are Stripes tags? Why are they useful? What is an example Stripes tag from the StackStripes system?
Stripes tags are the ones start with the prefix “stripe:” They are useful because they link the JSP pages to the Java classes automatically and provide very powerful functionality. In the StackStripes system, the
Stripes tags are used.

13. What is HttpUnit? How is it different from JUnit? Why is it useful? What is an example use of HttpUnit from the StackStripes system?
HttpUnit is open source software that can provide automated testing by emulate the browser behavior. It is different from JUnit because it provides easy way to write tests that can simulate the user behavior on a web, such as clicking a link. It is very useful for testing web application. In the StackStripes system, it is used to test the task of user clicking the buttons on the web.

14. What needed to be changed in order to implement the Double It button? What didn't need to be changed? What did you learn about the MVC design pattern from this exercise?
To implement the Double It button, a new JavaBean method for the double operation must be created, also a new form must be created in the JSP page. Everything else that worked before do not have to be changed. This is the advantage of MVC design, it separate the data, which is the Stack model, with the view, which is the JSP page. So when we change the JSP page, it does not affect the data.

15. What are the equivalence classes that need to be tested for the Double It button?
The class needed to be tested for the Double It button is StackActionBean because it is related to the user interface (view). The StackModel class has nothing to do with it, thus it does not require testing.

16. Provide two screen images of your new StackStripes application with the Double It button, one showing the page before and one showing the page after hitting the "Double It" button.
Before:

After:

17. What is the singleton design pattern? What is an example of its use in StackStripes? Why is it needed?
The singleton design pattern enforce there is always only one instance exists for the class. In the StackStipes system, the stack is implemented in this way. This is needed because it prevent multiple stack is being used by different users.

18. Some of the StackStripes tests exercise code on the "server side", while others exercise code on the "client" side. Which test classes exercise code on the "server", and which exercise code on the "client"? How does Emma deal with this to create appropriate coverage data?
The StackModel is tested on the client side, and the StackActionBean is tested on the server side. Emma combines the coverage from both side to create appropriate coverage data.

19. Running 'ant -f junit.build.xml' results in the following target invocations: tomcat.check, tomcat.undeploy, compile, war, tomcat.deploy, junit.tool, junit.report, junit. Explain what each of these targets do.
tomcat.check – check if Tomcat server is running
tomcat.undeploy – undepoly the application if there is one running on the server
compile – compile the source code
war – create the new war file using the web files
tomcat.deploy – deploy the application on the server
junit.tool – runs the JUnit tests
junit.report – report the JUnit results by creating HTML report file
junit – ensure the junit.tool and junit.report has been run

20. (Optional) If you have experience using one or more other web application frameworks, discuss your initial reactions to Stripes. How is it similar, or different, or better, or worse than your previous experience?
I have used a little ColdFusion framework before, but I only set up the database on the server side and it is a local server as well. Many things are quite similar in the two frameworks, they both have their own tags to do specific tasks that are more powerful than normal HTML tags, and they both have a manager-like feather to maintain the sessions.

Monday, October 22, 2007

MyISERN 1.2

Milestone release
User Guide
Developer Guide
Release Notes

This assignment turned out to be very repetitive, and also very difficult on the details. Although we have finished all the tasks, they are not done in a very elegant and efficient way.

The command line interface for inputting data is more complicated than I thought. By complicated, I mean the tons of if and else causes and several infinite loops inside almost every function. The backbone of the program is relatively simple, but that is only based on the assumption of the user do not input error data and knows what to input. A lot of effort has been spent on error checking. However, there are still some minor bugs in the program. We did not notice these bugs until we did the data input at the very end, where we did not know most of the data. If the data is complete and correct, the program will work perfectly fine. However, if the data is incomplete, the program will throw out a bunch of errors due to the schema requirement. Although the errors are all caught by the error checking and indicated, fixing them is such a harsh and tedious job.

What makes this assignment very repetitive and boring is the data input part. It is very often that the information is incomplete, and we will have to end up guessing. Also, because we assigned different data for different group members, such as one person does the researchers and another person does the organization, the program has a serious problem when merge these data together. The different names of organizations and researchers, which are chosen by different group members, give out many invalid links errors, even though they are essentially referring to a same organization or researcher.

This assignment once again showed the importance of face-to-face group work. At the last minute when we tried to figure out the data errors, we were using instant messengers, which was extremely inefficient. Also, a good planning ahead is still not achieved. Although we took our time to scratch out the structure of the program when we met, there are still many changes happened during the actual implementation. The failures to foresee these changes gave us quite a bit of troubles.

In terms of improvement to the system, there are many can be done. First is the Emma testing. We did not cover most of the methods in the editing class, which has many user input inside. Although Professor Johnson said it is not quite possible to do a detailed testing case for it in one week, I still feel unsatisfied for the low coverage of code. On the other hand, a more strict and accurate error checking should be implemented. The current system will still miss some error input.

Overall, this is another lengthy and hard assignment. Well, I think the good thing is I am starting to get used to it.

Use Cases

Use Case Wiki Pages

This is not a really difficult assignment, since we have gathered the necessary information we need to create the use cases.

We decided to use a use case template to keep our uses cases consistent. This is easily done. After several Google searches, we found some templates that might fit our needs. We modified the templates so it matches our use cases. At first we tried to fill out the use cases using tables, but then very soon we found out it is almost impossible to have a nicely formatted table in the Google project wiki pages. The only way to preserve the new lines is using the code block, which has some weird color when the content is not a real code. Also, some new lines are not preserved somehow. However, we figured this would be the best we can do in these Google project wiki pages.

In this assignment, I have a better understanding of use case. When writing a use case, consideration for both the user and the system are necessary. Also, a clear flow of how the process will be very helpful. Although use case is better when writing as scenarios, it is very easy to get wordy. A balance point between detained description and concise story is important. Lastly, use case driven design seems reasonable approach for developing software. After all, the users are the ones who determine whether the software satisfy their need. Knowing how they would use the software would save a lot of unnecessary mistakes.

Wednesday, October 17, 2007

MyISERN 1.1 Review

This time we are able to choose the author to review. Therefore, I chose one of the graduate students group to see how they are doing differently from us. The author I picked was Andrew Wong from the Silver group.

Installation Review:

The source code is downloaded successfully. The Google project page also includes the wiki pages for user guide, develop guide, and the release notes. Following the instruction in the user guide, the jar file is successfully created. The verify task ran successfully also, which implies the JUnit, Checkstyle, PMD, and FindBugs are all passed as well. However, when I tried to execute some of the commands to generate the tables, I saw some really chaos and random display instead of a nicely organized table. It took me a while to figure this out: the author is doing the display based on the column numbers, which is obviously a number greater than the normal width of a command prompt window. I tried to resize my command prompt window to 800 columns, and then a nicely structured table finally showed up. The information is mostly horizontally listed, which requires a quite a big width for the window to display them correctly.

I would recommend the author to put this issue into the user guide, since normal users would not resize their command prompt window to verify the display, and they would simply consider the program is not working.

Code format and conventions review:

There are not many code violation can be found. However, for most of the files, the private data members are not documented. (For example, line 46-48 in MyIsernXmlLoader.java) Other than that, the code are well written and easy to read.

Test case review:
Black box perspective:
The program does print out the information correctly when there is enough room to display them. However, duplicates and invalid links in the data files are not shown. I would expect to see, for example, at least an error message showing that there is duplicate researcher in my researchers XML file, so that I can go ahead and change it. Other than that, the black box testing seems to be working pretty well.

White box perspective: The Emma report is as follow:
Emma Coverage summary
class: 100% (1/1)
method: 97% (9/10)
block: 100% (497/508)
line: 100% (104/108)
Besides one method that has not been covered, all the other codes are tested. I looked into the Emma report and found out the non-tested method was a method that involves the enum type classes, which Andrew has been mentioned in the discussion. I personally do not know much about enum type, and it seems like the non-tested methods are somehow generated inside an enum class, which is not really inside the program. With the fact that the Java development team is probably responsible for the testing for the enum class, I consider the author did an excellent job in the white box testing.

Break da buggah: There is not really a way to "break" the program, but there are some ways to cause it malfunction, or at least, not functioning as expected. The first way is mentioned before, to execute the program in a normal command prompt window, which it does not print out information correctly. Secondly, the program does not print out error message most of the time for some invalid command calls. For instance, if I invoke the “-describe –all” task by passing something other than “researchers, organizations, collaborations”, the program will simple do nothing.

Summary and Lessons Learned:
Overall, the program is pretty well written. One thing I really like about is the modulization of the program. The author breaks down the program into loader, printer, query engine, checker, and command line parser. Consider this MyISERN project would be last for two semesters, it is definitely necessary to factor the program into different components, which does not interfere each other when one gets changed. I have been thinking to modulize my whole program, and now the Silver group gives me a very good example of doing this. Despite the tremendous amount of work to modulize my current chubby program, I think it is worth the time and effort to do so.

Monday, October 15, 2007

MyISERN-1.1

Milestone release
User Guide
Developer Guide
Release Notes

This is another very challenging assignment. Although I managed to accomplish all the tasks, I feel strongly there are many improvements can be made.

The hardest part of this assignment would be the unclear requirement. Although the requirements are posted on the course page, many of them are not clarified, especially the one that asks for link verification. Even though Professor Johnson answered it in the discussion, it still left me quite a bit of confusion. It seems like it could be done in several ways, and there are pros and cons in each way. I think this is what will happen in real life too. The customer do not always give clear requirement of what they want, or more often, even the customer themselves do not know what they want.

Another hard part of this assignment was the cooperation in the group. We started working for the different parts of the assignment, and then very soon we encountered the conflict problem while we were trying to commit our own files. Although we worked in different code, the conflict still appeared somehow. I think for student group project, commit conflict will be more often since students tend to work together around the same time and commit the code at the same time. Anyhow, we figured out the problem by merging or all updated to a same version.

Last hard part of this assignment is the testing-base design. Since our code are supposed to be tested by JUnit, I tried to avoid using void methods as much as I can. However, the requirements of this assignment seem to be still printing stuff out on the standard output. I could have made the methods return some values, such as true or false, or even a list or a map, but I really did not see the purpose of doing that. It simple violates the nature of the requirement. If the requirement is to print out something, then the methods should print out something without returning anything. After a little bit debate, we stick with the void methods.

For the possible improvement during the next assignment, I would first make sure what the framework of the program would be like, then list out all the classes, methods, and variables that will be implemented. In this way, everyone could work differently but still go towards a same goal. Besides, I would try to find a balance between the design and testing, and avoid the usage of void methods. After all, they are not good in the sense that they cannot be tested easily. Also, one thing I will definitely do is the issue organizations. In this assignment, our issue management was very poor, and I did not figure out how to edit an issue till the very end. It was simply a mess. In my opinion, the red team did very well on this. They divided the issue according to the requirement, thus for every commit there is always an issue to be related. This can avoid the redundant creation of the issues.

Overall, this assignment is not easy, but as usual, I learned a great deal of stuff from it.

Tuesday, October 9, 2007

MyISERN Review

I was assigned to review Jung Kim’s code this time, but by the time I was writing this review, I could not find the entry from his blog for the MyISERN assignment. Therefore, I went to his team’s Google project page to download the source code.

Installation Review:

The source code is downloaded successfully. There is no wiki page for the user guide or something like that, but after all this was not required in the previous assignment. I had no problem at all while trying to import the project into eclipse. I invoked the verify test in the command prompt, and it ran successfully. This implied the Checkstyle, PMD, FindBugs, and JUnit tests should all be passed.

Since the first MyISERN assignment is relatively simple, there is not much code added in the program. I can easily understand the code.

For the program execution, I invoked “ant jar” and it creates a jar without any problem. Then I invoke the jar file by “java –jar” command. The tables were printed out correctly. Overall, the program does what it supposes to do, and it functions correctly.

Code format and conventions review:

There are a few violations in the code:


FileLinesViolationComment
MyIsernXmlLoader152, 169, 196, *EJS #7Unnecessary blank line within a method
MyIsernXmlLoader142, 159, 194, *EJS #9 Pick more meaningful variable name or give it a comment
MyIsernXmlLoader191EJS #27Name for collection should be plural


Test case review:

Black box perspective
: The test does print out the table as expected. Other than that, the number of researchers, organizations, and collaboration are also tested, but that is given from the initial files. However, printing out the table is the only objective of the assignment, and the data are all given, there is not much black box testing can be done.

White box perspective: The Emma report is as follow:
Emma Coverage summary
class: 100% (1/1)
method: 90% (9/10)
block: 98% (497/508)
line: 96% (104/108)
Although the coverage is not 100%, it does not mean the testing is not sufficient from our experience of code coverage. By inspecting the testing case, I found out the reason for the missing coverage is that the main method has not been tested. However, since main method is “evil”, and JUnit is almost useless when it comes to testing of the standard output, I consider the author has done a fairly good job on the testing. Also, there is one line of error checking code is not covered. As mentioned above, the data for the assignment is given, thus an error input cannot be produce and the error checking will never be executed.

Break da buggah: I could break the program by running it outside its original folder, because the XML data files are defined such that they are located within the original folder. However, this seems a little bit too extreme to me because I think only a programmer that knows the internal structure of the program would know this could cause the program to fail.

Summary and Lessons Learned:
Overall, the program is pretty well written. It functions correctly and safely. One lesson I learned is that when the data is given, there is still no guarantee that the program will not go wrong. Furthermore, things tend to change a lot in real life, and errors usually emerge during the change. Another lessoned I learned is the importance of documentation. Not only the meaningful comment in the code is necessary, but also a user guide or manual is very helpful.

Monday, October 8, 2007

MyISERN-1.0

The source code can be downloaded from here.
Our Google project page is here.

The objective of this assignment is to get us started on building the social network application for ISERN, as well as start using SVN and Google project hosting. In this assignment, I learned about JAXB, XML Schema, group software development process, and I am more familiar with SVN, project hosting and XML.

JAXB: This application is very powerful when it pairs up with XML Schema. It took me a couple of hours to figure out how JAXB Marshaller class works. It basically provides a bridge to connect Java and XML. We can easily convert data that is defined by XML Schema to Java classes, and it is done almost automatically.

XML Schema: This is a way to define data in XML as far as what I understand right now. It might seem a little bit complicated at first, but it really makes sense once it is converted to Java classes by using the XJC compiler. Since XML is becoming a more and more popular standard to hold data, I think it would be very useful to learn about and get familiar with Schema.

SVN: It works very nicely for team development. By having a master copy of the working code, we can still share code and make progress without meeting face to face. I personally keep the source code for commit and update in a separate folder than the workspace folder in eclipse. This turned out to be a good choice I think, because some of my classmates informed me they are having problem when they commit or update the code straight from the workspace folder in eclipse.

Google project hosting: This turned out to be a much better service than what I expected. It helps us organize the project in a consistent manner. However, I do not really understand the purpose of the Wiki pages functionality. They seem to be only some text files with a .wiki extension. Also, the naming restriction of these Wiki pages is quite weird: It does not allow spaces or some special characters. Nonetheless, Google project hosting is satisfactory for me.

Group software development: I am lucky enough to have a good group for this assignment. We meet twice for long period of time during school, which made us finish most parts of assignment. We also tried pair-programming during the time we meet, and it was very helpful. Many errors or potential bugs, which might take several minutes to discover if we writing the code individually, were caught right at the time when we were writing the code. I do think it improve the speed of producing high quality code. For the Scrum methodology approach, since we were doing pair-programming, many tasks were accomplished together, but we still tried our best to make everyone to do everything.

JUnit: Once again, I feel a little powerless when it comes to void method test case in JUnit, especially the System.out.println() method. Since the objective of this assignment is to print out tables, which obviously should be using void method, the test cases are more or less impractical. They seem to be just for the purpose of fulfilling the Emma coverage. We tried to use Boolean as a return value to do error checking for these print methods, but the data in this assignment is all given by the XML files, thus we cannot even produce an error case in the testing, which makes the error case never being executed.

Thursday, October 4, 2007

CM Practice

Project Homepage
Discussion Group
SVN Group

Comparing to the WebSpider assignment, this is a relatively easy assignment. I was able to accomplish all three tasks. Although this task is simple, I still encountered some difficulties.

The first problem for me was the authentication of the tortoiseSVN. Thanks to the Prof. Johnson's help, I figured out that it was the HTTPS prefix of the URL screwed me over. When the HTTPS is used, that means an encrypted connection between the browser and website is established. In the HTTP case, the connection is unencrypted, and thus the write access is granted. Although I have heard about this concept before, this is actually the first time I encounter a problem caused by it.

The second problem is the mailing list setting for my project. The PDF file from the class website is unclear and different from what I see in the website, which made me a little confusing. Fortunately with the help from my classmates, I am able to solve the problem. I also commit twice to the SVN to make sure that there is a notification sends out to the mailing list whenever I do a commit. It would be much better that Google can integrate this functionality into its project hosting page.

From this assignment, I learned how to host a project use Google hosting, and I clarify the mechanism of how the SVN works. I had used SVN in a previous class, but there were a lot of troubles because the instructor did not teach us anything about it. Terms like trunk, commit, and configuration really confused me. This time I actually realize the advantages of using SVN, which I believe it will be a great help to my group project in the rest of the semester.

Monday, October 1, 2007

WebSpider Review

The package I reviewed is from Laura Matsuo. The following is my result for the reviews:

1. Installation Review


I downloaded the zip file from Laura's blog, and the installation process went very smoothly with only a few modifications, such as renaming the files and folders. I noticed that the zip file comes with 3 text files: a.txt, b.txt, c.txt. They seem to be some logging output files, but I think they are only for intermediate testing purpose. Also, there are 2 jar files already included in the package: webspider.jar and webspider-lauramat.jar. I think the author forgot to delete these jar files before distributing the package. Nonetheless, the jar file can be correctly created using the ant jar command.


For the QA tools testing, I was a little surprised that the verify test did not pass. Therefore, I went to run the test tool one by one, and here are the results:
JUnit: Successful, but there are a lot of logging info printed out, and it made the output in the command prompt a little bit messy.
Checkstyle: Successful.
PMD: 1 rule violation "assertTrue(true) or similar statements are unnecessary". This comes from the main method testing. As the Prof. Johnson said, the main method is evil, and I think the author did this in order to complete the 100% coverage in Emma.
FindBugs: Successful.
Emma: Successful with 100% coverage to all classes, methods, blocks and lines.


For the program execution, I invoked the command "java –jar webspider-lauramat.jar –totallinks
http://www.hackystat.org 100", and the result was 1553 links. Regardless this result is correct or not, the program seemed to be functioning correctly. However, I found one thing that is a little inconsistent: the arguments are passed and checked as an array, but the order of the arguments does not affect the program because they are checked in a way such that as long as they are valid, they will be passed. This is not consistent with the normal way of invoking this program, which I tend to consider it as a bad thing.

2. Code Format and Convention Review


The source codes are very nicely written and documented. I did not find any apparent violation in terms of coding convention. Also, the methods are highly modulized, thus it was actually quite easy to understand the code.

3. Test Case Review

All testing methods do not contain the annotation of "@Test". I am not sure whether the annotation is needed when the test class extends the TestCase class, since there will be error when I tried to add back the @Test annotation.

Black box perspective: All the public methods are tested directly or indirectly. The two major tasks are tested through the website
http://www2.hawaii.edu/~lauramat/myfavorites/. For the total links task and the most popular page task, the test cases are correct by comparing to the expect results. The test cases also included the boundaries input, such as an invalid URL, an invalid page, and a page with no link. However, the program did not include test cases like invalid number of pages (negative number, very large number) to crawl through, or a page with link points to itself.

White box perspective: The author did a very good job on this one. The Emma summary is as below:
class: 100% (2/2)
method: 100% (26/26)
block: 100% (648/648)
line: 100% (136/136)
Every single line of code has been tested, although this does not guarantee high quality codes, it is still an outstanding sign for the completeness of the testing.

Break the buggah: I used Prof. Johnson's myspace
website to run through the total links task, the program seemed to be crushed because of the JavaScript content, even though it still returned a result of 0 links found in the first 100 pages. On the other hand, I tried to omit the number of pages argument, and the program went to find the total number of links on the first page, instead of reporting the missing of the argument.

4. Summary and Lessons Learned


From review Laura's code, I learned that a nicely written code is very self-explaining. I actually enjoyed reading her code while doing this review. I am pretty sure that my reviewer is going to have a hard time to read through my code since they are quite messy and poorly commented. Also, I learned that when we distribute a package, we should always check the content of package to make sure there is no missing files or extra files.


On the other hand, I notice that testing can be very tricky. When I wrote my test cases, not all the exceptions cases are included, and I did not have the black box and white box perspective in mind. From now on I should pay more attention in writing test cases using the different perspectives because they can complement each other.

Wednesday, September 26, 2007

WebSpider Improvement

Thanks to the two days extension, now I am finally able to finish this assignment. I improved my program so that now it can perform all the tasks, although I am not sure is it performing it correctly since there is no official correct answer. My source code can be found in here.

My external resources were mostly from my classmates’ codes and the discussion from google group, especially the ones from Jared Sunouchi and Ka Yee Leung. Also, the test website created by Randy Cox was very helpful. I could have a general idea of whether I am doing the correct things or not.

During the time I tried to accomplish task 2, I found out that finding the most popular page and finding the total number links share a lot of same code. I tried to merge these two methods together, but these methods return two different types of values, which is troublesome to fix. Therefore, I kept them separated. For the task 3, the java logging package turned out to be easier to use than I expected. It is like a more sophisticated System.out.println. I think I will start using it more for the later programs in this class.

The QA tools’ testing was ok. However, findbugs and PMD sometimes will report error that is counterpart for each other, which took me a while to figure out a solution. For the Emma, I only got the 100% coverage for classes and methods level, but I think that should be sufficient since the JUnit tests were mostly written to satisfy the coverage in Emma, they did not guarantee high quality codes anyways.

Overall, this assignment is very challenging. I feel lucky that I could have the extension to finish it, also thanks to my smart classmates. Their clever ideas have helped me a lot in this assignment.

Monday, September 24, 2007

WebSpider

This assignment is the first ICS class assignment that I could not finish. It is so difficult that I could only finished task 0, and I only partially finished the task 1 such that it could find out the number of links found in the crawling, and this was heavily inspired by Jared Sunouchi's code. The link to my code can be found in here. There are several problems that prevented me from accomplishing the tasks.

The first problem was the JUnit test for the main method. Since there is no test that works for type "void", I had to construct some dummy tests to just satisfy the JUnit and Emma. Although I got 100% coverage, I obviously do not consider them as effective testing. I think I still need to learn more about JUnit to write high quality testing.

The second problem was invoking the program using command line arguments. This really threw me off because the hyphen of some arguments, such as the one for "totallinks". I thought it would be a parameter to invoke the program to perform a specific task, which I totally did not expect it to be an arguments for the main method.

The last problem, which was also the most difficult problem for me to finish this assignment, was the implementation of a web crawler using httpunit. I never write a web crawler program before, thus it takes me a long time to try to figure out a recursive method to find the total links. Disappointedly, I still ended up using an iterative method. The usage of httpunit added more harshness to this task. The relationship among the classes, such as the WebConversation, WebResponse, and WebRequest is still confusing for me.

Since I am not able to completely finish the task 1, my attempt for task 2 was not successful. I could have done task 3 using System.out.println, but I did not do it since it is not efficient and not elegant.

The most important lesson I learn from this assignment was not to procrastinate. It would be much better that if I could start this assignment early, and it also would be more helpful that I could post question early on the discussion page. I could not even get to this far without the help from my classmates.

Monday, September 17, 2007

Stack Program with QA Tools

I have completed the five assigned tasks successfully. The program zip file is hosting in here, and I also uploaded the reports for the different QA tools: Checkstyle, FindBugs, PMD, JUnit, SCLC, Javadoc, JavaNCSS, Emma.

There are several problems that I ran into during this assignment. First is the installation of the QA tools. Without the easy setup.exe or install.exe files, it took me a while to figure out how to correctly setup the environmental variables to install these tools. Luckily these tools all have good documentations, so this problem was not a big issue. Second problem is the confusion caused by the shared output directory of eclipse and Ant. It bothered me for quite a while, but Professor Johnson helped me solve it very quickly. It was not that bad either. Last problem is the XML build file for the JavaNCSS, which I still not fully satisfied with my current compromising solution.

The XML format used by the Ant is quite confusing to me, since this is the first time I encountered the XML scripting. Although there are some tutorials available online and I got some helps from my classmates, I have not found enough information to solve my problem elegantly. More specifically, there is one checking that I wanted to make sure the presence of JavaNCSS in the system, but it involved of checking multiple files. The checking that I know how to use can only check one file at a time, so I ended up with doing three checking, which I believed is not the best solution. However, due to the knowledge I have for XML and Ant, as well as the time limitation for the assignment, I could not come up with a better solution.

In terms of my impression to Ant, I think it is a really powerful build tool for Java and it is not terribly hard to learn. Although it would be much nicer that Ant can provide a better GUI for novice user like me. The motivation of using all these QA tools seems to be very reasonable and convincing, and I even think there should be a more universal standard for these QA tools to help programmers to focus on coding rather than focusing on problems like integrating different modules from different platforms, which sometimes consume a lot of time. As for the counting tools SCLC and JavaNCSS, I personally like JavaNCSS more simply because it provides a very friendly GUI mode, which is easy to use. Also I know more about JavaNCSS now since I spent quite a bit of time writing its build file.

In a word, this assignment provided me a broad overview of some popular Java QA tools, and it is very beneficial to build up my knowledge of software engineering.

Wednesday, September 5, 2007

Code Ruler Redux

We have made several improvements to our Code Ruler program. The result turned out to be quite well, and our ruler now stands a higher chance against the Split Up Ruler. The source code can be found here.

The first improvement is the movement of the peasants. After several modifications of the code, we are finally able to move the peasants in a more effective way: now it will not move into the already-captured square whenever is possible. This is the same idea we had before, but the old code did not work correctly. Also, we got rid of the center-moving of the early peasant movement, since it is only a compromise strategy for the old incorrect code and it is no longer needed.

The second improvement is the strategy we used for the knights. Since we found out that capturing castles does not give points, and our knights would only end up trying to capture the castle, we decided to change the targets. We assign the knight with an arbitrary target, which is not necessarily a castle, and we make the knight tries to capture anything that is on its way. This is a much more aggressive strategy, and it seems working well.

The last improvement is the coding style. We changed indentation to two spaces, added spaces and curly braces for readability, etc. we have tried our best to match the standard Java style.

Saturday, September 1, 2007

Code Ruler Review

I am assigned to review Marcius and Ka Yee’s code. Their code does not have many violations of the Java standard, and I am a little surprised that they are actually using the two spaces indentation. Here is a table of the violation of their code:
FileLinesViolationComments
MyRuler.java92,152,158, *EJS-76The “if” should always has curly brace
MyRuler.java106,136EJS-5The “else if” should be on the next line
MyRuler.java124EJS-61Avoid the use of end-line comment
MyRuler.java9,149EJS-6Comment longer than 100 characters
MyRuler.java79,97,129ICS-SE-JAVA-9Prefer using for/in structure

I like the idea how they split up the knights into two groups, which is similar to the built-in split up ruler. Also from the result of their testing, it seems this strategy has worked quite nicely against the built-in ruler. Overall this is a nicely written code.

Wednesday, August 29, 2007

Code Ruler Result

I finished the Code Ruler program with my partner, Zhong Rong Lao (Jon Lao). The zip file of the source code can be found in here.

As for the strategy evaluation, since I implemented the strategy as competing with all three other rulers, it turned out to be a little surprising when I did the one-on-one competition with each ruler for the homework. Nevertheless, I am still satisfied with the result, here is a table showing the score of each run:



Test Run: 1st run 2nd run 3rd run
jliao-rong/migrate 570/0 616/5 623/17
jliao-rong/gang up 461/167 523/120 544/104
jliao-rong/split up 58/563 264/412 417/190

The strategy I used is quite simple: at the beginning of the match, move the peasant to the center of the map, then span out from there. This gives me a faster way to cover 124 squares, which is the minimum to produce more units. Also at the same time, I move my knights towards other castles and try to capture them. If there are enemy peasants or knights on the way, capture them as well, but the castles are always the primary targets. This strategy seems to be working a lot better when there are more than two rulers competing. Even though the strategy is simple, but implement it is not very easy. There are still minor errors, such as the rarely-happen overtime. However, due to the time constrain and programming ability, we are unable to fix these minor bugs.

On the other hand, I learned a lot from this assignment. First of all, I am very happy to see how eclipse has helped me to find out many typo-kind mistakes, such as the missing semicolon. Also, the debugger along with the break-point is very handy, and it helped me solved many errors that were hard to notice by simply running the program. Secondly, the Code Ruler is a very funny game. Trying to implement a strategy to beat up the computer is not only a great pleasure, but also is a very challenging task. Java has played an important role here. The javadoc of Code Ruler is very clear, which helped me to understand the program faster. Lastly, working with another person is a great experience. I had worked in teams before, in my opinion, communication is the most important thing for the success of the team. With good communication, a team works as one person, but performs better than one person; with bad communication, a team works as more than one person, but perform worse than one person.

Saturday, August 25, 2007

OSS Experience: Dancing Sudoku

The software I chose to download is Dancing Sudoku. As a popular riddle game, Sudoku has a fairly simple rule, yet its fun is easily addicting, just like the Tetris. The goal of Dancing Sudoku is to become a very fast and easy to use Java tool for generating and solving Sudoku puzzles. It includes 4x4, 9x9, and 16x16 dimensional Sudoku. The secret to create and solve all these different Sudokus is the usage of Donald Knuths exact cover algorithm.

As for the first prime directive, Dancing Sudoku has done a good job: create and solve Sudokus for the users. There are many Sudoku games available in books, newspaper, or some other paper medium. However, they can only provide limited amount of games to the users, whereas Dancing Sudoku can easily create as many games as the users want. Also, the Dancing Sudoku has a save/load functionality which allows the user to save different Sudoku games and load them to continue playing anytime they want.

Although Dancing Sudoku has done a good job for first prime directive, it sort of fails on the second prime directive. Unzipping the package is easy, yet to install and run the software is a little tricky, especially for people who have no experience with java or batch file. There is no real installation required to run the software because it is already packed up into one single jar file, which is an executable file, but this is not known to many people. Luckily the batch file is named "run", which is a big clue for starting up the application. The batch file basically executes a command to pack up all the class files into a jar file, yet the purpose of this batch file is uncertain for me, since the jar file is already provided. After starting up the application, it is quite easy to use. The interface is clearly layout, and there should be no difficulty for people who know how to play Sudoku to run the application.

Lastly for the third prime directive, since Dancing Sudoku is an open source project, its source code can be easily obtained from SourceForge website. However, I think the developer could have done a better job for providing more technical documentation, such as a list for the classes and functions. There is a PDF file which I think is served as the documentation, but it mainly contains the discussion of the algorithm for creating and solve the Sudoku-like problem. It is more of an academic paper. Despite the lack of a detailed documentation, this application is actually very small, and it only contains five source java files. An experience programmer who understands the algorithm it used should be able to modify and improve the application quickly.

Thursday, August 23, 2007

CodeRuler: It Runs!

Well, I downloaded the CodeRuler zip file, and tried to follow the instruction on that requirement page, and somehow it turned out to be a little misleading. I have "c:\eclipse" as the directory in which the Eclipse is installed, and I ended up creating another eclipse folder inside it to hold the unzip files. It took me a while to figure out that all I really have to do is just unzip the two jar files into the plugins folder which is under the original eclipse folder. :(

Anyways, so then I could create a game project for the CodeRuler. Then I simply copied and pasted some code that controls the peasants from the article "
Conquer medieval kingdoms with CodeRuler", since I just want to test if the game runs, the article has enough code to do that.

After a few small modifications to the code, my CodeRuler finally runs! Oh well, it didn't even score 300 though. However, it's a good start. Next, I will be reading through the article and try to add some tricks to my CodeRuler. :)


By the way, my eclipse takes literally about 1 minute to start up, anyone has a similar case or know how to make it faster? (my laptop is a Dell XPS M1210, which I believe is quite a fast laptop)

FizzBuzz Program

Ok, so I finally got the FizzBuzz program down. Here is the code:

public class FizzBuzzApp {
public static void main(String[] args) {
for ( int i = 1; i <= 100; i++ ) {
if ( i % 3 == 0 && i % 5 == 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 );
}
}
}



It took me about 20 minutes to finish this program, including the time I spent for the "hello world" tutorial in eclipse. The process went smoothly. Even though I haven't been programming in Java for quite a while, with the ease of eclipse, I did not encounter much difficulties.

Programming in eclipse reminds the first time I tried to use an IDE like VS.net, which I found it is really hard and unnecessary to to do my school programming work in a such gigantic monster-like software. What in the world is build? Why is to debug but not run? The simple "code-compile-run" method using in the notepad has already coined into my mind firmly. Until one time I saw one of my former professors to debug my program using the VS.net, then I finally notice the power of an IDE. Automatically complete the repeated code, setting break point and step forward in the program, open multiple windows to compare similar code sessions, etc. There are just so much more things we can do in IDE, and we can do them so much better, easier, and faster.

Thereafter, I strongly feel that if someone ever wants to do some serious programming, using an IDE is the only way to go. There is simply no reason to go back to notepad. Not at all.