Thursday, November 15, 2007

29.MyIsern-1.3-review

1. Installation Review
I have downloaded the gold's team ISERN 1.3 package from this link. First I was able to download, install, and run the system with no problem using ant. Then I tried running it with java -jar but the build.xml file does not have this target. The verify target passed with no errors, however Emma reported coverage in the range of 20-48, which is not too bad because mine was much lower. I did not find any installation guide.

2. Code format and conventions review
All the code format as well as comments are well written, besides that one "Web interface for the researchers page." which I found in all three action bean files. I am not certain whether it is right or wrong. However, even if it is right it doesn't say much about a class.

3. Test case review
It seems like there are only to classes to test MyIsernAction and MyIsern Model. MyIsernModel is tested well from both the black box and white box perspective. Only one Method the add/edit method was not tested at all. In addition, the whole MyIsernAction class needs to be tested. I understand that we did not have enough time to perform all the tasks assigned therefore as long as it will be done by Monday, it should be fine. From a break-da-bugha perspective, I clicked around and all the link that are not under construction worked well. Now, I think the assignment says to load the xml files from user.home which is somewhere in Document and Settings/name and create files if they don't exist but it loaded the xml files from the downloaded package.

4. User Interface review
Going to the user interface, it is fairly easy to use. The login and home or main page are on the same page but I assume that this is only so for the time until the login page is fully functional. The website utilizes screen estate average, it would be better if the width is a little smaller, because now it takes a little more than half a screen. I would suggest to rename the top researcher, organization, and collaboration tabs to something like list researcher etc. Since the user is not sure what the tab does until he or she clicks it. I was also a little confused where to edit definitions until I found a little note saying enter name to edit but what am I supposed to do then?

5. Summary and Lessons Learned
I did not learn a lot because it is about how people think about design. If I like a web layout that does not mean that everyone else will like it and vise versa. However, this project shows that at least they got a nice style sheet wrapped around the implementation. That is what I did not have the time for.

Sunday, November 4, 2007

25.WebAppQuestions

1. Explain in your own words the meaning of the web "request-response cycle".
A Web request-response cycle consists of the client's software i.e a Web browser sending requests to the Web server and the servers sending a response. This is a cycle known as the HTTP request/response protocol. The server can accept, process, and return the requested information to the client.

2. Explain how servlets facilitate processing of the request-response cycle.
Servlets are implemented in the Java programming language that run inside a web application server. It handles low level details of the HTML protocol, then it facilitates the request/response cycle by allowing developers to write Java code to handle user request. It also gives an object orient interface.

3. How do you login to the Tomcat Manager?
First of all to access the Tomcat manager one must first add a new username and password and associate the role manger. This must be done in the user.xml file. Then you go to this URL the http://localhost:[and the port], where you can login with the set username and password in the user.xml file.

4. What is the Tomcat Manager used for in the StackStripes application?
The Tomcat Manager is used in the StackStripes application for conviniently executing manager commands with Ant. Specifically, in the StackStripes application we use the deploy and undeploy tasks.

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 Web module structure contains an assembly root directory that has JSP pages, static HTML pages, and applet classes and a WEB-INF subdirectory. The WEB-INF directory contains files such as web.xml, sun-web.xml, and *.tld. It has the lib, classes, and tags as its subdirectories. The lib directory contains all library archive files. The classes directory contains all server-side .class files for the instance of the current web module, and the tags directory contains all .tag files.

6. How do you build a war directory structure in Ant? Where is this accomplished in the StackStripes application?
To build a WAR file under Ant you must specify the dest webxml and destfile targets. In the StackStripe application this is done in the build.xml file with the war target.

7. How do you install a war directory in a running Tomcat server? What information does the Ant task need to accomplish this?
You can use the Tomcat server's deploy tool, the asAnt creat-war, or just simply copy the war file into the Webapps directory since it will find and install any war files which reside in that directory. The Ant task needs to know where the WebBass directory resides.

8. What is the "Model2" architecture? What are its advantages?
Model 2 architecture uses Model-View-Controller design pattern to separate presentation from content. The controller's job is to pass the request to the right view (JSP), which in turn invokes the JavaBean which then may access a database.
The advantages of Model2 architecture is that it brings the "write once, run anywhere" paradigm to interactive Web pages, it is also fairly simple to learn and wield Java as a server-side scripting language. However the biggest advantage is that it helps effectively separate presentation from content.

9. What are JSP pages? How are they related to servlets?
JSP (Java Server Pages) is a language that allows easy creation of web content that contain both static and dynamic components. JSP are text based documents that contain implementation of how to process a request and construct a response. They also are extensions to servlets. When a request to a JSP is made, it looks if the the JSP pages's servlet is older than the JSP page itself. If this is the case it will translate the JSP page into a servlet class. The advantage is that the compilation is automated.

