SlideShare a Scribd company logo
1 of 37
Design Pattern
“A case study: Designing a document editor”
Dr. Himanshu Hora
SRMS College of Engineering & Technology
Bareilly (UP) INDIA
1
Contents
• Introduction to Lexi features
• Design problems
• Spelling Checking & Hyphenation
• Solution: Encapsulate Traversal
• Conclusion
2
Introduction to Lexi Features
• WYSIWYG Document Editor
• Mix text and graphics in a variety of styles
• Pull-down Menus
• Scrollbars
• Icons for jumping to a particular page
3
4
Design Problems
1. Document Structure
2. Formatting
3. Embellishing the user interface
4. Supporting multiple look-and-feel standards
5. Supporting multiple window systems
6. User Operations
5
Document Structure
• Goals:
–present document’s visual aspects
–drawing, hit detection, alignment
–support physical structure
(e.g., lines, columns)
• Constraints/forces:
–treat text & graphics uniformly
–no distinction between one & many
6
• 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
7
8
• 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, and their children and parent
• Composite Pattern:
– captures the essence of recursive composition
in object-oriented terms
9
10
11
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
• “Formatting” mean breaking a collection of glyphs in to
lines
• Encapsulating the formatting algorithm
– keep formatting algorithms completely independent
of the document structure
– make it is easy to change the formatting algorithm
– We’ll define a separate class hierarchy for objects that
encapsulate formatting algorithm
12
• Compositor and Composition:
– We’ll define a Compositor class for objects
that can encapsulate a formatting algorithm
– The glyphs Compositor formats are the
children of a special Glyph subclass called
Composition
– When the composition needs formatting, it
calls its compositor’s Compose operation
– Each Compositor subclass can implement a
different line breaking algorithm
• 13
14
15
Embellishing the User Interface
• Considering adds a border around the text
editing area and scrollbars that let the user view
the different parts of the page here
• Transparent Enclosure
– object composition
• Border and Scroller should be a subclass of Glyph
– two notions
• single-child (single-component) composition
• compatible interfaces
16
• Monoglyph:
– We can apply the concept of transparent enclosure to
all glyphs that embellish other glyphs
– the class, Monoglyph
• Decorator Pattern:
– captures class and object relationships that support
embellishment by transparent enclosure
17
18
Supporting Multiple
Look-and-Feel Standards
• Design to support the look-and-feel changing at
run-time
• Abstracting Object Creation:
– widgets
– two sets of widget glyph classes for this purpose
– Lexi needs a way to determine the look-and-feel
standard being targeted
– We must avoid making explicit constructor calls
– We must also be able to replace an entire widget set
easily
– We can achieve both by abstracting the process of
object creation
19
• Factories and Product Classes
– Factories create product objects
– The example
• Abstract Factory Pattern
– capture how to create families of related product
objects without instantiating classes directly
20
21
22
Supporting Multiple Window
Systems
• Lexi to run on many existing window systems
having different programming interfaces
• Encapsulating Implementation Dependencies
– The Window class interface encapsulates the
things windows tend to do across window
systems
– The Window class is an abstract class
• Window and WindowImp
• Bridge Pattern
– to allow separate class hierarchies to work together
even as they evolve independently 23
24
25
26
User Operations
• Requirements:
– Lexi provides different user interfaces for the operations it
supported
– These operations are implemented in many different classes
– Lexi supports undo and redo
• The challenge is to come up with a simple and
extensible mechanism that satisfies all of these
needs
• Encapsulating a Request:
– We could parameterize MenuItem with a function to call, but
that’s not a complete solution
– We should parameterize MenuItems with an object, not a
function
27
• Command Class and Subclasses:
– The Command abstract class consists of a single abstract
operation called “Execute”
– MenuItem can store a Command object that encapsulates a
request
– When a user choose a particular menu item, the MenuItem
simply calls Execute on its Command object to carry out
the request
28
29
30
• Undoability:
– To undo and redo commands, we add an
Unexecute operation to Command’s interface
– A concrete Command would store the state of the
Command for Unexecute
– Reversible operation returns a Boolean value to
determine if a command is undoable
• Command History:
– a list of commands that have been executed
present
past commands
31
Spelling Checking &
Hyphenation
• Goals:
– analyze text for spelling errors
– introduce potential hyphenation sites
• Constraints/forces:
– support multiple algorithms
– don’t tightly couple algorithms with document
structure
32
Solution: Encapsulate Traversal
• Iterator
– encapsulates a traversal algorithm without exposing
representation details to callers
– uses Glyph’s child enumeration operation
– This is an example of a “preorder iterator”
• Intent
– access elements of a container without exposing its representation
• Applicability
– require multiple traversal algorithms over a container
– require a uniform traversal interface over different containers
– when container classes & traversal algorithm must vary independently
33
Structure
34
• Consequences:
+flexibility: aggregate & traversal are independent
+multiple iterators & multiple traversal algorithms
– additional communication overhead between iterator &
aggregate
• Implementation:
– internal versus external iterators
– violating the object structure’s encapsulation
– robust iterators
– synchronization overhead in multi-threaded programs
– batching in distributed & concurrent programs
• Known Uses:
– C++ STL iterators
– JDK Enumeration, Iterator
– Unidraw Iterator
35
Conclusion
• design reuse
• uniform design vocabulary
• understanding, restructuring, & team
communication
• provides the basis for automation
• a “new” way to think about design
36
37
Dr. Himanshu Hora
SRMS College of Engineering & Technology
Bareilly (UP) INDIA

