Monday, December 10, 2007

33. PrimeDirectivesRedux

From http://groups.google.com/group/ics-software-engineering-fall-2007/web/33-primedirectivesredux, we are asked to relate each prime directive to the tools we learned in class.

Prime Directive 1. The system successfully accomplishes a useful task.

1. Interactive Development Environments (Eclipse, VisualStudio, etc.)

IDEs allow programmers to focus more on the programming rather than the configuration, thus helping the system to accomplish a useful task.

2. Coding Standards and Coding Standards Compliance Tools (Checkstyle, etc.)

Following coding standards helps programmers to understand each other's code. In return, programmers have a better sense of knowing what code does, and are more likely to determine if it is accomplishing the intended task.

3. Build Systems (Ant, Make, etc.)

It helps to build the system, that can be executed to run the useful task.

4. Automated Quality Assurance Tools (PMD and FindBugs, etc.)

These tools test code based on analyzing the code without executing it. Some unintential mistakes can be avoided by doing so, and even if they are intentional, removing them can make the code more understandable. In effect, this helps the program to accomplish its intended task since it is more understood by programmers.

5. Black and White Box Testing

Testing helps to ensure the system does what it is intended to do.

6. Automated Testing Tools (JUnit, HttpUnit, etc.)

These tools are the practical application of black and white box testing.

7. Configuration Management (CVS, SVN, etc.)

Configuration management keeps track of changes to the code, which can be analyzed to see if they are matching the goals of the system.

8. Issue Driven Project Management

Issue driven project management helps to keep programmers on task as to what needs to be done with a project.

9. Use Cases

Use cases help to make sure a system provides certain functionality.

10. Software Review

Software review involves another user testing your code, which counts as black-box and white-box testing.

11. Agile Methods (XP, Scrum, etc.)

One thing with agile methods is that it has developers focus more on developing code rather than worrying about requirements and other formalities. This relates the the directive since it helps users focus more on coding.

12. Open Source Licenses (GPL, CPL, etc.)

This does not seem to relate. OSLs describe how code may be reused, which doesn't directly relate to the system doing something useful.

13. Online Hosting Services (Google Project Hosting, SourceForge, etc.)

Hosting services provides a medium for users to access the services mentioned above.


Prime Directive 2. An external user can successfully install and use the system.

1. Interactive Development Environments (Eclipse, VisualStudio, etc.)

IDEs are more for developers than users; however, an external user can use an IDE to build a system if no other way to do so is provided.

2. Coding Standards and Coding Standards Compliance Tools (Checkstyle, etc.)

This is more for developers than external users. A user doesn't generally care how the code looks.

3. Build Systems (Ant, Make, etc.)

Build systems help to build the system for the user automatically.

4. Automated Quality Assurance Tools (PMD and FindBugs, etc.)

Also, this is more for developers than users. The only use would be to find possible errors in code, which is something a developer does.

5. Black and White Box Testing
6. Automated Testing Tools (JUnit, HttpUnit, etc.)

A user can do this to see how 'mature' a system is - how much it has been tested.

7. Configuration Management (CVS, SVN, etc.)

Configuration management helps a user to find an older version of the code if the current version does not work.

8. Issue Driven Project Management

This can be used so users can report issues if they come up during installation or usage.

9. Use Cases

Use cases are usually designed by the user to give the developer an idea of how a system should function.

10. Software Review

Software review can be performed on a system to see if a user can install it.

11. Agile Methods (XP, Scrum, etc.)

This is more of an administrative issue than user issue.

12. Open Source Licenses (GPL, CPL, etc.)

This describes the rights a user has to reuse the code.

13. Online Hosting Services (Google Project Hosting, SourceForge, etc.)

These often provide the resource a user accesses to retrieve a system.


Prime Directive 3. An external developer can successfully understand and enhance the system.

1. Interactive Development Environments (Eclipse, VisualStudio, etc.)

IDEs help developers to take the frustration out of configuring a system's compilation projects, among other things. Also, they tend to provide visual debuggers, which allow a developer to see what code does step-by-step.

2. Coding Standards and Coding Standards Compliance Tools (Checkstyle, etc.)

These help developers to understand each other's code.

3. Build Systems (Ant, Make, etc.)

These tools help developers deploy their system to test their enhancements.

4. Automated Quality Assurance Tools (PMD and FindBugs, etc.)

This follows the same lines of reasoning as coding standards compliance tools.

5. Black and White Box Testing
6. Automated Testing Tools (JUnit, HttpUnit, etc.)

Testing ensures that their enhancements do what they intend them to do.

7. Configuration Management (CVS, SVN, etc.)

This allows multiple developers to access the code at the same time, thus allowing them to enhance it at the same time.

8. Issue Driven Project Management

This allows developers to understand the current issues to deal with for the given system.

9. Use Cases

Use cases allow new developers to understand what the system is supposed to do.

10. Software Review

Software review helps developers to understand each other's code.

11. Agile Methods (XP, Scrum, etc.)

Agile methods provide some mechanisms to help developers understand each other's code, such as pair programming.

12. Open Source Licenses (GPL, CPL, etc.)

Licenses tell developers how they can use existing code to enhance the current system.

13. Online Hosting Services (Google Project Hosting, SourceForge, etc.)

Hosting services provides a medium for developers to access the services mentioned above.

Friday, November 16, 2007

29.MyIsern-1.3-review

For this code review I looked at the MyIsern 1.3 project from the Green group.

1. Installation Review

Were you able to download the system as a distribution .zip file? Yes.

Were you able to run the system without having to use Ant or Eclipse? (In other words, was there a 'java -jar' interface to the system?) Since it is a WAR file, no. However, a WAR file could be built and compiled and put into the Tomcat manager.

How difficult was it for you to figure out how to run your classmate's software? Not very in this case, since it doesn't use any new libraries. Also, the script format was generally the same as our group's.

Were there JUnit, Checkstyle, PMD, and FindBugs tasks, and did they execute successfully without any errors or warnings? Verify passes for all of the above.

Was the InstallationGuide clear and concise? There is no such wiki page.