10. Why is there a delay when retrieving a JSP page for the first time? Where is the Java code for that page stored?
The delay occurs because the JSP page must be translated, compiled, and checked for errors when loaded the first time. I could not find any information on where the Java code is stored but I assume it is stored on the server side.

11. What are JSTL tags? Why are they useful? What is an example JSTL tag from the StackStripes system?
JSTL contains sets of standard tag libraries that give the required functionality which are needed when writing dynamic JSP pages. They are useful because they fix the shortcomings of JSP scriptlet tags. A JSTL tag used in StackStripes is for each.

12. What are Stripes tags? Why are they useful? What is an example Stripes tag from the StackStripes system?
Stipes tags are tags defined in the standard tag library and a dynamic attribute tag library. They are useful because they give easy implementation for comunication between the Web page and the Java code. Example Stripes tag:

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?
Programmers can use HttpUnit to imitate a real mouse click on a Web link. Therefore, it is crucial for writing test cases for programs with Web applications, whereas JUnit can only test the client site program. An example from the StackStripes is: WebConversation conversation = new WebConversation();

// Get welcome.jsp page and check for successful retrieval
String Url = testHost + "stackstripes";
WebResponse response = conversation.getResponse(Url);

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?
In order to implement the Double It button the index.jsp needed to include a submit tag with the name doubleIt and value Double It. The stackModel class needed a new doubleIt method and the StackActionBean class needed a new doubleIt Resolution method. No other methods or code needed to be changed. This exercise nicely illustrates the MVC design. By doing this exercise I learned how it all works.

15. What are the equivalence classes that need to be tested for the Double It button?
From a black box perspective it is good to test for the empty stack, stack with one item, average items, and many items. But since we only need to make sure that the doubleing works, it should be sufficient to push an item onto the stack and then simulate the double it click and check that the items doubled.

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 hitting Double It:


After hitting Double It:


17. What is the singleton design pattern? What is an example of its use in StackStripes? Why is it needed?
A singleton design pattern is supported by the static keyword. This allows working only on one object. Therefore, no other class or method can make a copy of that object, but rather access it directly via getting an instance of it. I think this is needed because we have to make sure, with the synchronized keyword, that we change only one object at the same time. An example is:
private static StackModel theInstance = new StackModel();

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 server side tests are in StackActionBean whereas the client side test are in StackModel. Emma gathers the needed data when from the Tomcat server and creates the appropriate coverage. However, the coverage is not available until the Tomcat server is shut down.

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.ckeck, makes sure that the server is running and that we have access to it.
tomcat.undeploy, removes stackStripes from the Tomcat server.
compile, compiles the code.
war, builds the directory structure need for tomcat deployment.
tomcat.deploy, deploys the war directory into Tomcat server.
junit.tool, execute junit test on the server and client side.
junit.report, creates a HTML junit reprot.
junit, runs junit.tool, junit.report and shows errors as encountered.

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 only created Web sites using basic HTML and Notepad, so I don't have any experience with such applications, but Stripes seems fairly easy to use.

Thursday, November 1, 2007

26.StackStripesExtension

The goal of this assignment was to gain some initial familiarity with new technologies including: Tomcat, JSP, JSTL, Stripes, and HttpUnit and to understand how to apply our previous experiences with Java, Ant, JUnit, PMD, FindBugs, Checkstyle, etc. to the domain of web application development.

What was difficult about this assignment?
I have completed all the tasks for this assignment, therefore I gained a lot of knowledge about building Web applications and using tools such as JSP, JSTL, and Stripes. The major task for this assignment was to understand how the index.jsp, StackActioanBean class, and the StackModel class all communicate and work together.
Now I understand that the index.jsp is the actual web page. When the user clicks on any button on that web page the index.jsp sends this information to the appropriate method in StackActionBean class. The code in the StackActionBean class calls methods in StackModel class, which perform the actual processing. After the call returns the StackActionBean class returns the modified index.jsp and it is displayed on to the web site. This was not hard to figure out but it was essential to understand this process before enhancing StackStripes.

What problems were encountered in carrying out the work
First of all, I made a really stupid mistake. The instructions in the assignment say: "If you are on Windows, you will also need to edit the file conf/context.xml file to change the <Context> tag to include the antiJARLocking and antiResourceLocking attributes as follows: <Context antiJARLocking="true" antiResourceLocking="true">" Even though it is very clear what to do, I just copied the line and inserted it between the already existing <Context> </Context> tags. That is why I was not able to connect to http://localhost:8080 and had to trace all the installation tasks back to figure out the problem. My bad, it took me an additional hour to figure that bug out. In addition, when I wrote test code for the stack pop method, I realized that the stack still contained values which were pushed onto the stack in a previously called test method. I tired to solve it by getting an instance of the stack and calling the stack clear method but this did not work. So, I decide to leave the values for testing the pop method.