More Related Content

What's hot

Major and Minor Elements of Object Model
Major and Minor Elements of Object ModelMajor and Minor Elements of Object Model
Major and Minor Elements of Object Modelsohailsaif
 
Uml diagrams
Uml diagramsUml diagrams
Uml diagramsbarney92
 
Domain State model OOAD
Domain State model  OOADDomain State model  OOAD
Domain State model OOADRaghu Kumar
 
Dynamic and Static Modeling
Dynamic and Static ModelingDynamic and Static Modeling
Dynamic and Static ModelingSaurabh Kumar
 
object oriented methodologies
object oriented methodologiesobject oriented methodologies
object oriented methodologiesAmith Tiwari
 
Unit 1( modelling concepts & class modeling)
Unit  1( modelling concepts & class modeling)Unit  1( modelling concepts & class modeling)
Unit 1( modelling concepts & class modeling)Manoj Reddy
 
software project management Waterfall model
software project management Waterfall modelsoftware project management Waterfall model
software project management Waterfall modelREHMAT ULLAH
 
Object Oriented Design Concept
Object Oriented Design ConceptObject Oriented Design Concept
Object Oriented Design ConceptSharath g
 
Design Pattern in Software Engineering
Design Pattern in Software EngineeringDesign Pattern in Software Engineering
Design Pattern in Software EngineeringManish Kumar
 
WORKFLOW OF THE PROCESS IN SPM
 WORKFLOW OF THE PROCESS IN SPM WORKFLOW OF THE PROCESS IN SPM
WORKFLOW OF THE PROCESS IN SPMgarishma bhatia
 
Types of UML diagrams
Types of UML diagramsTypes of UML diagrams
Types of UML diagramsMukesh Tekwani
 
Architectural styles and patterns
Architectural styles and patternsArchitectural styles and patterns
Architectural styles and patternsHimanshu
 
Software Process Models
Software Process ModelsSoftware Process Models
Software Process ModelsHassan A-j
 
Model Based Software Architectures
Model Based Software ArchitecturesModel Based Software Architectures
Model Based Software ArchitecturesMunazza-Mah-Jabeen
 
Importance & Principles of Modeling from UML Designing
Importance & Principles of Modeling from UML DesigningImportance & Principles of Modeling from UML Designing
Importance & Principles of Modeling from UML DesigningABHISHEK KUMAR
 
Object Oriented Analysis and Design
Object Oriented Analysis and DesignObject Oriented Analysis and Design
Object Oriented Analysis and DesignHaitham El-Ghareeb
 
Project control and process instrumentation
Project control and process instrumentationProject control and process instrumentation
Project control and process instrumentationKuppusamy P
 

What's hot (20)

Major and Minor Elements of Object Model
Major and Minor Elements of Object ModelMajor and Minor Elements of Object Model
Major and Minor Elements of Object Model
 
