Download presentation
Presentation is loading. Please wait.
Published byLenard Hoover Modified over 9 years ago
1
KWIC Project – Part 1 Mini-Project to Evaluate Architectural Patterns(Styles) Carl Chesser Ji Li EECS 761
2
Overview Design – Main-Subroutine – Object Oriented – Pipe and Filter Evaluation – Change in algorithm – Change in data representations – Change in functionality – Performance – Reusability EECS 761
3
Design – Main-Subroutine – Object Oriented – Pipe and Filter Evaluation – Change in algorithm – Change in data representations – Change in functionality – Performance – Reusability EECS 761
4
Design Main-Subroutine Java language Modules – Each module is a class with one static method – Not utilized as an object instance – KeyWordInContextApplication TextLoader TextRotator TextSorter EECS 761
5
Design Main-Subroutine Structure diagram EECS 761
6
Main: KeyWordInContextApplication – Driving module – Responsibilities: Accept the user input (file name to load the textual content) Validate the user input Call TextLoader module to load the text from the specified file. Call TextRotator module to produce all the different rotations (circular shifts). Call TextSorter module to produce a sorted listing of all the textual rotations. Print the results EECS 761 Design Main-Subroutine
7
EECS 761 Design Main-Subroutine Subroutines – TextLoader Responsibility: Takes a file name and loads the contents of the file and returns an ordered listing of strings – TextRotator Responsibility: Takes in a string and produces a list of all the rotations and returns it as a list of strings – TextSorter Responsibility: Takes a listing of strings and returns an ordered listing of those strings which are sorted in a case-insensitive manner
8
Design – Main-Subroutine – Object Oriented – Pipe and Filter Evaluation – Change in algorithm – Change in data representations – Change in functionality – Performance – Reusability EECS 761
9
Design Object Oriented Java language Classes – KeyWordInContextApplication – FileReader – Phrase – Word – PhraseRotator – PhraseList
10
Design Object Oriented Structure diagram EECS 761
11
Design Object Oriented Classes – KeyWordInContextApplication Responsibility: Accept and Validate user input Call FileLoader class to load the text from the specified file Call PhraseRotator class to rotate the Phrases Call PhraseList sorting method to produce a new PhraseList in a sorted order Print the results – Phrase Responsibility: Decompose a raw string into a collection of Word objects
12
EECS 761 Design Object Oriented Classes – PhraseList Responsibility: Maintain a collection of Phrases and own the logic of sorting the collection – FileReader Responsibility: Takes an input and produce a PhraseList representing the contents of input file – PhraseRotator Responsibility: Takes in a Phrase and produces a PhraseList representing all the unique rotations (…Continued)
13
Design – Main-Subroutine – Object Oriented – Pipe and Filter Evaluation – Change in algorithm – Change in data representations – Change in functionality – Performance – Reusability EECS 761
14
Design Pipe and Filter Java language Modules – Rotate – Sort – UNIX shell environment EECS 761
15
Structure diagram EECS 761 Design Pipe and Filter
16
EECS 761 Design Pipe and Filter Modules – Rotate Responsibility: Takes input stream of text and produces an output stream of all the circular rotations – Sort Responsibility: Takes input stream of text and produces an output stream of the sorted form – UNIX shell Responsibility: Produce input stream (cat command) Provide piping functionality
17
Design – Main-Subroutine – Object Oriented – Pipe and Filter Evaluation – Change in algorithm – Change in data representations – Change in functionality – Performance – Reusability EECS 761
18
Evaluation Change in algorithm – Main-subroutine: Changes of one or more subroutines that implement the algorithm will be required Possibly changes on the sequence of subroutines being called – Object Oriented: Only the object implementing the algorithm needs to be updated – Pipe and Filter: Only the filter implementing the algorithm needs to be updated
19
Design – Main-Subroutine – Object Oriented – Pipe and Filter Evaluation – Change in algorithm – Change in data representations – Change in functionality – Performance – Reusability EECS 761
20
Evaluation Change in data representations – Main-subroutine: All modules utilizing this data type would need to be changed – Object Oriented: All objects which reference the data type need to be changed Most primitive types are encapsulated in classes, and therefore would require minimal change – Pipe and Filter: The filter involved with that data type would need to be changed Other filters consuming the serialization of this data type would also need to be changed.
21
Design – Main-Subroutine – Object Oriented – Pipe and Filter Evaluation – Change in algorithm – Change in data representations – Change in functionality – Performance – Reusability EECS 761
22
Evaluation Change in functionality – Main-subroutine: The main program and all of the subroutines may need to be updated – Object Oriented: Only the objects related to implement the new functionality will need to be updated – Pipe and Filter: All filters need to be updated
23
Design – Main-Subroutine – Object Oriented – Pipe and Filter Evaluation – Change in algorithm – Change in data representations – Change in functionality – Performance – Reusability EECS 761
24
Evaluation Performance (Time) – Testing against large text file Text file representation of Les Misérables 67,724 lines and a total of 567,043 words – Execution time captured by “time” command time./kwic-oo les_miserable.txt > kwic-oo.out
25
EECS 761 Evaluation Performance (Time) Object oriented and Main-subroutine have better run-time performance than Pipe-and-Filter. (…Continued) Runskwic-ookwic-proceduralkwic-pf Run 119.33218.85420.672 Run 219.37819.07520.499 Run 319.39920.16620.849 Run 419.54019.27721.170 Run 518.88819.26221.031 Average (seconds) 19.307419.326820.8442
26
EECS 761 Evaluation Performance (Space) – Pipe and Filter space requirement is difficult to capture Utilizing separate Java virtual machines – Main-subroutine would consume less memory than Object Oriented approach OO approach has a lot more objects, thus more overheads
27
Design – Main-Subroutine – Object Oriented – Pipe and Filter Evaluation – Change in algorithm – Change in data representations – Change in functionality – Performance – Reusability EECS 761
28
Evaluation Reusability – Main-subroutine: Limited reusability – Object Oriented: More abstraction per class Very reusable Require additional word for re-assembling – Pipe and Filter: All filters as external components are reusable
29
Questions? Comments? EECS 761
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.