Docsity

Lecture Notes on Key Word in Context - Software Development Process | CS 6300, Study notes of Computer Science

Partial preview of the text

Download Lecture Notes on Key Word in Context - Software Development Process | CS 6300 and more Study notes Computer Science in PDF only on Docsity!

KWIC Exercise

• D. Parnas. "On the Criteria to be

Used in Decomposing Systems into

Modules." Communications of the

ACM, 15(12):1053-1058, December

Key Word in Context (KWIC)

The KWIC index system accepts as input an ordered set of lines, each line is an ordered set of words, and each word is an ordered set of characters. Any line may be “circularly shifted” by repeatedly removing the first word and appending it at the end of the line. The KWIC index system outputs a listing of all circular shifts of all lines in alphabetical order of the keyword used to shift the line

  • Common ( stop ) words may be omitted

EXAMPLE WITH

MULTIPLE TITLES

  • Gone with the Wind
  • War and Remembrances
  • The Winds of War

KWIC EXAMPLE

Gone with the Wind and Remembrances War Winds of War The War and Remembrances with the Wind Gone The Winds of War

SHARED DATA

DECOMPOSITION

  • Break into components based on functions computed - Also Known As: Functional Decomposition
  • All components share access to data in memory
  • Usually contain a master-controller routine - Dependencies realized with function calls

MODULES

  • Input: reads titles, stores in memory
  • Circular shifter: constructs array of pairs <line index; word index>
  • Alphabetizer: batch sorting of circular shifts
  • Output
  • Master controller

ABSTRACT DATA TYPES

(ADT) DECOMPOSITION

  • Organization based on data structures
  • Representation hiding
  • Modules holding data structures also provide services
  • Basis for object orientation

MODULES

  • Line: ADT
  • Input: reads titles, hands to Line
  • Characters: ADT
  • Circular shifter: ADT
  • Alphabetic Shifts: ADT
    • I-th circular shift
  • Output
  • Master controller

IMPLICIT INVOCATION

  • Client modules express interest in state changes in server modules ( registration )
  • Server announces changes to all registered listeners ( broadcast )
  • Server does not know identity of clients
  • Unit of notification is the event

MODULES

  • Input of new line
  • Update line data structure
  • Invoke circular shifter
  • Update (second) line data structure
  • Invoke alphabetizer

PIPE AND FILTER

  • System organized into independent programs ( filters )
  • Each filter takes in input (stdin) and produces output (stdout)
  • Filters are connected together via FIFO queues ( pipes )
  • Common assumption of sequential files containing lines of ASCII characters - Can you think of a non-ASCII example?

MODULES

  • Filters for circular shift and alphabetizer
  • Pipe connections with files of FIFOs
  • No common data storage

EVALUATION

  • Shared data
    • Intuitive, efficient access
    • Brittle to changes in representation
  • ADT (with no data sharing)
    • Maintainability, reuse
    • Performance
  • Implicit invocation (active data)
    • Enhancements, data representation changes, reuse
    • Difficult to control/think about, inefficient
  • Pipe and filter
    • Intuitive, reuse
    • Interactivity, space efficiency

EXERCISE CONTINUED

  • List at least three possible enhancements / improvements that could be made to KWIC
  • For each of the four styles (shared data, ADT, implicit invocation, pipe and filter) indicate how well it would cope with each of your changes - Use the categories ( brittle, moderate, easy ) to label your choices