Uml diagrams
Uml diagramsUml diagrams
Uml diagrams
 
Domain State model OOAD
Domain State model  OOADDomain State model  OOAD
Domain State model OOAD
 
Dynamic and Static Modeling
Dynamic and Static ModelingDynamic and Static Modeling
Dynamic and Static Modeling
 
object oriented methodologies
object oriented methodologiesobject oriented methodologies
object oriented methodologies
 
Unit 1( modelling concepts & class modeling)
Unit  1( modelling concepts & class modeling)Unit  1( modelling concepts & class modeling)
Unit 1( modelling concepts & class modeling)
 
software project management Waterfall model
software project management Waterfall modelsoftware project management Waterfall model
software project management Waterfall model
 
Object Oriented Design Concept
Object Oriented Design ConceptObject Oriented Design Concept
Object Oriented Design Concept
 
Design Pattern in Software Engineering
Design Pattern in Software EngineeringDesign Pattern in Software Engineering
Design Pattern in Software Engineering
 
WORKFLOW OF THE PROCESS IN SPM
 WORKFLOW OF THE PROCESS IN SPM WORKFLOW OF THE PROCESS IN SPM
WORKFLOW OF THE PROCESS IN SPM
 
Types of UML diagrams
Types of UML diagramsTypes of UML diagrams
Types of UML diagrams
 
UML Diagrams
UML DiagramsUML Diagrams
UML Diagrams
 
Architectural styles and patterns
Architectural styles and patternsArchitectural styles and patterns
Architectural styles and patterns
 
Design patterns tutorials
Design patterns tutorialsDesign patterns tutorials
Design patterns tutorials
 
Software Process Models
Software Process ModelsSoftware Process Models
Software Process Models
 
Unit 5
Unit 5Unit 5
Unit 5
 
Model Based Software Architectures
Model Based Software ArchitecturesModel Based Software Architectures
Model Based Software Architectures
 
Importance & Principles of Modeling from UML Designing
Importance & Principles of Modeling from UML DesigningImportance & Principles of Modeling from UML Designing
Importance & Principles of Modeling from UML Designing
 
Object Oriented Analysis and Design
Object Oriented Analysis and DesignObject Oriented Analysis and Design
Object Oriented Analysis and Design
 
Project control and process instrumentation
Project control and process instrumentationProject control and process instrumentation
Project control and process instrumentation
 

Viewers also liked

Behavioral pattern By:-Priyanka Pradhan
Behavioral pattern By:-Priyanka PradhanBehavioral pattern By:-Priyanka Pradhan
Behavioral pattern By:-Priyanka PradhanPriyanka Pradhan
 
Security and Integrity of Data
Security and Integrity of DataSecurity and Integrity of Data
Security and Integrity of DataAdeel Riaz
 
Creational pattern
Creational patternCreational pattern
Creational patternHimanshu
 
Adapter Design Pattern
Adapter Design PatternAdapter Design Pattern
Adapter Design PatternAdeel Riaz
 
Adapter Design Pattern
Adapter Design PatternAdapter Design Pattern
Adapter Design Patternguy_davis
 
Structural patterns
Structural patternsStructural patterns
Structural patternsHimanshu
 

Viewers also liked (6)

Behavioral pattern By:-Priyanka Pradhan
Behavioral pattern By:-Priyanka PradhanBehavioral pattern By:-Priyanka Pradhan
Behavioral pattern By:-Priyanka Pradhan
 
Security and Integrity of Data
Security and Integrity of DataSecurity and Integrity of Data
Security and Integrity of Data
 
Creational pattern
Creational patternCreational pattern
Creational pattern
 
Adapter Design Pattern
Adapter Design PatternAdapter Design Pattern
Adapter Design Pattern
 
Adapter Design Pattern
Adapter Design PatternAdapter Design Pattern
Adapter Design Pattern
 
Structural patterns
Structural patternsStructural patterns
Structural patterns
 

Similar to Design Pattern

Software Design Patterns
Software Design PatternsSoftware Design Patterns
Software Design PatternsSatheesh Sukumaran
 
Software Design Patterns
Software Design PatternsSoftware Design Patterns
Software Design PatternsSatheesh Sukumaran
 