Monday, October 22, 2007

21.MyISERN-1.2

The goal of this assignment is to continue developing our group-based software engineering skills and begin developing the ability to present our system status to "management".

Distribution package

All tasks were completed!

What was difficult about this assignment?
In my opinion, there were not many real challenges when coding this assignment. However, I found that there was lots of code to write. The three add methods where pretty easy to implement. But the edit was a little bit more difficult. Therefore, to change the state we decided to make the xmlLoader object static. When the user finally decides not to save the changes, the xmlLoader object gets assigned to the previous state, the state before the user started the edit. Another, difficult task was to write test cases for user input. With our knowledge and tools it is impossible. Since we did not have enough time to learn new tools, we decided to write good test cases from the black box perspective. However, the user input or standard output is not test and therefore the Emma coverage suffers. This does not mean that our program doesn't perform well! In addition, it was pretty hard to verify if all the links between Collaborations, Organizations, and Researchers are kept valid after adding new instances. We decided to perform checks on empty name field, uniqueness of id, year, and verify that organization exists when adding new Researchers and Collaborations. However, we did not make sure that all the Researchers exist when adding Collaborations or Organizations since this would go into an infinite loop, never solving the problem.

What problems were encountered in organizing the group and carrying out the work?
There were not really any problems with the group. We all decided to start on this assignment early. The first add method we got working on Wednesday and Thursday morning all the other add methods were finished. Then we implemented edit and after that we finished the marshaling methods. However, this was only the code, and we still had to improve the user interface as well as add all the informations.

What will you do differently during the next Milestone to improve the process and the product of your efforts?
Our group work was good and if anything I would like to have more time to meet with the group members to implement the code together. I find that if we work in a group the code gets more efficient and also it is quicker implemented than if a single person thinks and implements all the code. On the other hand when writing all the program by yourself the classes may be better distributed and redundant code is easier to omit. Therefore, one thing that comes to my mind as an improvement would be to actually draw a class hierarchy diagram and follow it for the implementation to omit writing redundant code.

19.UseCaseSpecification

The use case specification assignment helps with becoming familiar with the specification of a system in terms of Use Cases. It also help better understanding the ultimate vision' of MyIsern that we are working toward.

Link to use cases for MyIsern.

Our group extracted ten uses cases from the previous lecture. All use cases are clearly documented however there was no time to include some pictures that illustrate mock ups of the screens that the user would be interacting with. Once we put all the gathered information from the lecture together it was moderately easy to put it into a specific use case. However, this was our first time designing use cases and therefore it may not have all the quality a use case supposed to have.

I learned that use cases may help understand how the whole program will work in the future. The use cases collected from the lecture were already helpful for MyIsern 1.2, when we had to decide on certain code flow. But it was pretty difficult to get all the use cases from the lecture because it sometimes seemed as I could not keep up with the writing. Therefore, it is possible that in the short amount of time, when writing down the use case, I may have interpreted the use differently than expected.

Monday, October 15, 2007

22.MyISERN-1.1 Review

This time we could choose form a list of names containing classmates and students from Software Engineering 613, which is a master's class, who we want to review. I thought it would be more helpful to review code from a person who is approaching higher eduction. Therefore, I chose to review Lisa Chen's code and it was a brightening experience.

Installation Review
I downloaded the MyISERN Milestone package from this link with no problems at all. Once downloaded, I used the unzip feature and I placed the folder into my test directory C:\test. Then, I looked through the downloaded package for its contents. Luckily, the author has thought about the users, and included a Usage file in plain text format in the doc directory documenting all the commands the user could use on the provided system. Since I already opened the file, I decided to copy some of the commands and try it for workability. However when I pasted the first command from that file into command prompt it gave me this error:

COMMAND: C:\test\myisern-xml-1.0.1007>java -jar myisern-1-purple.jar -listCollaborations -organization University_of_Hawaii

ERROR: Unable to access jarfile myisern-1-purple.jar

Then I tried to build a jar file with this:

COMMAND: ant jar
ERROR: Buildfile: build.xml does not exist! Build failed

The issue with this problem was that, once I imported the unzipped project into my Eclipse environment, an additional folder (myisern-xml-1.0.1007) in my C:\test directory was created. So, I cd under command prompt into the wrong folder because I was using the tab and did not pay careful attention to which directory I change to, since the C:\test directory should only contain the project (myisern-xml-1.0.1015).

Once I figured out this problem, I changed to the proper working directoty (myisern-xml-1.0.1015) which contains all the files needed. This time I was sure that the command in the Usage file would work. However, the same error appeared even after using ant jar.

After a long while, I figured out what the problem was. In the Usage file it says to use this command:

java -jar myisern-1-purple.jar -listCollaborations -organization <uniqueID>

but it should actually be this:

