Unit - II A Case Study: Design Problems
Unit - II A Case Study: Design Problems
Design Problems:
• seven problems in Lexis's design:
1.Document Structure:
• Document Structure:
The choice of internal representation for the
document affects nearly every aspect of
Lexis's design. All editing , formatting,
displaying, and textual analysis will require
traversing the representation.
Document Structure:
Document Structure:
• Goals:
–present document’s visual aspects
–drawing, hit detection, alignment
–support physical
structure (e.g., lines,
columns)
Document Structure:
• Constraints/forces:
–treat text & graphics uniformly.
–no distinction between one & many.
Document Structure:
• Some constraints:
–we should treat text and graphics
uniformly.
–our implementation shouldn’t have to
distinguish between single elements and
groups of elements in the internal
representation.
• Recursive Composition:
• –a common way to represent hierarchically
structured information
• Glyphs:
–an abstract class for all objects that can appear in a document structure. Three basic responsibilities, they know
• How to draw themselves
• What space they occupy
• Their children and parent
2.Formatting
• Formatting:
How does Lexi actually arrange text and
graphics into lines and columns?
What objects are responsible for carrying out
different formatting policies?
How do these policies interact with the
document’s internal representation?
• Formatting :
• A structure that corresponds to a properly formatted document.
• Representation and formatting are distinct
– the ability to capture the document’s physical structure doesn’t tell us how to arrive at a particular structure.
• here, we’ll restrict “formatting” to mean breaking a collection of glyphs in to lines.
• Transparent Enclosure:
– inheritance-based approach will result in some problems.
– Composition, ScollableComposition, BorderedScrollableComposition.
– object composition offers a potentially more workable and flexible extension mechanism.
• Monoglyph
– We can apply the concept of transparent enclosure to all glyphs that embellish other glyphs.
• We’d like Lexi to run on many existing window systems having different programming interfaces.
• Can we use an Abstract Factory?
– As the different programming interfaces on these existing window systems, the Abstract Factory pattern doesn‘t
work.
– We need a uniform set of windowing abstractions that lets us take different window system impelementations and
slide any one of them under a common interface.
• To undo a command, unexecute() is called on the command on the front of the list.
• The “present” position is moved past the last command.
Undoing Previous command:
• Redoing the Next Command:
• To redo the command that was just undone, execute() is called on that command.
• The present pointer is moved up past that command.
• The Command Pattern:
• Encapsulate a request as an object
• The Command Patterns lets you
– parameterize clients with different requests
– queue or log requests
– support undoable operations
• Also Known As: Action, Transaction.
7.Spelling checking and Hyphenation