Software Engineering Lec 8-design-
Software Engineering Lec 8-design-Software Engineering Lec 8-design-
Software Engineering Lec 8-design-Taymoor Nazmy
 
Andrii Sliusar "Module Architecture of React-Redux Applications"
Andrii Sliusar "Module Architecture of React-Redux Applications"Andrii Sliusar "Module Architecture of React-Redux Applications"
Andrii Sliusar "Module Architecture of React-Redux Applications"LogeekNightUkraine
 
AngularJS
AngularJSAngularJS
AngularJSYogesh L
 
Cs 1023 lec 8 design pattern (week 2)
Cs 1023 lec 8 design pattern (week 2)Cs 1023 lec 8 design pattern (week 2)
Cs 1023 lec 8 design pattern (week 2)stanbridge
 
Data Structure and Algorithms
Data Structure and AlgorithmsData Structure and Algorithms
Data Structure and Algorithmsiqbalphy1
 
UNIT IV DESIGN PATTERNS.pptx
UNIT IV DESIGN PATTERNS.pptxUNIT IV DESIGN PATTERNS.pptx
UNIT IV DESIGN PATTERNS.pptxanguraju1
 
Design patterns Structural
Design patterns StructuralDesign patterns Structural
Design patterns StructuralUMAR ALI
 
Chapter 4_Introduction to Patterns.ppt
Chapter 4_Introduction to Patterns.pptChapter 4_Introduction to Patterns.ppt
Chapter 4_Introduction to Patterns.pptRushikeshChikane1
 
Chapter 4_Introduction to Patterns.ppt
Chapter 4_Introduction to Patterns.pptChapter 4_Introduction to Patterns.ppt
Chapter 4_Introduction to Patterns.pptRushikeshChikane2
 
Asp 1-mvc introduction
Asp 1-mvc introductionAsp 1-mvc introduction
Asp 1-mvc introductionFajar Baskoro
 
Unified Modeling Language (UML), Object-Oriented Programming Concepts & Desig...
Unified Modeling Language (UML), Object-Oriented Programming Concepts & Desig...Unified Modeling Language (UML), Object-Oriented Programming Concepts & Desig...
Unified Modeling Language (UML), Object-Oriented Programming Concepts & Desig...Isuru Perera
 
Component level design
Component   level designComponent   level design
Component level designMidhula Chandren
 
Diksha sda presentation
Diksha sda presentationDiksha sda presentation
Diksha sda presentationdikshagupta111
 

Similar to Design Pattern (20)

Design patterns
Design patternsDesign patterns
Design patterns
 
Software Design Patterns
Software Design PatternsSoftware Design Patterns
Software Design Patterns
 
Software Design Patterns
Software Design PatternsSoftware Design Patterns
Software Design Patterns
 
Design Patterns - GOF
Design Patterns - GOFDesign Patterns - GOF
Design Patterns - GOF
 
Software Engineering Lec 8-design-
Software Engineering Lec 8-design-Software Engineering Lec 8-design-
Software Engineering Lec 8-design-
 
Andrii Sliusar "Module Architecture of React-Redux Applications"
Andrii Sliusar "Module Architecture of React-Redux Applications"Andrii Sliusar "Module Architecture of React-Redux Applications"
Andrii Sliusar "Module Architecture of React-Redux Applications"
 
AngularJS
AngularJSAngularJS
AngularJS
 
Cs 1023 lec 8 design pattern (week 2)
Cs 1023 lec 8 design pattern (week 2)Cs 1023 lec 8 design pattern (week 2)
Cs 1023 lec 8 design pattern (week 2)
 
Data Structure and Algorithms
Data Structure and AlgorithmsData Structure and Algorithms
Data Structure and Algorithms
 
UNIT IV DESIGN PATTERNS.pptx
UNIT IV DESIGN PATTERNS.pptxUNIT IV DESIGN PATTERNS.pptx
UNIT IV DESIGN PATTERNS.pptx
 
Design patterns Structural
Design patterns StructuralDesign patterns Structural
Design patterns Structural
 
Chapter 4_Introduction to Patterns.ppt
Chapter 4_Introduction to Patterns.pptChapter 4_Introduction to Patterns.ppt
Chapter 4_Introduction to Patterns.ppt
 
