Monday, October 1, 2007

12.WebSpiderReview

Reviewed Author:
Jon Lao

Installation Review:

I try to run the program in command line but it doesn't work, it has an exception about wrong argument position when Itype default command "java -jar webspider.jar -totallinks http://www.hackystat.org/ 100", Then, I trace the code and see it is not support command line argument, which is cannot use command line to start run the program.

Tool Execution:

Junit - Okey! All test pass.
-------------------------------
Checkstyle
- Fail!
The most reason why fail testing on checkstyle is missing javadoc comment and unclear comment.
-------------------------------
PMD - Fail! Found 8 problems
edu\hawaii\webspider\WebSpiderExample

323_Avoid using implementation types like 'LinkedList'; use the interface instead
270getTotalLinksAvoid reassigning parameters such as 'Url'
398getTotalLinksAn empty statement (semicolon) not part of a loop
3110getMostPopularAn empty statement (semicolon) not part of a loop
3120getLogAvoid using implementation types like 'LinkedList'; use the interface instead
3136checkArgumentsAvoid calling toString() on String objects; this is unnecessary
3139checkArgumentsAvoid calling toString() on String objects; this is unnecessary.


Total number of violations for this class: 7
-------------------------------
FindBugs - Fail!

CorrectnessWarnings1
PerformanceWarnings2
DodgyWarnings1
Total_4


Correctness Warnings
GC com.meterware.httpunit.WebLink is incompatible with expected argument type
java.lang.String in edu.hawaii.webspider.WebSpiderExample.getTotalLinks(String, int)
Bug type GC_UNRELATED_TYPES

Performance Warnings
Dm Method edu.hawaii.webspider.WebSpiderExample.checkArguments(String[]) invokes toString() method on a String
Bug type DM_STRING_TOSTRING
Dm Method edu.hawaii.webspider.WebSpiderExample.getLog(LinkedList) invokes toString()method on a String
Bug type DM_STRING_TOSTRING

Dodgy Warnings
REC Exception is caught when Exception is not thrown in
edu.hawaii.webspider.WebSpiderExample.getTotalLinks(String, int)
-------------------------------
Emma - Okey! Successful run all the test
Emma Coverage summary
class: 100% (1/1)
method: 88% (7/8)
block: 94% (171/181)
line: 90% (43/48)
each type is near 100%. For "method", it get 88% becasue it include one blank method that do nothing with this method.
-------------------------------
Verify - Fail!
Since, checkstyle test is fail before, so that verify.build.xml was stop executed where it got error on checkstyle.
-------------------------------
Dist - Okey!
It successful generate file to C:\eclipse\webspider-rong\build\dist\webspider-rong-1.0.930.zip.
Also, it generate "webspider.jar" at C:\eclipse\webspider-rong, but I cannot successful run the program.

Execution:

I type in default command "java -jar webspider.jar -totallinks http://www.hackystat.org/ 100", but it doesn't run properly.and I try to not input argument, it return right exception message. I try different combination
Code Format and Conventions Review


FileLine# violationComment
WebSpiderExample.java 70,79EJS-25Avoid using uppercase at first letter of each subsequent
WebSpiderExample.java 70,95 EJS-25Avoid using lowercase at firstword
WebSpiderExample.java 75,80,89EJS-9Use meaningful names
WebSpiderExample.java 59EJS-7Only put white space to delineate method, but it is notthe methods



Black Box Perspective:

In this case, the black box perspective that I expect is input something argument and return a reasonable answer.For example, I type this command line "java -jar webspider.jar -totallinks http://www.hackystat.org 100"to run the program with some default argument, that I expect it will return a number of link for the website I type in.If the result is not a number or equal less than zero, that's mean something wrong inside the program.

I tried to not input "-logging" argument in command line that it return error.It's run when I turn on log mode, but return 0 link for default URL, which mean it didn't search for links.

I think Jon's program could allow no page number input that still can show the result. If not input page number thatthe program would find all link until it reach a empty link page.Other black box test case is input a large number at page argument and would crush the program.

White Box Perspective:

I go through Jon's code and see his did not finished getMostPopular method, so that only 88% method coverage in emma reportEmma report also show try and catch statement did not cover in checkArguments method. The main result why the emma reportdid not get 100% because he did not finished getMostPopular method, so most of code cannot coverage.

Break da buggah:

For jon's program, I tried input 9999999999 value to page number, it return 0 link and argument format is invalid.If I input URL that contain javascript, the program will be crush, because it is no try and catch exception implemented.If I not input logging argument, that it return an error.

Summary and Lessons Learned:

For this assignment, I feel my webspider program not doing well after I saw somebody codes, and I found that I spend most oftime on small parts program, and I ignored whole part of program, which is code style, good comment, detail test case and the design of program. These all thing together will make a good program. In this assignment, I learned to be a good programmerthat may need different perspective, because program is a public source that people can use it, and other programmer would read our code, so everytime I write program that need to think about this condition, then start make my program, that could improve the quality of my future software systems.

No comments: