CMIS 345
University of Maryland - European Division
Term 4 - 14 April - 22 June 2008
Distance Education
Lecturer: Jerry Rugg
Object Oriented Design and Programming
Lab 4 - Word Count
Due 16 June 2008
Reading Assignment | Assignment Requirements |
Assignment Turn-in | Assignment Conference
Reading Assignment - Chapters 8 - 10
- Chapter 8: Frameworks - focus on sections 8-1 through- 8-3. In the lab you will use the Collections Fraemwork classes.
- Chapter 9: Multithreading - very important chapter. Focus on sections 9.1 and 9.2 on how to create threads in Java and how to synchronize access to shared data objects.
- Chapter 10: More Design Patterns - another very important chapter. We will use the Command Pattern in the lab but you should understand all the patterns for future use.
Assignment Grading
The Assignment Grading policy letter details how I will grade this assignment. The Assignment Grading policy, along with all pertinent programming assignment policies, can be found in the Course Content section of our WebTycho classroom and also on the alternate CMIS 345 Course Home Page. In particular the Naming Conventions, Comments in Code, and Error Handling policies would be worth reading. It would also be beneficial to read through the Assignment Requirements policy letter.
This lab assignment is worth 15% of your final grade. However, based on class results, I reserve the right to change the percentage contribution at the end of the course. One-half, 50%, of the grade will come from the documentation required below and one-quarter, 25%, from the implementation code and one-quarter, 25%, from the test code.
Remember, this assignment is due NLT Monday, 16 June 2008.
Reading Assignment | Assignment Requirements |
Assignment Turn-in | Assignment Conference
Assignment Background
This course is about design, specifcially object-oriented design. The course is not about introducing you to new or advanced features of the Java programming language and as such it is really not about Java programming. Granted you will be given opportunities to demonstrate your grasp of object-oriented design using the Java programming language but just writing a Java program that compiles and executes is only half of the grade. The other half is in your design, how you dcoument your design and how you design and implement your tests to prove to me and yourself your design is good.
Assignment Requirements
Design and implement a console, meaning command line, no GUI, application with the following minimal functionality:
- Design and implement Exercise 9.22 on page 396 in the text (this explicitly implies you must also design and implement exercise 9.21 on page 396 also). In addition to the requirements stated in the text, you will also:
- Use the Command pattern from Chapter 10 as follows:
- Design a 'state' class named Results that holds the execution results with appropriate 'getter' and setter' methods for the file name, the number of lines in the file and the number of words in the file as well as well formatted toString method.
- Design a shared application results data class named ApplicationResults that contains variables and appropriate 'getter' and setter' methods for the total number of files processed, the toal number of lines in all the files and the total number of words in all the files as well as a well formatted toString method.
- Design an interface named ICommand that extends IRunnable with the following methods:
- void run() - perform the necessary actions
- Results getResults() - return the execution results
- Design an implementation class named WordCountCommand that implements the ICommand interface. Additional design requirements / information include:
- A single constructor that takes the file name to be processed as well as a reference to the shared ApplicationResults instance.
- The simpliest definition of a line is a 'new line'. Empty lines count towards the total line count.
- The simpliest definition of a word is a sequence of characters of one or more non-whitespace characters separated by one or more whitespace characters (See the String.split method).
- You can assume that you will only process files in the current working directory (See the java.io.File class).
- You can assume that all the files in the current working directory will be text files with lines and words.
- Before returning from the run method, you will update the shared ApplicationResults provided in the constructor using the ReentrantLock mentioned in Chapter 9.
- Design an outer command-controller class named CommandController that will as a minimum:
- Design a test implementation named CommandControllerTest that will as a minimum:
- Instantiate a CommandController instance and run it.
- Retrieve and output to the System.out console the results of each WordCountCommand instance from the CommandController instance.
- Retrieve and output to the System.out console the application results from the CommandController instance.
- Iterate over the retrieved WordCountCommand list and sum up the the total files, lines and words and compare your results with the results in the retrieved application results.
Additional requirements:
- As part of your documentation, ensure you explain all the design concepts you used in your design and implementation. Remember you class level block comments must 'tell the story of your work'.
Minimum general design requirements:
- Demonstrate you have read and understand the concepts in Chapter 2 by documenting the your classes and interfaces using the CRC concept. Think this through,how do you expect your class or interface to be used and how have you implemented the class. Add this documentation to the class level Javadoc comment.
- Document the classes / interfaces and each method and variable using Javadoc style commenting. For each method, which is essentially your public interface, your documentation should include your interface analysis as described in section 3.5. Some attributes will of course be more involved than others but none the less you are to address each of them.
- Because I will be automating the testing of your assignments, it is imperative you follow the class naming that is prescribed.
- You will follow the Java naming conventions, i.e., class names are in Pascal case; methods and variables are in Camel case.
Reading Assignment | Assignment Requirements |
Assignment Turn-in | Assignment Conference
Turn-in Assignment
Instructions - individually post your answers to this assignment in the Assignments Section of the WebTycho classroom. To facilitate easier downloading and grading, please zip all programming and related files (*.java, *.html, etc) and any project files into one file and upload the zipped file using the naming convention lastname_lab#. For example, for this assignment the name would be snuffy_lab4.zip. Do not include any .class or .jar files as I will be compiling your source code as part of my testing.
Reading Assignment | Assignment Requirements |
Assignment Turn-in | Assignment Conference
Conference
I posted a new conference called Lab 4 and I would like you all to freely comment and ask questions pertaining to the chapters covered during this time frame and the assignment. There is a wide range of expertise in the class so here is your chance to learn from each other. Be considerate but do not be afraid to ask or offer an answer. I expect each of you to participate but this not a test but rather a classroom discussion.