Chapter 4_Introduction to Patterns.ppt
Chapter 4_Introduction to Patterns.pptChapter 4_Introduction to Patterns.ppt
Chapter 4_Introduction to Patterns.ppt
 
Asp 1-mvc introduction
Asp 1-mvc introductionAsp 1-mvc introduction
Asp 1-mvc introduction
 
Real-Time Design Patterns
Real-Time Design PatternsReal-Time Design Patterns
Real-Time Design Patterns
 
Patterns
PatternsPatterns
Patterns
 
Unified Modeling Language (UML), Object-Oriented Programming Concepts & Desig...
Unified Modeling Language (UML), Object-Oriented Programming Concepts & Desig...Unified Modeling Language (UML), Object-Oriented Programming Concepts & Desig...
Unified Modeling Language (UML), Object-Oriented Programming Concepts & Desig...
 
Component level design
Component   level designComponent   level design
Component level design
 
Design patterns-sav
Design patterns-savDesign patterns-sav
Design patterns-sav
 
Diksha sda presentation
Diksha sda presentationDiksha sda presentation
Diksha sda presentation
 

More from Himanshu

Software product line
Software product lineSoftware product line
Software product lineHimanshu
 
Shared information systems
Shared information systemsShared information systems
Shared information systemsHimanshu
 
Architecture Review
Architecture ReviewArchitecture Review
Architecture ReviewHimanshu
 
Reliability and its principals
Reliability and its principalsReliability and its principals
Reliability and its principalsHimanshu
 
Structural and functional testing
Structural and functional testingStructural and functional testing
Structural and functional testingHimanshu
 
White box black box & gray box testing
White box black box & gray box testingWhite box black box & gray box testing
White box black box & gray box testingHimanshu
 
Pareto analysis
Pareto analysisPareto analysis
Pareto analysisHimanshu
 
Load runner & win runner
Load runner & win runnerLoad runner & win runner
Load runner & win runnerHimanshu
 
Crud and jad
Crud and jadCrud and jad
Crud and jadHimanshu
 
Junit and cactus
Junit and cactusJunit and cactus
Junit and cactusHimanshu
 
Risk based testing and random testing
Risk based testing and random testingRisk based testing and random testing
Risk based testing and random testingHimanshu
 
Testing a data warehouses
Testing a data warehousesTesting a data warehouses
Testing a data warehousesHimanshu
 
Software testing tools and its taxonomy
Software testing tools and its taxonomySoftware testing tools and its taxonomy
Software testing tools and its taxonomyHimanshu
 
Software reliability engineering process
Software reliability engineering processSoftware reliability engineering process
Software reliability engineering processHimanshu
 
Software reliability growth model
Software reliability growth modelSoftware reliability growth model
Software reliability growth modelHimanshu
 
Software reliability tools and common software errors
Software reliability tools and common software errorsSoftware reliability tools and common software errors
Software reliability tools and common software errorsHimanshu
 
Regression and performance testing
Regression and performance testingRegression and performance testing
Regression and performance testingHimanshu
 
Eleven step of software testing process
Eleven step of software testing processEleven step of software testing process
Eleven step of software testing processHimanshu
 
Off the-shelf components (cots)
Off the-shelf components (cots)Off the-shelf components (cots)
Off the-shelf components (cots)Himanshu
 

More from Himanshu (20)

Software product line
Software product lineSoftware product line
Software product line
 
Shared information systems
Shared information systemsShared information systems
Shared information systems
 
Saam
SaamSaam
Saam
 
Architecture Review
Architecture ReviewArchitecture Review
Architecture Review
 
Reliability and its principals
Reliability and its principalsReliability and its principals
Reliability and its principals
 
Structural and functional testing
Structural and functional testingStructural and functional testing
Structural and functional testing
 
White box black box & gray box testing
White box black box & gray box testingWhite box black box & gray box testing
White box black box & gray box testing
 
Pareto analysis
Pareto analysisPareto analysis
Pareto analysis
 
Load runner & win runner
Load runner & win runnerLoad runner & win runner
Load runner & win runner
 
Crud and jad
Crud and jadCrud and jad
Crud and jad
 