2. Code format and conventions review

The code looked good; the only thing I could note is that most back-end code is stored in a package named edu.hawaii.myisern.example, which isn't an appropriate name since this isn't an example.


3. Testing

Black Box: All the existing code from the previous test cases is kept intact; aside from this, no test classes exist for the JavaBeans or Model classes. Thus, one black box test missing would be a basic log in and log out test case.

White Box: Emma reports <80% coverage for all code; this is largely due to no test classes written for the classes.

Break da buggah: Trying to log in fails, basically since the page the system starts at is not the login page.


4. User Interface

How easy to use and intuitive is the user interface?
It is really nice. I am envious! The mechanism to display individual entries is very creative.

How well does the interface utilize screen real estate? Does it function well when using only (say) a third of the available monitor space?
The navigation bar at the top is pretty wide, and doesn't like being less than half of the screen. (My screen resolution is 1280x800) I think those buttons can be made to be less wide. The same applies to the left navigation pane, for the most part.

What opportunities for improvement do you notice?
The XML files seem to still be read in from the application folder - this is fine, although Dr. Johnson did mention the issue of upgrading the system.

For the sanity check, it may be helpful to add quotes. e.g.
[Warning] Researcher does not exist in the database.
would probably be
[Warning] Researcher "" does not exist in the database.

which would be more informative. Also, mentioning which record it occurs in may help the user in resolving these issues.

One other issue I have involves the editing of entries. In order to edit an entry you need to know the EXACT NAME of the person you are editing, which can be a pain to recall. A dropdown box to select the user may have been useful. Also, once the entry is being edited, the fields are the same size regardless of how much data is in it - this probably should be adjusted.

Finally, the real estate issues mentioned in the previous question apply here.


5. Summary and Lessons Learned

In summary I'd say I am pretty impressed with the overall design of the web app.

I learned an interesting way to incorporate AJAX into the web app - I probably would not have intuitively thought of clicking a person's name to view their entry.

Monday, November 5, 2007

25. WebAppQuestions

1. Explain in your own words the meaning of the web "request-response cycle".
Two computers want to talk to each other. One computer (the one 'requesting' data) sends a request to the other computer. The other computer sends their 'response', and the first computer receives the data they requested.

2. Explain how servlets facilitate processing of the request-response cycle.
A servlet is a class that runs within a web server. It handles the response part of the request-response cycle.

3. How do you login to the Tomcat Manager?
Go to the root page (http://localhost:8080) and use the login you configured in the box on the left.

4. What is the Tomcat Manager used for in the StackStripes application?
Nothing, because it is all done in the Ant task.

Actually, it is used for managing various different web apps that were developed for the server. Whenever an application is added or removed to the manager, it is done so using this interface (unless done via an ant task)

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!)
It is contained as a .war file, much like a .jar file for java applications. It is more or less the same as a .jar file, with the exception that .jsp pages in the archive are stored in the root directory of the archive, which would correspond to the root folder of the web app.

6. How do you build a war directory structure in Ant? Where is this accomplished in the StackStripes application?
You type 'ant war'. This is done after compilation is done:

- copy all the files needed for the war (preserving directory structure) to a temporary folder. This is done by copying it to ./build/war. Class files are actually not copied here; but all the metadata is stored here.
- create the archive, preserving directories.

7. How do you install a war directory in a running Tomcat server? What information does the Ant task need to accomplish this?
Go to Tomcat manager, and on the bottom there is a deploy option. It can also be done in an Ant task by accessing the interface via the Ant task.

8. What is the "Model2" architecture? What are its advantages?
It is a method of representing data on a web application - Model, View, Controller. The model contains the data, the view accesses the model, and the controller sends requests to the view. The main benefit is abstraction - the controller doesn't need to know any of the internals of the model to do anything.

This sounds a lot like a database system, though, which I would guess is where the idea came from.

9. What are JSP pages? How are they related to servlets?
A JSP page is basically HTML code with special tags that allow them to access Java classes. They are related in the sense that the JSP accesses data that could be contained in a servlet.

10. Why is there a delay when retrieving a JSP page for the first time? Where is the Java code for that page stored?
For the first time, a client needs to instantiate a session with the server. The Java code for the JSP page is stored in the class.

11. What are JSTL tags? Why are they useful? What is an example JSTL tag from the StackStripes system?
Java Server Standard Tags Library - they are a common set of JSP tags that can be used among various web app frameworks. They are useful since they can be used amongst different frameworks - if you learn one, learning another isn't as difficult since it would (in theory at least) be similar to the first.

Example of JSTL tag:

since this would be independent of the framework.

12. What are Stripes tags? Why are they useful? What is an example Stripes tag from the StackStripes system?
Stripes are similar to JSTL tags except they start with "stripes:" and are only used on the Stripes framework. They are useful since it tells the framework information about the web app and the information that is passed between the controller and model.

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?
HttpUnit is a testing framework for accessing applications via a web interface. It is different since JUnit usually accesses the objects directly; but HttpUnit tests what the user would see. It is useful since sometimes the interface is broken while the model is OK.

Example use:

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


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 button, I added a Response function, as well as a function to the model. Most of the model could be left intact, as well as the underlying stack implementation. I learned that the response functions and model functions can correspond.

15. What are the equivalence classes that need to be tested for the Double It button?
Empty stack, 1 element in stack, more than 1 element in stack. This isn't too bad since the stack must be valid prior to the Double It button being pressed.

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.




17. What is the singleton design pattern? What is an example of its use in StackStripes? Why is it needed?

It is the pattern that only one operation can be executing on the model at any given time - this is needed to deal with concurrency issues if multiple users are accessing the model at any given time. The example of its use is in the 'synchronized' keyword on each public function.

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?
TestStackActionBean: client
TestStackModel: server

Emma deals with this by testing each class's test cases, and treating each class separately.

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 if tomcat is running
tomcat.undeploy: Undeploys web app from tomcat manager if it is currently running
compile: compiles code
war: makes war archive
tomcat.deploy: Uploads web app to tomcat manager.
junit.tool: runs JUnit tests
junit.report: creates JUnit report
junit: wrapper for junit.tool and junit.report

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 no prior experience.

