Thursday, November 15, 2007

29.MyIsern-1.3-review

Project Reviewed:

MyISERN-1-RED
Authors that I am Reviewing: Sonwright M. Gomez, Phuoc Le, and Ivan Wu


1. Installation Review


I was able to download the system as a distribution .zip file. However, I was not able to use the system without using the web interface (there was no jar file or means to create one). It was not difficult to figure out how to run system, I simply had to change the tomcat manager password to match my password, then type the command "ant -f tomcat.build.xml" and then point my web browser to "http://localhost:8080/myisern-1-red/". The installation guide was clear, concise, and easy to follow as it mentioned the above steps to use the system (but did not mention anything about changing the password or user name for the tomcat manager).

Here are the results from invoking the following ant tasks:


JUnit ran successfully

Checkstyle ran successfully

PMD ran successfully

FindBugs ran successfully

ant -f verify.build.xml ran successfully.


2. Code format and conventions review


The code is very well organized into distinct modules. Other than some inconsistencies between the format of the javadoc tags (some have a space between the description and the other @return, @param, etc. and some don't), I see no real format or conventions errors.























FileLinesViolationComments
MyIsernModel.java45, 47, 315, *Unused ContentWill probably be used as the system is fully implemented
TestMainMenuActionBean.java31, 33EJS-5Indent 2 spaces




3. Test case review


Black Box Perspective


Black box testing is incomplete. Due to time constraints, the newly created classes for the web application have not been tested. Also, the myIsernXmlLoader class is not tested thoroughly even though it should have been tested in previous versions. Because it is not tested thoroughly some of the classes in the collaborations, organizations, and researchers packages are not tested either. Overall, black box testing does not establish all the equivalence classes and as a result, does not test a member of each of them. Once again, however, this is likely due to time constraints.

Thoroughly testing the myIsernXmlLoader will generate the necessary equivalence classes in the collaborations, organizations, and researchers packages. Additionally, testing on the server side should generate the necessary equivalence classes in the action package.


White Box Perspective


Because the black box testing does not generate all the equivalence classes, white box testing it not nearly complete. Here are the results from running Emma:




























Emma Coverage Summary
class:60%15/25
method:25%54/215
block:29%706/2434
line:26%165.2/626




As is shown, the coverage is not good as the vast majority of methods are never tested. Once again because the myIsernXmlLoader is not tested thoroughly the coverage on the non-web app side suffers. Also, once the web application is tested, the web app side of the white box testing will be dramatically better.


Break da buggah


The red group did a good job of stating the known issues with their system up front. Because of this, I cannot really break their system without overlapping one of the known issues.

So instead, I'll just offer some ideas for printing/displaying researchers, organizations, and collaborations. Based on the way your current system is set up, you can display/print the type you want by creating variables in your DisplayActionBean class to let your jsp page know which one you want to display (collaborations, organizations, researchers). So before you forward the resolution (printCollaborations(), printOrganizations(), printResearchers()) you can set the appropriate variable and check for it in your jsp page by using the jstl tag or (if/else if/else). So your current would be inside of a or for example.


4. User Interface review


The interface is very easy to use because it is very intuitive. All the links are clearly labeled and the buttons are very descriptive. The only thing I would recommend is not abbreviating the researchers as R, the collaboartions as C, and the organizations as O for the edit feature.

As far as screen real estate is concerned the web application works very well with a large screen as well as a very small screen. I see no room for improvement in this area.

In general, the only improvements I see is to finish implementing all the actions and to allow for display by category (i.e. just collaborations, just organizations, and just researchers).

5. Summary and Lessons Learned


After looking at Team Red's code I realized that a simple interface can be very good especially when screen real estate is a design issue. A simple design is very compatible with a small screen in particular. Also, it was very interesting to see another group's version of the web application. To be able to see their interpretation and implementation of the requirements now provides me with a chance to go back and take a "new" look at my group's web application.

Saturday, November 3, 2007

25.WebAppQuestions

1. Explain in your own words the meaning of the web "request-response cycle".

A client makes a request for information from a web-server. The web-server will then try to match this request with the appropriate response. An example of a typical response would be a HTML page. When the client receives the response, the client can then make another request which will trigger another response, thus forming a request-response cycle.

2. Explain how servlets facilitate processing of the request-response cycle.

Servlets expand the ability of the request-response cycle, by allowing for dynamic content to be included in responses. Since they are Java classes, they can be easily tailored to fit the domain in which they will be used.

3. How do you login to the Tomcat Manager?

If Tomcat is running, simply direct your web browser to the url http://localhost:8080/. Then click on the link: "Tomcat Manager" and type in the user id and corresponding password. If Tomcat is not running type in "startup" on the command line (assuming you have added the Tomcat bin folder to your path environment variable) and follow the above steps.

4. What is the Tomcat Manager used for in the StackStripes application?

The Tomcat Manager is used to deploy the StackStripes 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 the system name ("stackstripes" or "stackstripes-" for instance). Inside that directory there are jsp files which are the homepage and other pages for the web application. Then there is a "META-INF" subdirectory and a "WEB-INF" subdirectory. The "META-INF" directory contains meta information about the web application. The "WEB-INF" directory contains the configuration file "web.xml", along with a "classes" directory, a "lib" directory, and possibly a tags directory. The "classes" directory contains properties files and the java classes. The "lib" directory contains the jar files used by the web application. The "tags" directory contains implementations of tag libraries.

6. How do you build a war directory structure in Ant? Where is this accomplished in the StackStripes application?

Using a build.xml file, you need to create an Ant task which extends a the Ant task used to create a jar file. The extension comes from the fact that you need to "WEB-INF" directory and all the subdirectories and files stored there. An example taken from the Ant Manual is shown below:



In the StackStripes application, this is accomplished in the "build.xml" file in the following manner:



7. How do you install a war directory in a running Tomcat server? What information does the Ant task need to accomplish this?

You simply copy the .war file and paste it into the $CATALINA.HOME/webapps directory. If you are using an Ant task to do this, then you simply set the location to copy the .war file to $CATLINA.HOME/webapps directory.

8. What is the "Model2" architecture? What are its advantages?

The Model2 or MVC (Model-View-Controller) architecture, is a software engineering design where the model or the data is separated from the user interface or view, in order for each to be unaffected by changes to the other. This is accomplished by adding a controller that handles the interaction between the model and the view.

9. What are JSP pages? How are they related to servlets?

A JSP page is a page that allows for both static and dynamic content to be generated on the same text-based page. The static content can be rendered in a number of formats including: HTML, WML, and XML. The dynamic content is generated using JSP elements.

10. Why is there a delay when retrieving a JSP page for the first time? Where is the Java code for that page stored?

When a JSP handles a request for the first time, the JSP page must be translated and compiled into a servlet class. The servlet class is stored in the J2EE_HOME directory so that if JSP page is called on to handle another request, it does not have to be translated and compiled again.

11. What are JSTL tags? Why are they useful? What is an example JSTL tag from the StackStripes system?

JSTL are tag libraries that allow JSP pages to have functionality in areas such as basic scripting functions, XML processing, formatting, and database access. JSTL tags are useful because they are in XML format which allows for people who are not experienced with programming to use them more easily. An example of a JSTL tag from StackStripes is shown below:



12. What are Stripes tags? Why are they useful? What is an example Stripes tag from the StackStripes system?

Stripe tags link buttons and fields on a webpage to methods in the web applications java classes. The tags are useful because they easily link the webpage to the ActionBean class through the get/set methods and any handler methods. An
exammple of a Stripes tag from the StackStripes system is shown below:



This tag links the button called "Double It" to the method doubleIt in the StackActionBean class.

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 allows for a webpage to be accessed via programmable code rather than through a browser. HttpUnit is different from JUnit because it allows for webpages and web applications to be tested whereas JUnit only tests code. This is also why HttpUnit is useful. An example of HttpUnit from the StackStripes system is shown below:

WebForm pushForm = response.getFormWithID(pushFormParameter);
WebRequest pushRequest = pushForm.getRequest();
pushRequest.setParameter(numToPushParameter, "1");
response = conversation.getResponse(pushRequest);

This code pushes the number "1" onto the stack in the StackStripes web application.

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?

The "index.jsp" page had to be modified to add a button for the double it feature using the stripes tag for buttons. The StackActionBean and StackModel classes had to be modified to add the appropriate doubleIt methods. Nothing else had to be modified (the controller remained the same). Because of that, I learned that the MVC design pattern is flexible and allows for easy additions.

15. What are the equivalence classes that need to be tested for the Double It button?

Test the double it button on an empty stack, a small stack, and a large stack.

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 states that there is only one instance of a class that is instantiated. An example of it in StackStripes is:

private static StackModel theInstance = new StackModel();
private ClearStack stack;
private StackModel() {
this.stack = new ClearStack();
}

It is needed so that everyone who is using the class is using the same instance of it.

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?

TestStackModel.java exercises code on the client side. TestStackActionBean exercises code on the server side. In order for Emma to report on the server side coverage, Tomcat must be shutdown first.

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:
Checks to make sure that tomcat is running.

tomcat.undeploy:
Undeploys/removes the web application from Tomcat.

compile:
Compiles all the code.

war:
Builds the war directory structure.

tomcat.deploy:
Deploys/adds the web application to Tomcat.

junit.tool:
Runs all JUnit tests.

junit.report:
Creates the HTML JUnit report.

junit:
Checks for JUnit errors and runs junit.tool and junit.report.

Friday, November 2, 2007

26.StackStripesExtension

Distribution download: StackStripes Implementation

All tasks were completed successfully. Emma coverage is at 100% and the "Double It" button works as expected.

The most difficult part of this assignment was testing. I had to adjust a little to getting used to testing both the client and server side of the application. In one sense, it almost felt like testing the same thing twice. For instance, you test the stack model's push and pop feature, but then you also have to test the actual web application's push and pop feature, by interacting with it through HttpUnit. In past assignments, all we did was test our code (the client side) and that was it.

As far as working with Tomcat, JSP, JSTL, Stripes, and HttpUnit I felt that they were all pretty easy to get a handle on as long as you looked over the documentation and readings that were provided with them. I really like how easy and intuitive it is to use Stripes and JSP to create a web application. However, I am not sure that my opinion on this will remain the same once we try to tackle a far more complex web application such as the MyISERN system.