Junit and cactus
Junit and cactusJunit and cactus
Junit and cactus
 
Risk based testing and random testing
Risk based testing and random testingRisk based testing and random testing
Risk based testing and random testing
 
Testing a data warehouses
Testing a data warehousesTesting a data warehouses
Testing a data warehouses
 
Software testing tools and its taxonomy
Software testing tools and its taxonomySoftware testing tools and its taxonomy
Software testing tools and its taxonomy
 
Software reliability engineering process
Software reliability engineering processSoftware reliability engineering process
Software reliability engineering process
 
Software reliability growth model
Software reliability growth modelSoftware reliability growth model
Software reliability growth model
 
Software reliability tools and common software errors
Software reliability tools and common software errorsSoftware reliability tools and common software errors
Software reliability tools and common software errors
 
Regression and performance testing
Regression and performance testingRegression and performance testing
Regression and performance testing
 
Eleven step of software testing process
Eleven step of software testing processEleven step of software testing process
Eleven step of software testing process
 
Off the-shelf components (cots)
Off the-shelf components (cots)Off the-shelf components (cots)
Off the-shelf components (cots)
 

Recently uploaded

Millenials and Fillennials (Ethical Challenge and Responses).pptx
Millenials and Fillennials (Ethical Challenge and Responses).pptxMillenials and Fillennials (Ethical Challenge and Responses).pptx
Millenials and Fillennials (Ethical Challenge and Responses).pptxJanEmmanBrigoli
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxlancelewisportillo
 
Measures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataMeasures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataBabyAnnMotar
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management SystemChristalin Nelson
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptxmary850239
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Seán Kennedy
 
The Contemporary World: The Globalization of World Politics
The Contemporary World: The Globalization of World PoliticsThe Contemporary World: The Globalization of World Politics
The Contemporary World: The Globalization of World PoliticsRommel Regala
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
Textual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSTextual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSMae Pangan
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfErwinPantujan2
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxVanesaIglesias10
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management systemChristalin Nelson
 
Activity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationActivity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationRosabel UA
 

Recently uploaded (20)

Millenials and Fillennials (Ethical Challenge and Responses).pptx
Millenials and Fillennials (Ethical Challenge and Responses).pptxMillenials and Fillennials (Ethical Challenge and Responses).pptx
Millenials and Fillennials (Ethical Challenge and Responses).pptx
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
 
Measures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataMeasures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped data
 
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptxLEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management System
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx
 
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptxYOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...
 
The Contemporary World: The Globalization of World Politics
The Contemporary World: The Globalization of World PoliticsThe Contemporary World: The Globalization of World Politics
The Contemporary World: The Globalization of World Politics
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptxYOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
 
Textual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSTextual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHS
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptx
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management system
 
Activity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationActivity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translation
 