26. StackStripesExtension

For this assignment we were given an existing Stripes web application system and were asked to do some modifications to it.

What was difficult about this assignment? What problems were encountered in carrying out the work, and how did you resolve them? (grouped together since they are similar)

I think the main difficulty was that it is a new framework and I haven't touched web apps, so it was new territory for me. More specifically...

The first difficulty was getting verify to run. Apparently there is some issue with Eclipse that causes the running directory to not necessarily equal the directory the script was run from. Because of this, coverage.ac would get dumped into tomcat's directory rather than the project directory, and that would mess up the script. I thus had to run everything from the command line rather than Eclipse.

Next, data persists between JUnit tests - something I did not realize until the second time I ran it. It wouldn't be obvious at first since only one test was provided - but once the second test was added, you could start to notice it as being an issue.

Lastly, thinking of a good way to implement Double It was an issue. Initially I wanted to have all the code for it reside in the Response handler, but it turned out to be difficult since without access to the private Stack, it adds about 10x more code to do so. I was writing a function that did popping manually until I realized I'd have to handle an exception that never gets thrown. So in the end, I wrote a new static member for the StackModel object.

Were all of the assigned tasks completed? If not, which ones weren't, and why didn't you finish them?

Yes.

Concluding remarks:

I don't think the build files were perfect - they do get the job done, but they could certainly be improved. If I spent more time on this (which I probably will be for the next project), I probably would have modified them to do two things:

- work in Eclipse, and
- automatically start the Tomcat server if it isn't running, rather than spit out an error message

Monday, October 22, 2007

19. UseCaseSpecification

This exercise involved writing the use cases for the future MyISERN system. They were derived by talking to Dr. Johnson in our class.

From the flaming (OK, its not that bad) that happened on the class discussion board, one thing seems clear to me - sometimes the disagreement between client and developer can turn ugly. I know Dr. Johnson doesn't mean it in a bad way, but there are some experiences I can recall where the client insists the system is implemented in a certain way, while the developer knows that it is infeasible to implement it in that way.

And... well, this exercise brought back some of those memories :-(

The other thing I learned was a little more specific knowledge about the use cases. Many of them I would unknowingly do (as in rephrase them to be understandable to the client), but it was just nice to know there is some sort of "tao" about designing them.

21. MyISERN-1.2

This entry continues the MyISERN project from last time.

Updated link (Version 1.2): http://myisern-1-silver.googlecode.com/files/myisern-xml-1.2.1022.zip

For this installment we had to implement a command-line data entry system for the ISERN system, as well as input data that was given to us.

What was difficult about this assignment?
I'd say the biggest difficulty was the sheer amount of things to do in the course of 1-2 weeks. (Use cases, data entry module, data entry, presentation) I started almost immediately on the tasks (almost because of the code review from before), and still felt like there wasn't enough time. Then again, Parkinson's law seems to hold in general.

What problems were encountered in organizing the group and carrying out the work?
I'd say again the problem of in-person sessions were a problem again, due to circumstances beyond our control. Aside from that, splitting data entry was also difficult since many items link to other items.

Were all of the assigned tasks completed? If not, why not?
Yes. Were the completed in a satisfactory manner? That I'm not sure about.

I think this might be a good example for the real world, though, where sometimes we may come across a situation where it is not possible to do everything perfectly, and some compromises may need to be made in order to finish a project.

What will you do differently during the next Milestone to improve the process and the product of your efforts?

I want to say "start earlier" but we did start at a fairly early time anyways. The only thing that comes to mind is the line my professor said, along the lines of "work smarter, not harder". Thus, the solution seems to be to make the process more efficient.

Tuesday, October 16, 2007

22. MyISERN1.1 Review

For this code review, I once again reviewed the code of the blue group. My rationale for choosing the same group is that I wanted to see how the code has improved over the last week.

1. Installation Review

The system didn't install as straightforward, which I believe was largely due to the incorporation of SWT into the code. The idea of putting a GUI into the program is a great idea, and it might be true that this point may have been early to implement it.

Steps taken to get the code to compile:

- Installation of SWT
- Modification of project to remove org.eclipse.swt and added SWT jar files to classpath

At this point, Eclipse was able to run; however, ant at the command line did not. Attempts were made to change the main class, but it didn't work. At this point I gave up and just figured to do all my testing via the Eclipse IDE.


2. Code Format and Conventions Review

Verify didn't pass. Checkstyle reported a redundant import statement - mainly due to the import statement importing the package the file was stored in. (line 7 of TestMyIsernXmlLoader.java)

Aside from this, verify passes.

No major coding violations were readily noted.


3. Testing

Black box
The following tests were used in our (silver) group's code, and was thus considered here:
- Checking unique IDs amongst all lists
- Checking years
- Checking validity of links
- Listing an object for a valid ID
- Listing an object for an invalid ID
- Listing an object for a null ID
- Listing all of a type of object
- Listing organizations with integer parameter valid
- Listing organizations with integer parameter zero
- Listing organizations with integer parameter negative

Also, checking for a non-null name was specified; however, JAXB does this automatically, so it wasn't tested.

White box
EMMA reports 62% overall coverage. The following were areas that weren't covered:

- Parser class. This command processes command line arguments, it seems. It didn't seem to be used much.
- MyIsern class. This is mainly due to the unimplemented GUI interface.
- MyIsernXmlLoader class. This was covered except for the invalid data cases.

Break da buggah
For this test, I took the malformed data that I used for my testing, where the invalid entries would hopefully be noted by the parser. The XML has invalid entries in two ways:

- There are two Philip Johnsons in the researchers file.
- There is an invalid year of 2050 in one of the collaborations.

Result: The duplicate Philip Johnson was detected, but the invalid organization (with the year 2050) was not.

4. Conclusions

The implementation of additional features sometimes makes development a lot more difficult, as in the case with easter eggs. I recall one of my prior ICS instructors mentioning how development frowns upon easter eggs because they are difficult to test since they are hidden in the functionality of the program. In this case, what seemed to be a useful feature seems to be more of a headache, since it made the building of the system more difficult.

This also is a good example of the difficulty of being IDE-independent. To me, it seemed like a lot of the development was done in Eclipse, and running the Ant build files from the command prompt didn't work as expected. I'm also suspecting this relates to the added library, since the creation of the JAR file did work the last time I reviewed this code.

Also, documenting the SWT_HOME environment variable in the documentation would have been helpful. It is difficult to sometimes do this though, since not everyone has access to a clean installation of an operating system.

Finally, I would like to make a comment of keeping multiple copies of a single file in the src folder - this generally is a bad idea. From my knowledge of CVS systems, Subversion keeps your revisions automatically in the repository - this is the purpose of keeping a repository.

On a side note, I still envy the table printout format :)

