Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Assessment Item I2 – Design and Implementation of a class for solving a concordance problem - CS262 Object-Oriented Design and Programming II Skill being assessed - Design and Implementation of a class for solving a concordance problem, that is, counting the occurrence of certain keywords or phrases in a file and then being able to produce those counts in a specified order. This should be done by using classes and features available in the Java library such as the I/O classes, classes in the Java Collection Framework, and generic type feature, and writing exception handlers. Program outcome to which this skill is mapped: (i) An ability to use current techniques, skills, and tools necessary for computing practice. Performance Assessment Abstract: This integrates a number of learning outcomes in the course including reading from a file, writing exception handlers, providing flexibility, applying collections such as hashMap, TreeMap, and their methods appropriately in the Java Collection Framework, and achieving efficiency, and robustness of programs. The student is expected to investigate the Java library and use the classes and methods in the library as much as possible. The student is asked to read the text from a text file with exception handlers to ensure the program will degrade gracefully when unexpected problems arise in file reading. The keywords or phrases for which the student is asked to produce a concordance are delimited by simple syntactical structures such as white space and punctuations. The student is asked to count these keywords and phrases and reject other words and/or phrases, e.g., those that do not begin with a letter. Each word or concordance in the file should be displayed in lexicographical order, followed by its occurrence count. The design and implementation must show that the student has attained the learning outcomes listed below: 1. [Command line input for the filename] The input text file is passed as a command-line argument. If no argument is passed, print a message on the proper usage and terminate the program. 2. [File reading] Use an effective FileReader class to read the input text file. 3. [Exceptions and exception handling] Write exception handlers to handle runtime and unchecked exceptions. 4. [StringTokenizer class] Apply the appropriate constructor of the StringTokenizer class to extract a word at a time. 5. [HashMap Collection] Apply the HashMap Collection to efficiently collect and access the unique words. 6. [Generic type] Apply the appropriate generic types so that no compiler warnings are produced when the program is compiled. 7. [TreeMap Collection] and [Decorator Design Pattern] Apply the TreeMap Collection to the hash map to sort the elements by the key. The student should not write their own sort methods. 8. [Set Collection], [Decorator Pattern] [Map.Entry interface] Decorate the entry set of the TreeMap collection as a set and print the elements using the Foreach loop in version of Java 5 or later. Rubric for Evaluation Criteria Correctness, Efficiency and robustness of Design Exemplary The design of the class demonstrates indepth investigation of the java library and thorough understanding of generic types, Java Collections Framework, the Decorator Design Pattern. The class applies the appropriate Collections efficiently and easy to understand. The program applies the exception handlers for a wide range of potential problems that may arise in file reading. Implementation The implementation of the class is carried out in modular, elegant and logical fashion. Satisfactory The design of the class achieves the goal correctly – program compiles without warnings demonstrating appropriate use of generic types; produces correct results; provides exception handlers to ensure the program will degrade gracefully on exceptions; applies collections and uses the Decorator pattern to sort and display. However, some aspects are unnecessary, inefficient, or awkward e.g. first depositing words into an ArrayList then into a HashMap For most of the methods of the class, the implementation is carried out appropriately as designed. However, in a few situations, the implementation is done awkwardly or inefficiently. Nonetheless all methods work as specified in the documentation. Marginal The design of the class applies the Java library classes in a limited way – using inappropriate I/O classes that reading is inefficient; the exception handlers are limited; inappropriate use of Collections Framework Deficient The design of the class is so flawed that the results are incorrect; the exception handlers, though present, are meaningless and ineffective; erroneous use of Collections Framework Relatively few of the methods of the class are implemented in a fashion that is as simple or as efficient as possible. Almost all of the methods of the class are implemented inappropriately or incorrectly, with the result that the class is essentially unusable. Documentation of Design and implementation The documentation for class constructors and methods correctly specifies how a client program would instantiate objects and call on the methods provided by an object instance of the class. The documentation follows the Javadoc convention for publication purposes. It provides explanation of the rationale of method calls. The documentation for class constructors and methods correctly specifies how a client program would instantiate objects and call on the methods provided by an object instance of the class. The documentation follows the Javadoc convention for publication purposes. However, for a small number of the methods, the documentation should provide more details regarding their use by a client program. Testing Provides a thorough set of test cases on a spectrum of situations, and testing acceptable/unacce ptable keyword or phrases in a number of input files including the given sample test file, and stating the expected results (sorted keywords and phrases from the concordance and their counts) in each. Develops sufficiently test cases on the given sample test file with some modifications to include unacceptable keywords/phrases and states the expected results in the test cases. The documentation for the class constructors and methods specifies in overly general terms how a client program would instantiate objects and call on the methods provided by an object instance of the class. The documentation does not follow the Javadoc convention for publication purposes. As a result the developer of such a client program would often have questions regarding the purpose of the methods, the return value of the methods or regarding the role of particular method calls Runs the class on the given sample test file the only test case with expected results. However, the test case is not enough to be convincingly complete. The documentation for class constructors and methods is often incorrect or stated in such vague terms as to be of no help to the developer of a client program that would want to use the class. The documentation of the class and/or methods is lacking. Runs the class on the given sample test file as the only test case but did not state the expected result and did not recognize errors in the output.