Design Pattern

  • 1. Design Pattern “A case study: Designing a document editor” Dr. Himanshu Hora SRMS College of Engineering & Technology Bareilly (UP) INDIA 1
  • 2. Contents • Introduction to Lexi features • Design problems • Spelling Checking & Hyphenation • Solution: Encapsulate Traversal • Conclusion 2
  • 3. Introduction to Lexi Features • WYSIWYG Document Editor • Mix text and graphics in a variety of styles • Pull-down Menus • Scrollbars • Icons for jumping to a particular page 3
  • 4. 4
  • 5. Design Problems 1. Document Structure 2. Formatting 3. Embellishing the user interface 4. Supporting multiple look-and-feel standards 5. Supporting multiple window systems 6. User Operations 5
  • 6. Document Structure • Goals: –present document’s visual aspects –drawing, hit detection, alignment –support physical structure (e.g., lines, columns) • Constraints/forces: –treat text & graphics uniformly –no distinction between one & many 6
  • 7. • 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 7
  • 8. 8
  • 9. • 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, and their children and parent • Composite Pattern: – captures the essence of recursive composition in object-oriented terms 9
  • 10. 10
  • 11. 11
  • 12. 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 • “Formatting” mean breaking a collection of glyphs in to lines • Encapsulating the formatting algorithm – keep formatting algorithms completely independent of the document structure – make it is easy to change the formatting algorithm – We’ll define a separate class hierarchy for objects that encapsulate formatting algorithm 12
  • 13. • Compositor and Composition: – We’ll define a Compositor class for objects that can encapsulate a formatting algorithm – The glyphs Compositor formats are the children of a special Glyph subclass called Composition – When the composition needs formatting, it calls its compositor’s Compose operation – Each Compositor subclass can implement a different line breaking algorithm • 13
  • 14. 14
  • 15. 15
  • 16. Embellishing the User Interface • Considering adds a border around the text editing area and scrollbars that let the user view the different parts of the page here • Transparent Enclosure – object composition • Border and Scroller should be a subclass of Glyph – two notions • single-child (single-component) composition • compatible interfaces 16
  • 17. • Monoglyph: – We can apply the concept of transparent enclosure to all glyphs that embellish other glyphs – the class, Monoglyph • Decorator Pattern: – captures class and object relationships that support embellishment by transparent enclosure 17
  • 18. 18
  • 19. Supporting Multiple Look-and-Feel Standards • Design to support the look-and-feel changing at run-time • Abstracting Object Creation: – widgets – two sets of widget glyph classes for this purpose – Lexi needs a way to determine the look-and-feel standard being targeted – We must avoid making explicit constructor calls – We must also be able to replace an entire widget set easily – We can achieve both by abstracting the process of object creation 19
  • 20. • Factories and Product Classes – Factories create product objects – The example • Abstract Factory Pattern – capture how to create families of related product objects without instantiating classes directly 20
  • 21. 21
  • 22. 22
  • 23. Supporting Multiple Window Systems • Lexi to run on many existing window systems having different programming interfaces • Encapsulating Implementation Dependencies – The Window class interface encapsulates the things windows tend to do across window systems – The Window class is an abstract class • Window and WindowImp • Bridge Pattern – to allow separate class hierarchies to work together even as they evolve independently 23
  • 24. 24
  • 25. 25
  • 26. 26
  • 27. User Operations • Requirements: – Lexi provides different user interfaces for the operations it supported – These operations are implemented in many different classes – Lexi supports undo and redo • The challenge is to come up with a simple and extensible mechanism that satisfies all of these needs • Encapsulating a Request: – We could parameterize MenuItem with a function to call, but that’s not a complete solution – We should parameterize MenuItems with an object, not a function 27
  • 28. • Command Class and Subclasses: – The Command abstract class consists of a single abstract operation called “Execute” – MenuItem can store a Command object that encapsulates a request – When a user choose a particular menu item, the MenuItem simply calls Execute on its Command object to carry out the request 28
  • 29. 29
  • 30. 30
  • 31. • Undoability: – To undo and redo commands, we add an Unexecute operation to Command’s interface – A concrete Command would store the state of the Command for Unexecute – Reversible operation returns a Boolean value to determine if a command is undoable • Command History: – a list of commands that have been executed present past commands 31
  • 32. Spelling Checking & Hyphenation • Goals: – analyze text for spelling errors – introduce potential hyphenation sites • Constraints/forces: – support multiple algorithms – don’t tightly couple algorithms with document structure 32
  • 33. Solution: Encapsulate Traversal • Iterator – encapsulates a traversal algorithm without exposing representation details to callers – uses Glyph’s child enumeration operation – This is an example of a “preorder iterator” • Intent – access elements of a container without exposing its representation • Applicability – require multiple traversal algorithms over a container – require a uniform traversal interface over different containers – when container classes & traversal algorithm must vary independently 33
  • 35. • Consequences: +flexibility: aggregate & traversal are independent +multiple iterators & multiple traversal algorithms – additional communication overhead between iterator & aggregate • Implementation: – internal versus external iterators – violating the object structure’s encapsulation – robust iterators – synchronization overhead in multi-threaded programs – batching in distributed & concurrent programs • Known Uses: – C++ STL iterators – JDK Enumeration, Iterator – Unidraw Iterator 35
  • 36. Conclusion • design reuse • uniform design vocabulary • understanding, restructuring, & team communication • provides the basis for automation • a “new” way to think about design 36
  • 37. 37 Dr. Himanshu Hora SRMS College of Engineering & Technology Bareilly (UP) INDIA