Monday, October 15, 2007

18. MyISERN-1.1

For this assignment we (myself and Laura) continued where we left off of and added new functionality to the system.

The source code can be found at http://myisern-1-silver.googlecode.com/files/myisern-xml-1.1.1015.zip

What was difficult about this assignment?

I think the main issue was dividing up the work in the beginning - there were two 'features' to implement, and it is still unknown to this date whether or not they were both equal in terms of the amount of work. (We split the two between the two of us). It seemed to turn out fine, though.

The other issue came with EMMA coverage - it was mentioned in class that coverage is quite possibly a misleading metric that many companies go by; however, I also had a guilty voice that went off every time I didn't see a 100%. Unfortunately, I did use an enumerated type in my code, and since I don't use all the features of an enumerated type, it won't reach 100% coverage.


What problems were encountered in organizing the group and carrying out the work?

The biggest challenge was the comment that Dr. Johnson made in class about meeting in person. Meeting in person proved to be very difficult; however, this seemed to be made up by communicating online frequently. (True, you don't get to see neat tricks from each other if you do this)

Other than this, it went pretty smoothly. Frequent communication encouraged working on the code before the due date.

Were all of the assigned tasks completed? If not, why not?

Yes.

What will you do differently during the next Milestone to improve the process and the product of your efforts?

It would be good if we could meet in-person more often, although this is difficult due to scheduling issues. Aside from this, things went pretty smoothly, at least in my opinion.

Wednesday, October 10, 2007

16. MyIsernReview

For this review, I reviewed the MyIsern1.0 system for Sonwright Gomez, who was a part of the myisern-1-blue group.

1. Installation review

Installation was straightforward - the package downloaded and unzipped fine. Verify passed. The only point I would mention here is that the JAR file was included with the installation, which added 2 megabytes to the archive.

2. Code format and conventions review

The following formatting violations are noted:

FileLine NumberViolationNotes
MyIsernXmlLoader.java31EJS-35Use meaningful Javadoc comments - should not mention it is 'sample' code anymore
MyIsernXmlLoader.java152, 224, 288EJS-9Explain the meaning of the constant 3000.
MyIsernXmlLoader.java211EJS-36Use /* ... */ to comment code rather than //

3. Test Case Review

Black Box: The only test cases in the code assume the test data equals the sample data. Unfortunately, these test cases will fail if the sample XML data changes.

The following tests are missing from the code:

- Null entries for values in an entry (e.g. 0-character strings)
- Empty XML file (e.g. 0 bytes, but exists)
- No XML file (e.g. does not exist in file system)
- File with long field values, but are still valid
- Entry with an invalid type (e.g. a letter in the year field)

White Box: EMMA reports 100% code coverage. This means that all code that is written is executed in the test cases that were written.

Break da buggah: After executing the black box tests, the following results occurred:

- Null entries for values in an entry: NullPointerException
- Empty XML file (e.g. 0 bytes, but exists): UnmarshalException/SAXParseException
- No XML file (e.g. does not exist in file system): FileNotFoundException
- File with long field values, but are still valid: executed OK
- Entry with an invalid type (e.g. a letter in the year field): NullPointerException


4. Summary and Lessons Learned

This exercise seemed very trivial. However, despite being very easy to do, it is still fairly easy to break. Many of these tests are circumstances that would not happen very often; however, when they do happen, the system can come crashing down and cause downtime.

This assignment was different from the last since we were told about two days before the due date that testing would be performed on our code. This gave us motivation to improve our test cases. It would be a good idea to possibly set aside a couple of days before the due date to work on test cases if the project is finished ahead of schedule.

Monday, October 8, 2007

15. MyISERN 1.0

For this assignment we researched JAXB and wrote a program to output the XML data to the console.

Link to project: http://code.google.com/p/myisern-1-silver/

Lessons Learned:

JAXB and XML - An earlier program I wrote involved parsing XML data. I ended up reading the file manually and parsing the data stream. Had I known about this, I probably would have used this instead. The library that comes by default with Java didn't seem adequate at the time, though - this was about two years ago.

Group Software Development - It was actually a pretty good experience. Regarding software development in general, though, it sometimes feels like more of a disadvantage than an advantage - in many cases, if there was a design choice, if I were working on my own I would go ahead with a decision, but once the group factor comes in, it becomes an issue to consult the other group members before coming to a decision. The advantage, though, comes in being able to proofread each other's work - as I mentioned in a previous entry, it is difficult to hold a knife to your own work, but easy to do it to another person's.

Anything else - Again, this is a trivial assignment that ended up being not-so-trivial. If you look at our code, you'll see why ^^

14. CM.Practice

This assignment involves using SVN over Google Code to set up and use projects.

1. Install a SVN client

Straightforward. I installed TortoiseSVN since I am using a Windows system. This took about 5 minutes.

2. Modify an existing Google Project.

This was also straightforward. I used CVS before and the checkout/commit process was pretty straightforward. The only part I didn't like was running verify before and after commits. This took about 15 minutes.

3. Create a new Google Hosting project.

This was where most of the time was spent. The first difficult was to find the actual link to create the project, since code.google.com does not provide an obvious link. Next, choosing a license was iffy, and I just copied what was chosen in the slides. It might be an interesting topic to discuss in class, however.

Finally, creating the discussion lists and commit lists was a pain since I had to go to Google Groups and create the lists, then go back to the project page and add them. If this was integrated into the project creation step, it would be easier (and less time consuming).

After the project setup I uploaded my files. Unfortunately, I messed up the first time (I uploaded it as a single folder) so I removed it. Then I uploaded up, then renamed the project folder to "trunk". It worked. However, afterwards I noticed the notes renamed the folder to 'trunk' before uploading it.

I wanted to avoid uploading the files individually since TortoiseSVN warned me that uploading the 11 files or so would cause 11 revisions.

This took about an hour.


Lessons Learned

Even the simplest thing can be a pain to set up, sometimes. Otherwise, I think the process was straightforward. Google could work a little on the interface for creating a project, but otherwise this was pretty trivial.

Sunday, September 30, 2007

12. WebSpiderReview

For this assignment I reviewed Michal Zielinski's Webspider program from http://michalzics413.blogspot.com/2007/09/11-webspider-revided.html


1. Installation Review

Installation was straightforward. Since everyone used the same base package with xml files pre-given, the process of running Ant builds was the same as doing so for my own package. JUnit, Checkstyle, PMD, and FindBugs tests were present - all ran successfully. Also, Emma did not report 100% coverage - this will be discussed in further detail in section 3, Test Cases.

2. Code format and conventions review

No errors were found from the automated check tools.

Manual code violations:

FileLinesViolationComments
WebSpiderExample.javaN/A?Class name should reflect what the class does. ('example' no longer should be in class name)
WebSpiderExample.java16, 186EJS-35Use descriptive Javadoc comments.
WebSpiderExample.java75, 118EJS-9Use meaningful variable names. (even when they appear as function parameters)
WebSpiderExample.java82, 83, 140, *ICS-SE-Java-9Use iterators.


3. Test Case Review

Black Box Testing
The following equivalence classes were considered and tested:

Regular URL - the program performs as expected. A JUnit test reflects this.
URL with no links - Also produces expected results (0 links). No JUnit test is present for this case.
URL that isn't a HTML file - threw a NotHTML exception.
404 link - HttpNotFoundException thrown.
non-HTTP link - At first glance it is OK since it checks for the http at the beginning of the URL. However, "httpa://" ends up executing with a MalformedURLException.
Invalid command line parameters - If the fourth parameter isn't "-logging", it shows the example use screen, as well as the results (which ends up being zero). Aside from that, it does pass the following parameter tests:

- ensuring first parameter is either -totallinks or -mostpopular
- ensuring second parameter is a http URL
- ensuring third parameter is a nonnegative number

White Box Testing
Code coverage is not 100%. The following is a list of the code that is not executed in the test cases:

- Case where MostPopularPage has all pages with 0 links (line 100). This can be checked by using 0 as the depth factor for a URL.

- Exception catching statements at 169-174. This is because traversePages has its own catch block, meaning they will get caught in the recursive call rather than the calling function. These lines could possibly be removed.

- Main function accepting an invalid URL (httpnot://foo.bar).


Break da buggah:
Any case mentioned above where an exception gets thrown is a case where the program crashed due to unexpected behavior. These cases again are:

- invalid URL that starts with "http"
- 404 link
- non-html link
- fourth parameter that is not '-logging'

Conclusions:

In conclusion, I learned a lot of the issues that were wrong with my code by reading through Michal's implementation. One of the things about doing testing is that it is difficult to hold a scalpel to your own work, but it is easy to look for faults in other people's work. By doing so, it helps you to think about things that you did on your own version.

Reading through Michal's code started to make me wonder if I implemented my own WebSpider implementation correctly - I interpreted the number parameter of the program as the "maximum number of pages to visit" rather than the "maximum depth from starting page" parameter. I am unsure which is correct, but I can start to understand the advantage of groups - having more perspectives helps to reduce possible errors like this.

The other difficulty comes in devising test cases. Personally I find it a little awkward to devise a set of test cases prior to the implementation of a system, and with pressure on finishing, it reduces the emphasis on testing, which shouldn't be neglected. There are many test cases I would've wanted to put into my code but didn't, mainly due to being exhausted from coding. It does seem like there may be an advantage to writing the test cases before the actual code in this case.

I did enjoy reading through another person's code, however, and it did rattle my brain over ideas on improvements on my own code.

Monday, September 24, 2007

11. WebSpider

Link

Note this does not include the jar file even if the script does build it. I figure it can be generated, so I excluded it.

This assignment seemed really simple in the beginning - just build a hash table and store the counts in there. But there were many hitches along the way.

The first involved the build.xml files, it seems like a lot of editing had to be done in order to get them to work the way I wanted them to. I don't think Dr. Johnson did this on purpose, but then again maybe he did to give us an interesting exercise to work with. The issues I can recall offhand were:
  • base build.xml needed to be updated to include junit's jar file
  • dist.build.xml needed to include my name in the generated filename
  • emma.build.xml needed to be adjusted for the paths for generating the html (theres no way I want to read the xml every time I want to see the coverage reports)
  • javadoc.build.xml needed the overview.html path set (it initially said stack)
All in all, transitioning the system over from stack probably wasn't as smooth as Dr. Johnson wanted ^^

On to the actual work now...

Part 0: Package creation + tests

It was initially painless... until adding the Junit jar became an issue. So that took me a while to realize.

Part 1: Totallinks implementation
Part 2: Mostpopular implementation

I realized parts 1 and 2 were very similar, so I decided to try to make their implementations similar, with the final result differing. However...

Httpunit does not like parsing Javascript. Many links do contain it; however, Kevin English did have a nice way to disable the exceptions from being thrown. (I just caught them all) But that certainly complicated matters. The only thing is I am unsure if it still processes the pages, or it just suppresses the exceptions.

Also, I initially used the data structure of a HashMap. Then I realized I would need to traverse the structure, so I changed it to a TreeMap. After that, though, I realized I would want a queue to determine which value would be next, so I actually ended up implementing two separate data structures - a queue for which URL would be next to process, and a TreeMap to keep track of the counts.

Using parent classes made changing data structures easy, luckily.

Part 3: Logging

Easy. I just use System.out.println.... I can't? Then I notice the line in the assignment:

You can implement logging using System.out.println, but that's lame.

Well, there goes that idea. However, the HackystatLogger class seemed to fit the description very well of what I needed to do for this task, so I just used that class. (and attributed it in the JavaDoc). Then I built a WebSpiderLog on top of that, which becomes enabled if logging is enabled at the command line.

Part 4: Extra Credit

It's supposed to be a separate entry, but I didn't attempt it.

Conclusions

What an annoying assignment. I initially thought it would be a simple task, and then found all these wonderful humps that slowed down progress. In the end... its a good thing I started moderately early on it (around Wednesday), because otherwise I'd be burning the midnight oil until early hours tonight.

Sunday, September 16, 2007

10. Stack

Summary: I think this was our first 'serious' project in this class. Luckily a lot of the difficulties were overcome since we had everything pre-packaged for us in a handy ZIP file.

Which of the five tasks were you able to complete successfully? All.


What problems did you run into, and how did you resolve them. What is your impression of Ant?

I'll cover this for each part.

Task 1: Installation - A recurring theme of these open source tools is that they don't have the usual setup procedures that I'm used to. Because of this, that is part of the reason I'm starting to see as to why these tools aren't mainstream, at least not yet.

Aside from that, the process was generally straightforward - download the package, unzip to a directory, update environment variable, test if its installed correctly with the build.xml in the stack package. The only other difficulty involved PMD version available, since the tools page stated 3.7, whilst the PMD sourceforge page only had 4.0 and 3.9 available to download.

Task 2: Creating the project - Straightforward.

Task 3: Fixing verify.build.xml errors - Nothing too difficult. It did scare me for a while about how when I would save files it would sometimes state that certain classes couldn't be found - I initially thought this was because I renamed an existing project and it would cause me to change class names to be the same as the project. Luckily that isn't what needed to be done - I just had to remake the project.

Also, I was surprised by some of the things pointed out by the tools - I would never think of using the cached instances rather than creating a new Integer object for values from -128 to 127.

Task 4: Writing an Ant script for JavaNCSS - This is the portion I had the most difficult with. I think this is largely due to me not knowing how Java too well - and how the tools (jar, javac, ant, etc) look for their files. The Ant script documentation was helpful; however; the following errors came up at one point when 'testing' the script:

- Main class javancss.JavancssAntTask could not be found

fixed by adding javancss.jar to classpath; then a similar error came up for ccl.jar. Eventually I just put all the JAR files in the classpath separating them with semicolons; Brian did suggest a better way using wildcard modifiers.

- Parse error

... mainly due to not using the correct syntax for the source input files.

3 days later and 4 headaches later, it works.

Task 5: Code Coverage - Was easy compared to task 4, although I didn't notice some tasks involved ClearStack rather than Stack, and so I ended up writing two new test cases.


Are there standards that we are using that you don't understand the motivation for?

The only standard I find questionable is the one involving the asterisk in package declarations - if we are using the entire package, why is it wrong to do so?


What is the difference between SCLC and JavaNCSS, and which counting tool do you prefer?

SCLC looks more general (e.g. it supports multiple types of files), while JavaNCSS is specifically geared towards Java. I think this is a question of which you'd prefer between a specialized knife or a swiss army knife. I personally would take the specialized knife in this case; however, for my own everyday use (e.g. outside of specific Java-specific programming) I would probably prefer SCLC, since I rarely do Java development outside of this class.


My code: http://www2.hawaii.edu/~wongandr/stack-5.0.916.zip

Saturday, September 8, 2007

CodeRuler Tournament ^^

This isn't a required entry for the class, but I thought it'd be fun to run a CodeRuler tournament including my CodeRuler, especially since my submission didn't show up in class.

My basic strategy didn't change too much - instantly charge towards the nearest castle, and pray you don't get wiped out. Peasants use a 1-square lookahead to determine the best square to move to, prioritizing enemy land first, then unclaimed. It works great against the bots, but aside from that... thats what I'm about to find out ^^

So I decided to run three tournaments:

1) Run 1 vs. 1 against each other person's bot (7 total: Ben, Shaoxuan, Kevin, Randy, Paul, Brian, and Laura/Lisa who I'll refer to as LL for the rest of this entry). Rank based on ratio of final scores (my score divided by opponent's score)

2) Using the seedings from tournament 1, run a 4-way free-for-all. Winner is removed, next person is put in.

