SlideShare a Scribd company logo
cf.OBJECTIVE(ANZ)
Design Patterns and Form Processing
Jaime Metcher
Software Architect, Centre for Innovation in Professional Learning, University of Queensland
About me
B.Sc (maths)
Aerial survey software (in the 80's!)
Kids
LAN wrangler at UQ
Coldfusioneer at Med-E-Serv
Archi-thingie back at UQ
B.Sc (maths)
Aerial survey software (in the 80's!)
Kids
LAN wrangler at UQ
Coldfusioneer at Med-E-Serv
Archi-thingie back at UQ
OUTPUT 2500AD
ORG 2000H
MOV DX,0FFE6H
MOV AX,82H
OUT DX,AL
NEXT:MOV AX,3000H
MOV BX,0000H
CALL DISP
NOT AL
MOV 3001H,AL
MOV BX,0100H
CALL DISP
JMP SHORT NEXT
DISP:PUSH AX
MOV CX,1
CALL FAR 0FF00:0B12H
POP AX
RET
END
About you
Your team lead is bugging you
You are the team lead and you want to bug your
juniors:

What do you do that's so great?

How do you teach that?
You want to pad your CV
You know all about patterns and you're here to
heckle
You thought this was the Railo talk
Outline
Design Patterns by Example

Template method

Composite
Design Patterns World Tour

Architecture

Software engineering

Education
Conclusion

Motherhood statements

Resources

Questions
Example – form processing
Simple
See code sample - simple
Example – form processing
Let's componentize a bit...
See code sample - simple.cfc
Example – form processing
Add some functionality:

Support multiple forms on a page

Detect incomplete form transmission
See code sample - bettercfc
Example – form processing
Now refactor out some common functionality:
See code sample - bettercfcrefactored
Example – form processing
A little less procedural, just for fun:
See code sample - templatemethod
Template method
if (isSubmitted() and validated()) {
commit();
}
Other ways to do this?
Define the skeleton of an algorithm in an operation, deferring some
steps to subclasses. Template Method lets subclasses redefine
certain steps of an algorithm without changing the algorithm's
structure.
- Design Patterns: Gamma et al. (aka GoF)
Example – form processing
OK, let's separate some concerns:
See code sample - templatemethodrefactored
Example – form processing
More guts, more glory
See code sample – composite
Composite
Compose objects into tree structures to represent part-whole hierarchies. Composite lets
clients treat individual objects and compositions of objects uniformly
- Design Patterns: Gamma et al. (aka GoF)
myCompositeFormGuts = CreateObject("component",
"compositeFormGuts").init("puttin_it_togetha");
myCompositeFormGuts.addChild(myFormGuts1);
myCompositeFormGuts.addChild(myFormGuts2);
What's a pattern?
Name
Intent
Context
How it works
Trade-offs
And why should I care?
Prevent 'defactoring'
“Hey, I noticed there was this totally unnecessary inheritance lying around so I
refactored it out”
Communication
“Why do we have this one crazy class that has the same interface as all the
others but is completely different under the hood?”
Education
World tour - architecture
Alexander's “A Pattern Language” - read it!
Light on two sides:
When they have a choice, people will always gravitate to those rooms which
have light on two sides, and leave the rooms which are lit only from one side
unused and empty.
Therefore:
Locate each room so that it has outdoor space outside it on at least two sides,
and then place windows in these outdoor walls so that natural light falls into
every room from more than one direction.
World Tour – Software Engineering
GoF – Design Patterns
Singleton
Iterator
Decorator
Martin Fowler – PoEAA
Front Controller
Gateway
Single Table Inheritance
Gregor Hohpe – Enterprise Integration Patterns
Message Endpoint
Publish-Subscribe Channel
Guaranteed Delivery
World tour - education
CIPL (my lot)
Chunking & toggling
Peer leader
Hypothetical professionals
E-LEN project
Coherence principle
Provide personal identity information
Motherhood statements
Patterns are primarily about communication
Patterns are not templates or rules
Pattern use is all about professional judgement
A pattern by definition is not new
Resources
Books
A Pattern Language: Towns, Buildings, Construction
Christopher Alexander, Sara Ishikawa, Murry Silverstein
ISBN 978-0195019193
Design Patterns: Elements of Reusable Object-Oriented Software
Erich Gamma, Richard Helm, Ralph Johnson, John M. Vlissides
ISBN 978-0201633610
Enterprise Integration Patterns: Designing, Building, and Deploying Messaging Solutions
Gregor Hohpe & Bobby Woolf
ISBN 978-0321200686
Patterns of Enterprise Application Architecture
Martin Fowler
ISBN 978-0321127426
Applying UML and Patterns: An Introduction to Object-Oriented Analysis and Design and Iterative Development
Craig Larman
ISBN 978-013148906
Websites
E-LEN http://www2.tisip.no/E-LEN/patterns_info.php
Some patterns in the education field
CIPL http://www.uq.edu.au/cipl
No patterns here yet :(
http://www.daimi.au.dk/~apaipi/workshop/nyartikel.pdf
Article by Aino Corry on patterns vs language constructs. See also her talk on patterns in functional languages on InfoQ.
Argue!
jmetcher@gmail.com
http://lagod.id.au
Ad

More Related Content

Similar to Design Patterns and Form Processing (20)

CASE tools and their effects on software quality
CASE tools and their effects on software qualityCASE tools and their effects on software quality
CASE tools and their effects on software quality
Utkarsh Agarwal
 
So You Just Inherited a $Legacy Application...
So You Just Inherited a $Legacy Application...So You Just Inherited a $Legacy Application...
So You Just Inherited a $Legacy Application...
Joe Ferguson
 
Architecting for Change: An Agile Approach
Architecting for Change: An Agile ApproachArchitecting for Change: An Agile Approach
Architecting for Change: An Agile Approach
Ben Stopford
 
Patterns in Python
Patterns in PythonPatterns in Python
Patterns in Python
dn
 
Rejunevating software reengineering processes
Rejunevating software reengineering processesRejunevating software reengineering processes
Rejunevating software reengineering processes
manishthaper
 
Agile and Modeling / MDE : friends or foes? (Agile Tour Nantes 2010)
Agile and Modeling / MDE : friends or foes? (Agile Tour  Nantes 2010)Agile and Modeling / MDE : friends or foes? (Agile Tour  Nantes 2010)
Agile and Modeling / MDE : friends or foes? (Agile Tour Nantes 2010)
Jordi Cabot
 
ChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps ProductivityChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps Productivity
VictorSzoltysek
 
Lecture 1 uml with java implementation
Lecture 1 uml with java implementationLecture 1 uml with java implementation
Lecture 1 uml with java implementation
the_wumberlog
 
Software Modeling and Artificial Intelligence: friends or foes?
Software Modeling and Artificial Intelligence: friends or foes?Software Modeling and Artificial Intelligence: friends or foes?
Software Modeling and Artificial Intelligence: friends or foes?
Jordi Cabot
 
2015.01.09 - Writing Modern Applications for Mobile and Web
2015.01.09 - Writing Modern Applications for Mobile and Web2015.01.09 - Writing Modern Applications for Mobile and Web
2015.01.09 - Writing Modern Applications for Mobile and Web
Marco Parenzan
 
Certification Study Group - NLP & Recommendation Systems on GCP Session 5
Certification Study Group - NLP & Recommendation Systems on GCP Session 5Certification Study Group - NLP & Recommendation Systems on GCP Session 5
Certification Study Group - NLP & Recommendation Systems on GCP Session 5
gdgsurrey
 
How Azure helps to build better business processes and customer experiences w...
How Azure helps to build better business processes and customer experiences w...How Azure helps to build better business processes and customer experiences w...
How Azure helps to build better business processes and customer experiences w...
Maxim Salnikov
 
Day5
Day5Day5
Day5
madamewoolf
 
Aspect Oriented Software Development
Aspect Oriented Software DevelopmentAspect Oriented Software Development
Aspect Oriented Software Development
Jignesh Patel
 
NEXiDA at OMG June 2009
NEXiDA at OMG June 2009NEXiDA at OMG June 2009
NEXiDA at OMG June 2009
Claudio Rubbiani
 
10 Ways To Improve Your Code
10 Ways To Improve Your Code10 Ways To Improve Your Code
10 Ways To Improve Your Code
ConSanFrancisco123
 
[DSC Europe 23] Igor Ilic - Redefining User Experience with Large Language Mo...
[DSC Europe 23] Igor Ilic - Redefining User Experience with Large Language Mo...[DSC Europe 23] Igor Ilic - Redefining User Experience with Large Language Mo...
[DSC Europe 23] Igor Ilic - Redefining User Experience with Large Language Mo...
DataScienceConferenc1
 
Design patterns
Design patternsDesign patterns
Design patterns
GeekNightHyderabad
 
Software engineering
Software engineeringSoftware engineering
Software engineering
Fahe Em
 
Software engineering
Software engineeringSoftware engineering
Software engineering
Fahe Em
 
CASE tools and their effects on software quality
CASE tools and their effects on software qualityCASE tools and their effects on software quality
CASE tools and their effects on software quality
Utkarsh Agarwal
 
So You Just Inherited a $Legacy Application...
So You Just Inherited a $Legacy Application...So You Just Inherited a $Legacy Application...
So You Just Inherited a $Legacy Application...
Joe Ferguson
 
Architecting for Change: An Agile Approach
Architecting for Change: An Agile ApproachArchitecting for Change: An Agile Approach
Architecting for Change: An Agile Approach
Ben Stopford
 
Patterns in Python
Patterns in PythonPatterns in Python
Patterns in Python
dn
 
Rejunevating software reengineering processes
Rejunevating software reengineering processesRejunevating software reengineering processes
Rejunevating software reengineering processes
manishthaper
 
Agile and Modeling / MDE : friends or foes? (Agile Tour Nantes 2010)
Agile and Modeling / MDE : friends or foes? (Agile Tour  Nantes 2010)Agile and Modeling / MDE : friends or foes? (Agile Tour  Nantes 2010)
Agile and Modeling / MDE : friends or foes? (Agile Tour Nantes 2010)
Jordi Cabot
 
ChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps ProductivityChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps Productivity
VictorSzoltysek
 
Lecture 1 uml with java implementation
Lecture 1 uml with java implementationLecture 1 uml with java implementation
Lecture 1 uml with java implementation
the_wumberlog
 
Software Modeling and Artificial Intelligence: friends or foes?
Software Modeling and Artificial Intelligence: friends or foes?Software Modeling and Artificial Intelligence: friends or foes?
Software Modeling and Artificial Intelligence: friends or foes?
Jordi Cabot
 
2015.01.09 - Writing Modern Applications for Mobile and Web
2015.01.09 - Writing Modern Applications for Mobile and Web2015.01.09 - Writing Modern Applications for Mobile and Web
2015.01.09 - Writing Modern Applications for Mobile and Web
Marco Parenzan
 
Certification Study Group - NLP & Recommendation Systems on GCP Session 5
Certification Study Group - NLP & Recommendation Systems on GCP Session 5Certification Study Group - NLP & Recommendation Systems on GCP Session 5
Certification Study Group - NLP & Recommendation Systems on GCP Session 5
gdgsurrey
 
How Azure helps to build better business processes and customer experiences w...
How Azure helps to build better business processes and customer experiences w...How Azure helps to build better business processes and customer experiences w...
How Azure helps to build better business processes and customer experiences w...
Maxim Salnikov
 
Aspect Oriented Software Development
Aspect Oriented Software DevelopmentAspect Oriented Software Development
Aspect Oriented Software Development
Jignesh Patel
 
[DSC Europe 23] Igor Ilic - Redefining User Experience with Large Language Mo...
[DSC Europe 23] Igor Ilic - Redefining User Experience with Large Language Mo...[DSC Europe 23] Igor Ilic - Redefining User Experience with Large Language Mo...
[DSC Europe 23] Igor Ilic - Redefining User Experience with Large Language Mo...
DataScienceConferenc1
 
Software engineering
Software engineeringSoftware engineering
Software engineering
Fahe Em
 
Software engineering
Software engineeringSoftware engineering
Software engineering
Fahe Em
 

Recently uploaded (20)

Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdfMicrosoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
TechSoup
 
Download Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With LatestDownload Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With Latest
tahirabibi60507
 
How to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud PerformanceHow to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud Performance
ThousandEyes
 
WinRAR Crack for Windows (100% Working 2025)
WinRAR Crack for Windows (100% Working 2025)WinRAR Crack for Windows (100% Working 2025)
WinRAR Crack for Windows (100% Working 2025)
sh607827
 
FL Studio Producer Edition Crack 2025 Full Version
FL Studio Producer Edition Crack 2025 Full VersionFL Studio Producer Edition Crack 2025 Full Version
FL Studio Producer Edition Crack 2025 Full Version
tahirabibi60507
 
Who Watches the Watchmen (SciFiDevCon 2025)
Who Watches the Watchmen (SciFiDevCon 2025)Who Watches the Watchmen (SciFiDevCon 2025)
Who Watches the Watchmen (SciFiDevCon 2025)
Allon Mureinik
 
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Eric D. Schabell
 
Adobe Lightroom Classic Crack FREE Latest link 2025
Adobe Lightroom Classic Crack FREE Latest link 2025Adobe Lightroom Classic Crack FREE Latest link 2025
Adobe Lightroom Classic Crack FREE Latest link 2025
kashifyounis067
 
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
AxisTechnolabs
 
Douwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License codeDouwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License code
aneelaramzan63
 
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
Egor Kaleynik
 
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
steaveroggers
 
Adobe Illustrator Crack FREE Download 2025 Latest Version
Adobe Illustrator Crack FREE Download 2025 Latest VersionAdobe Illustrator Crack FREE Download 2025 Latest Version
Adobe Illustrator Crack FREE Download 2025 Latest Version
kashifyounis067
 
Solidworks Crack 2025 latest new + license code
Solidworks Crack 2025 latest new + license codeSolidworks Crack 2025 latest new + license code
Solidworks Crack 2025 latest new + license code
aneelaramzan63
 
How can one start with crypto wallet development.pptx
How can one start with crypto wallet development.pptxHow can one start with crypto wallet development.pptx
How can one start with crypto wallet development.pptx
laravinson24
 
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Andre Hora
 
Not So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java WebinarNot So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java Webinar
Tier1 app
 
Why Orangescrum Is a Game Changer for Construction Companies in 2025
Why Orangescrum Is a Game Changer for Construction Companies in 2025Why Orangescrum Is a Game Changer for Construction Companies in 2025
Why Orangescrum Is a Game Changer for Construction Companies in 2025
Orangescrum
 
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage DashboardsAdobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
BradBedford3
 
Landscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature ReviewLandscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature Review
Hironori Washizaki
 
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdfMicrosoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
TechSoup
 
Download Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With LatestDownload Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With Latest
tahirabibi60507
 
How to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud PerformanceHow to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud Performance
ThousandEyes
 
WinRAR Crack for Windows (100% Working 2025)
WinRAR Crack for Windows (100% Working 2025)WinRAR Crack for Windows (100% Working 2025)
WinRAR Crack for Windows (100% Working 2025)
sh607827
 
FL Studio Producer Edition Crack 2025 Full Version
FL Studio Producer Edition Crack 2025 Full VersionFL Studio Producer Edition Crack 2025 Full Version
FL Studio Producer Edition Crack 2025 Full Version
tahirabibi60507
 
Who Watches the Watchmen (SciFiDevCon 2025)
Who Watches the Watchmen (SciFiDevCon 2025)Who Watches the Watchmen (SciFiDevCon 2025)
Who Watches the Watchmen (SciFiDevCon 2025)
Allon Mureinik
 
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Eric D. Schabell
 
Adobe Lightroom Classic Crack FREE Latest link 2025
Adobe Lightroom Classic Crack FREE Latest link 2025Adobe Lightroom Classic Crack FREE Latest link 2025
Adobe Lightroom Classic Crack FREE Latest link 2025
kashifyounis067
 
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
AxisTechnolabs
 
Douwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License codeDouwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License code
aneelaramzan63
 
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
Egor Kaleynik
 
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
steaveroggers
 
Adobe Illustrator Crack FREE Download 2025 Latest Version
Adobe Illustrator Crack FREE Download 2025 Latest VersionAdobe Illustrator Crack FREE Download 2025 Latest Version
Adobe Illustrator Crack FREE Download 2025 Latest Version
kashifyounis067
 
Solidworks Crack 2025 latest new + license code
Solidworks Crack 2025 latest new + license codeSolidworks Crack 2025 latest new + license code
Solidworks Crack 2025 latest new + license code
aneelaramzan63
 
How can one start with crypto wallet development.pptx
How can one start with crypto wallet development.pptxHow can one start with crypto wallet development.pptx
How can one start with crypto wallet development.pptx
laravinson24
 
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Andre Hora
 
Not So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java WebinarNot So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java Webinar
Tier1 app
 
Why Orangescrum Is a Game Changer for Construction Companies in 2025
Why Orangescrum Is a Game Changer for Construction Companies in 2025Why Orangescrum Is a Game Changer for Construction Companies in 2025
Why Orangescrum Is a Game Changer for Construction Companies in 2025
Orangescrum
 
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage DashboardsAdobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
BradBedford3
 
Landscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature ReviewLandscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature Review
Hironori Washizaki
 
Ad

Design Patterns and Form Processing

  • 1. cf.OBJECTIVE(ANZ) Design Patterns and Form Processing Jaime Metcher Software Architect, Centre for Innovation in Professional Learning, University of Queensland
  • 2. About me B.Sc (maths) Aerial survey software (in the 80's!) Kids LAN wrangler at UQ Coldfusioneer at Med-E-Serv Archi-thingie back at UQ B.Sc (maths) Aerial survey software (in the 80's!) Kids LAN wrangler at UQ Coldfusioneer at Med-E-Serv Archi-thingie back at UQ OUTPUT 2500AD ORG 2000H MOV DX,0FFE6H MOV AX,82H OUT DX,AL NEXT:MOV AX,3000H MOV BX,0000H CALL DISP NOT AL MOV 3001H,AL MOV BX,0100H CALL DISP JMP SHORT NEXT DISP:PUSH AX MOV CX,1 CALL FAR 0FF00:0B12H POP AX RET END
  • 3. About you Your team lead is bugging you You are the team lead and you want to bug your juniors:  What do you do that's so great?  How do you teach that? You want to pad your CV You know all about patterns and you're here to heckle You thought this was the Railo talk
  • 4. Outline Design Patterns by Example  Template method  Composite Design Patterns World Tour  Architecture  Software engineering  Education Conclusion  Motherhood statements  Resources  Questions
  • 5. Example – form processing Simple See code sample - simple
  • 6. Example – form processing Let's componentize a bit... See code sample - simple.cfc
  • 7. Example – form processing Add some functionality:  Support multiple forms on a page  Detect incomplete form transmission See code sample - bettercfc
  • 8. Example – form processing Now refactor out some common functionality: See code sample - bettercfcrefactored
  • 9. Example – form processing A little less procedural, just for fun: See code sample - templatemethod
  • 10. Template method if (isSubmitted() and validated()) { commit(); } Other ways to do this? Define the skeleton of an algorithm in an operation, deferring some steps to subclasses. Template Method lets subclasses redefine certain steps of an algorithm without changing the algorithm's structure. - Design Patterns: Gamma et al. (aka GoF)
  • 11. Example – form processing OK, let's separate some concerns: See code sample - templatemethodrefactored
  • 12. Example – form processing More guts, more glory See code sample – composite
  • 13. Composite Compose objects into tree structures to represent part-whole hierarchies. Composite lets clients treat individual objects and compositions of objects uniformly - Design Patterns: Gamma et al. (aka GoF) myCompositeFormGuts = CreateObject("component", "compositeFormGuts").init("puttin_it_togetha"); myCompositeFormGuts.addChild(myFormGuts1); myCompositeFormGuts.addChild(myFormGuts2);
  • 15. And why should I care? Prevent 'defactoring' “Hey, I noticed there was this totally unnecessary inheritance lying around so I refactored it out” Communication “Why do we have this one crazy class that has the same interface as all the others but is completely different under the hood?” Education
  • 16. World tour - architecture Alexander's “A Pattern Language” - read it! Light on two sides: When they have a choice, people will always gravitate to those rooms which have light on two sides, and leave the rooms which are lit only from one side unused and empty. Therefore: Locate each room so that it has outdoor space outside it on at least two sides, and then place windows in these outdoor walls so that natural light falls into every room from more than one direction.
  • 17. World Tour – Software Engineering GoF – Design Patterns Singleton Iterator Decorator Martin Fowler – PoEAA Front Controller Gateway Single Table Inheritance Gregor Hohpe – Enterprise Integration Patterns Message Endpoint Publish-Subscribe Channel Guaranteed Delivery
  • 18. World tour - education CIPL (my lot) Chunking & toggling Peer leader Hypothetical professionals E-LEN project Coherence principle Provide personal identity information
  • 19. Motherhood statements Patterns are primarily about communication Patterns are not templates or rules Pattern use is all about professional judgement A pattern by definition is not new
  • 20. Resources Books A Pattern Language: Towns, Buildings, Construction Christopher Alexander, Sara Ishikawa, Murry Silverstein ISBN 978-0195019193 Design Patterns: Elements of Reusable Object-Oriented Software Erich Gamma, Richard Helm, Ralph Johnson, John M. Vlissides ISBN 978-0201633610 Enterprise Integration Patterns: Designing, Building, and Deploying Messaging Solutions Gregor Hohpe & Bobby Woolf ISBN 978-0321200686 Patterns of Enterprise Application Architecture Martin Fowler ISBN 978-0321127426 Applying UML and Patterns: An Introduction to Object-Oriented Analysis and Design and Iterative Development Craig Larman ISBN 978-013148906 Websites E-LEN http://www2.tisip.no/E-LEN/patterns_info.php Some patterns in the education field CIPL http://www.uq.edu.au/cipl No patterns here yet :( http://www.daimi.au.dk/~apaipi/workshop/nyartikel.pdf Article by Aino Corry on patterns vs language constructs. See also her talk on patterns in functional languages on InfoQ.