java -jar myisern-1.1-purple.jar -listCollaborations -organization <uniqueID>

Did you catch the error? It took me a while to realize that the jar file is wrong in the provided command. Maybe, I should have written up the command on my own and use tab, then I am sure that I would get the right output. Besides, I am still not sure why I got another directory when I imported the project into Eclipse. The directory contains only the .project file.

Code format and conventions
The code looks really nice! It is properly structured into several classes that contain only methods that also represent the class name. There really aren't any problems regarding the code format and conventions. Also, all variables are properly named.
The only suggestion I would like to give is that when you comment out some code
(I think it is for later use) then I would use this pair /* ... */ instead of the line comment //.

Test case review

White Box
Form a white box perspective the test cases cover a huge amount of the code. The Emma report shows 100% class coverage, 97% method coverage, 98% block coverage, 97% line coverage. These numbers are pretty impressive. Since a lot of effort was put to establish the test cases, I would suggest to add the following test.
In MyIsern.java there is a block of code that is run when the semantics of the XML files are incorrect. You could code your own test semantic XML file and run a test on it. Following the Emma coverage, it seems like in class command.java the method setUniqueId is never used.

Black Box
I looked through all the test java files and it seems like all test cases are well written form a black box perspective. I understand that tests were written for equality, null, and for wrong data on all test java files. Job Well Done!

Break da buggah
I tired for a long time to crash the program but I didn't find yet a good solution. It seems to me that you followed all the requirements correctly and also have a well working system. Here is one way I was able to crash it:

command:
java -jar myisern-1.1-purple.jar -listOrganizations -collaborationLevelGreaterThan 9999999999 it printed
error:
java.lang.NumberFormatException.forInputString(Unknown Source)

But I think that this is lame because an integer can only hold a max value of 2147483647 and I don't think that this program will ever have to hold so many Organizations. Moreover, I got the same error when I inputed a string instead of the required integer for -collaborationLevelGreaterThan.

Summary and Lessons Learned
Reviewing a well written code is very good for improving my coding style in object oriented programming. In this code I saw a lot of different opportunities to improve my coding style. In the next assignment I will concentrate on creating a class or methods that will hold values for me. Basically, I will take advantage of get... and set... . Moreover, I will design class that are easier to enhance.

On the other had, I would like to make you aware that when invoking java -jar yourjar.jar the program gives a list of suggested program usage. That list suggest to use a jar file that is not existing. In other words, it seems like you renamed your jar file in build.xml but did not rename it anywhere else. Moreover, I don't know if it was a requirement but it would be nice to have a command to print all the tables, just like in MyISERN-1.0.

It was nice reviewing your code.

18.MyISERN-1.1

Overview
This assignment is a Milestone therefore some really useful information for the everyday user as well as for the developer along with some facts on how to improve this wonderful project can be found at this Google wiki page.

Distribution package

Project Hosting
Discussion Group
SVN Group

As always all tasks were completed

What was difficult about this assignment?
First of all, this assignment required more java coding practices than most previous assignments. Actually, the coding was not the problem. However, in my option the time constrain, from getting the "right" requirements, until our group had a clear understanding of the project and could start coding the assignment was a little short. But it was very useful having three people work on the requirements of this assignment, because each of us had different ideas on how to start the assignment. In addition, it was good that we did not had a conflict of choosing which way to go.

The next major problem in this assignment was when using SVN. Somehow, I coded my part of this assignment and wanted to commit the project, but SVN told me that one or more files might be in a conflict state. Since this was the first time dealing with a conflict all of us spend more then two hours on solving it until all of us had the current version on their machine. That is also why we think that our version number is at least at 45.

Finally, since all of us work and each of us has a different working schedule it was little difficult to make everybody "happy" with the meeting time. Nevertheless, as always, for the first couple days of the week we met for about 30 - 45 minutes and discussed potential questions and problems that might appear in this assignment. Furthermore, the last couple of days we met to code the assignment. It was also difficult to concentrate on the assignment since all of us still had many other assignments due this week (for other classes).

What problems were encountered in organizing the group and carrying out the work?
Despite of a couple of different views of the actual interpretation of the assignment requirements, the whole project went very smooth. One reason for that was, because we met every day to talk about the assignment. Another reason was that we made fast decisions on distributing the work and all of us made sure that the job gets done. Moreover, as described above getting this and other projects done, does require to spend some time on it.

What will you do differently during the next Milestone?
I want to promise myself that I will work on the SVN conflict situation. As for this Milestone we spend way to much time getting rid of the conflict. This time could be used to improve our algorithms, however the conflict happened at the last day before the project was due, and it was kind of annoying having to sit there and not to work on the actual implementation (not fun). Concerning time, we actually spend a relative amount of time on this project, so I hope that for the next Milestone my group members will be also as motivated as our group was for this week.