3) Same as #2, but 6-way.


Results, with my score always listed first:

Tournament 1: (with commentary as I recall)

LL: 36-817. This ruler did the best against mine, interestingly. I'm not sure what it is - although it might be because it always has at least one castle producing knights, and my strategy is probably weak to that.

Ben: 42-913. I pondered doing as many lookaheads in my own code, but didn't want my ruler to time out.

Shaoxuan: 59-902. IMO this strategy was the most similar to mine, although I think mine wasn't as well-refined.

Kevin: 452-552. This was actually a pretty close match, and I tried replaying the match to remember what it was that gave you the edge here, but I kept winning afterwards :-(

Randy: 608-296. I honestly thought this ruler would give me the most trouble since the troops stayed back on defense for the first half of the game - and it was true, but at least my castle could keep producing knights. And once the troops started sweeping, my knights would go in for the capture. (If you stalled till 80% of the battle, though, it might've been different)

Paul: 799-82. My knights met a fair amount of opposition before capturing the castle.

Brian: 806-74. Same idea as Kevin's match, except now every time I try to figure out how I won, I keep losing ^^


Tournament 2: (4-way free-for-alls)

Seeded order from 1: LL, Ben, Shaoxuan, Kevin, Andrew, Randy, Paul, Brian
Results: Shaoxuan, LL, Andrew (!), Ben, Brian, Kevin, Paul, Randy

Tournament 3: (6 way free-for-alls)

Result: Shaoxuan, LL, Andrew (!!), Ben, Brian, Paul, Kevin, Randy

I honestly don't know why my ruler does better in free-for-all matches rather than 1 vs 1, but thats really... interesting.


I'll finish up with my overall impression of each ruler:

Shaoxuan: ... wow. Your ruler is just... yea. I can't describe it with words.
LL: I was amazed how it managed to wipe me out so quickly. (I think it was the knights)
Ben: Your ruler is a good example of move look-ahead. I should've done more of that ^^
Brian: Basically its a smarter version of split-up ruler. And... its actually pretty smart ^^
Kevin: I liked the idea of having various 'tactics' (as assigned by batallion) assigned to groups of knights. Its like those real-time strategy games that I could never seem to get good at.
Paul: Your strategy is nice and simple.
Randy: Well... So maybe it doesn't win matches, but I think this is the most aesthetically pleasing ruler of them all. The 'sweep' is probably one of the funniest things to watch in this game, and winning isn't necessarily everything...

Wednesday, September 5, 2007

08. CodeRulerRedux

URL: http://www2.hawaii.edu/~wongandr/coderulerredux-wongandr.zip

Revisions made: Kevin English's code review was applied. The most notable of these changes is changing Vector to ArrayList - amazingly, this change was nearly seamless, aside from removing a few typecastings (which is good).

Strategy changes: Nothing significant. The criteria for deciding to choose peasants or knights changed slightly - now knights will always be produced until at least 20 are in play under my control. This is because it is generally more useful to own all the castles rather than gain more land, plus peasants in the beginning have a fairly good survival rate (unless being hunted by multiple mobs of knights).

It was considered that the criteria for which castle to target would be changed - this was tossed out for the following reason: Suppose there is castle A and B, and B has more knights guarding it. Then A should be targeted. But suppose that right when we're about to capture A, a knight comes back to A and tons of knights flee from B. Then B is the better target, and all the knights will flock to B instead.

Thus, it still targets the nearest castle.


Other notes: I really like how Eclipse allows you to do variable renaming (e.g. refactoring) with minimal pain - no other IDE I have used has such a useful feature (that I could find, that is).

Friday, August 31, 2007

7. CodeRulerReview

For this review I looked at Paul Ching's CodeRuler implementation.


Discrepancies noted from Elements of Java and in-class format:

FileLine(s)ViolationComments
MyRuler.java1ICS-SE-Java-2Do not use * in import statements
MyRuler.java112, 113, 114EJS-25Use lowercase for the first word and capitalize only the first letter of each subsequent word that appears in a variable name.
MyRuler.java77, 94, 95, *EJS-8Do not use tabs.
MyRuler.java132EJS-66Null statement - maybe this block should've just been omitted?
MyRuler.java149, 164, 184, *ICS-SE-Eclipse-2Right curly brace should be on same line as if statement


Other notes: I think the code looks pretty presentable aside from the notes above, or at least better than my code. Strategy for knights is acceptable; peasants could use improvement, but strategy is probably OK since it did fine against the bots.

One more note, is only the first castle commanded to produce knights? I'm not sure what the other castles would produce.

Other than this, it looks fine to me.

Wednesday, August 29, 2007

CodeRuler

Members in group: Myself (Andrew Wong)

Code: http://www2.hawaii.edu/~wongandr/coderuler-wongandr.zip

Strategy: Suicide. Really.

Its a crazy strategy. Right off the bat, all knights are instantly set on capturing the closest castle to the starting gate. A few things can happen from this:

- If the knights die and the castle isn't captured, I'm screwed. Good game.
- If the knights managed to capture the new castle, well, thats usually better ^^

Knights don't care about capturing any other pieces until all castles are owned by this ruler. This is risky since that might never happen, but if it ever does, its usually hard for any other team to recover.

Peasants, on the other hand, move somewhat intelligently. They will try to first claim land that other people have claimed, then unclaimed land, and then last resort to a random movement. However, if an enemy knight is chasing them, they are very good at giving them a runaround, especially if the knight continues pursuing them. But this is good, since if the knights are chasing the peasants, that leaves their castle defenses wide open... ^^

But yea, generally peasants are pretty good at covering 90% or more of the map if they ever manage to eradicate the opposition.

Results of running against sample Rulers:












RunMy ScoreOpposing Ruler Score
Migrate 18221
Migrate 28240
Migrate 38240
Gang Up 1758188
Gang Up 2788108
Gang Up 3639296
Split Up 1775106
Split Up 2761140
Split Up 3697126


Lessons Learned: A lot. I'll go by each item here.

Eclipse: Eclipse is very useful even for a person (like myself) who isn't very accustomed to Java. It has many things that help a programmer, such as "correct formatting" (e.g. after you copy and paste something in, it fixes up the spaces), function autocomplete, brace autocomplete (which is annoying at first, but you get used to it), error highlighting in the right hand side of the window, etc. The list goes on. Unfortunately, theres a performance tradeoff, but its bearable in most cases.

CodeRuler: Working with legacy code can sometimes be a hassle. It is probably very possible to redo everything without casts and using the Vector class; however, because of the way the application was developed, "you're stuck with what it was initially implemented in". (Or whatever Dr. Johnson's line was)

Java: Java is a language I'm starting to like a little more each time I program in it. True, it probably won't outdo C++ for me (since Java still has a performance overhead compared to C), but I'm starting to get used to some of my initial gripes about Java (long references such as System.out.println, performance overhead, awkward method of naming classes, etc).

Working with another person: I cannot comment on this. Actually, I can, but it would be making stuff up.

Saturday, August 25, 2007

Open Source Software Experience: Shoddy Battle

This is a writeup for the assignment described at http://groups.google.com/group/ics-software-engineering-fall-2007/web/a-02-oss-experience

For this assignment I looked at Shoddy Battle. It can be found at http://sourceforge.net/projects/shoddybattle/ with the main site at http://shoddybattle.com and contains two parts:

- a client, and
- a server.

Introduction

Pokemon is a popular game amongst millions of people around the world. One of the problems with this game, though, is that the process of raising Pokemon to battle with is often a long and tedious task. It usually takes a couple of hours to raise and level them in a desired manner, and in many cases a person realizes 'improvements' that can be done which causes them to raise another one of the same type. Couple this with a team consisting of six of these 'Pokemon', and you can see how raising a team would take a while.

Pokemon's battle system is basically a larger version of rock-paper-scissors - much like CodeRuler, one strategy can defeat another but lose to a third one. One of the aims of Shoddy Battle is to allow people to battle Pokemon (which they define) online with other people, allowing them to test their 'team' before actually investing the time in-game.


Installation

Installation is easy. You download the .jnlp file which runs it as a Java web app.

Ummm, wait. There's nothing to install? Thats right. Actually, if you want to run a server, there is a separate download for that too (which I did try and download, but did not want to set up). But there are advantages and disadvantages of running it as a web app:

Advantages:
  • Shoddy Battle is a network application. Network applications tend to have synchronization problems when they are updated and people use older versions. By running it as a web app, the version is updated automatically every time the program is executed. Also, one disadvantage of Java Web Start is you kinda need an internet connection (I think), but you need one anyways for this game ^^
  • Assuming Java Web Start is a good interface (which is a religion question), its easy for users to run it.
Disadvantage:
  • Ummm, where's my app? And what am I going to show for it in this writeup?

Prime Directive 1. The system successfully accomplishes a useful task.

Yes, its a fun way to play online and test teams out. But moreso, theres a few teams I have tried which have gotten horrendously slaughtered online (don't ask), and then I learned that those teams aren't really feasible. So it did help me save a few hours of training, at the very least.

I'd say its useful.

Prime Directive 2. An external user can successfully install and use the system.

I think an external user can install the system also. Unfortunately, it comes with a hitch. This assumes the system is configured to handle Java web applications, which on a previous computer I used it didn't work completely. Maybe it was a configuration error on my part. Anyways, assuming that works fine (which I'd say is true for most systems), I'd say an external user should have no trouble installing it, especially if they go to the homepage (http://shoddybattle.com) and follow the directions from there.

Prime Directive 3. An external developer can successfully understand and enhance the system.

Luckily, there is a source package on Sourceforge. Unfortunately, I haven't tried enhancing the system. There are two main reasons I see for enhancing the system, however:
  • Security issues. If the server ever gets hacked into, there may be issues that need patching. (Then again, its only a game.)
  • Game updates. Whenever a new version of Pokemon comes out (currently it is on 4th generation - RBY, GSC, RSE, and now DP), new pokemon species and moves are added. These moves look like they're implemented in a Java file that can easily be updated when the time comes. However, it looks like they're also implemented in a database file, so it might be a little confusing where exactly the update would be. (I haven't looked into species)
Thus, I think there might be a few difficulties if an external developer were to develop the program. Then again, it would affect the overall client-server infrastructure.


Conclusions

In conclusion I'd say its a pretty fun and straightforward package for an average user to download and run, but working on it could be a challenge since it doesn't seem straightforward as to what exactly is to be modified.

Wednesday, August 22, 2007

FizzBuzz

The Problem: Write a program that writes out the numbers 1 to 100, one on each line, replacing multiples of 3 with "Fizz", multiples of 5 with "Buzz" and multiples of both 3 and 5 with "FizzBuzz".

A summary of the events while coding is as follows: (timestamped)

- Started at 9:20:35 pm.

I'm not a Java coder. I'm more used to C/C++. Luckily C and Java are very similar. Unfortunately, there are a few syntactical changes between the two. The main issue with me was researching how to write the main function (which I'm pretty sure I got wrong during the in-class exercise).

I know, I could have used the Eclipse IDE to fill in this line for me, but I already feel like a bad enough cheater for being given the "class FizzBuzz" line for free.

So I open up Google and find out what the syntax for the main function is.

- Finished researching syntax at 9:22:11 pm.

The coding begins. For the most part, syntax highlighting is the same as when I would edit source files in Notepad++ (which I like very much). The only part I do NOT like is that it automatically fills in a ending brace whenever you open one. I'm just accustomed to typing in the closing brace immediately after typing the opening brace.

On another note, I think you can get away with writing the program without any braces at all, maybe. But when I open a brace, I usually do it because I expect to have more than one line. Also, I think not putting the braces can increase the difficulty in reading the code, since then the reader must look for the implicit braces.

- Finished first coding iteration at 9:23:33 pm.

Will it work? It takes a few seconds to find the save (e.g. compile) button, as well as the run command (buried in a few menus... good thing I ran through the tutorial!). So the output appears and I proofread it.

It looks fine.

- Finished (after verification) at 9:24:18 pm.
Total time: 3 minutes, 43 seconds.


Other comments: Opening the Eclipse editor takes a while. If you want to account for that, add another 1-2 minutes to my time. I started from an already open Eclipse.

I think my time is too suspiciously fast, but maybe thats because I've had the problem statement for a while (e.g. ever since it was mentioned in class on Monday), and I have had a lot of time to think about it. If I were to do it impromptu, I'm pretty sure I would not do it this quickly.

Also, I did acknowledge that Java syntax isn't exactly one of the things I can recall offhand, and I'm still pretty surprised that didn't take up too much time.


Insights into software engineering/this class: Adding the factor of time does have an effect on how nice (or not nice) the final code works. Also, having to create a project from scratch can be something people don't do very often, which makes it more difficult to do when you actually have to write something from scratch.

Also, getting used to a new IDE does take time, which sounds like a line I heard, along the lines of "employees on a project only really start being useful after 3 months". (don't quote me on that, it's not the exact line)


- Andrew


Source listing: (in all the glory of bad indentation and line spacing - finishing quickly is a priority in this assignment, and I know tabs look ugly)


public class FizzBuzz {
public static void main (String[] args) {
for(int i=1; i <= 100; i++) {
if (i % 15 == 0) {
System.out.println("FizzBuzz");
}
else if (i % 5 == 0) {
System.out.println("Buzz");
}
else if (i % 3 == 0) {
System.out.println("Fizz");
}
else
System.out.println(i);

}

}
}

Monday, August 20, 2007

A Post!

A software engineering blog!

Weeee.....