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 :)