SlideShare a Scribd company logo
1 of 53
Download to read offline
Visitor
                  Steve Hayes
                Cogent Consulting




 Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au)
Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
The Problem



 Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au)
Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au)
Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
Show me everything in a consistent manner...




             Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au)
            Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
Show me everything in a consistent manner...

      ... and send it to my friend via email




             Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au)
            Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
Show me everything in a consistent manner...

      ... and send it to my friend via email

   oh, and send it to her phone as well...




             Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au)
            Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
Show me everything in a consistent manner...

      ... and send it to my friend via email

   oh, and send it to her phone as well...

                                                                 and print it.....




             Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au)
            Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au)
Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
Some analysis music please...




              Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au)
             Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au)
Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
Commonality is in the eye of the beholder




         Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au)
        Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au)
Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
With a little casual application of
        polymorphism...




     Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au)
    Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au)
Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
Does this look bad to you?




             Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au)
            Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
The solution



 Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au)
Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
Visitors



    Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au)
   Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
“Represent an operation to be performed
 on the elements of an object structure.
 Visitor lets you define a new operation
   without changing the classes of the
     elements on which it operates”

                                 -- GOF


         Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au)
        Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au)
Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
A solution to a problem in a context




      Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au)
     Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au)
Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
Headings, Details, ...




 Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au)
Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
and the Iterator




 Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au)
Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au)
Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
Let’s show it in code!




 Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au)
Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au)
Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au)
Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au)
Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au)
Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au)
Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
Time for visitors...




          Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au)
         Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au)
Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au)
Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au)
Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
Melbourne Pushes Boundaries

The Wolves in the Wall

Redhill Consulting Pty Ltd - Ruby on Rails Plugins

Let's talk about tests, baby...




            Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au)
           Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au)
Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
Melbourne Pushes Boundaries
Tim Colebatch
Melbourne is experiencing its biggest growth surge
since the 1960's

The Wolves in the Wall
12.06

Redhill Consulting Pty Ltd - Ruby on Rails Plugins
Here are some Ruby on Rails plugins we've developed...

Let's talk about tests, baby...
Some long babbling about test naming heuristics
           Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au)
          Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
Cool!



   Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au)
  Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
When?



 Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au)
Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
“an object structure contains many classes
  of objects with differing interfaces, and
you want to perform operations on these
  objects that depend on their concrete
                  classes”



          Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au)
         Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au)
Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
“many distinct and unrelated operations
  need to be performed on objects in an
 object structure, and you want to avoid
    ‘polluting’ their classes with these
operations.Visitor lets you keep unrelated
 operations together by defining them in
  one class. When the object structure is
shared by many applications, use Visitor to
 put operations in just those applications
              that need them”
         Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au)
        Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
Show me everything in a consistent manner...

      ... and send it to my friend via email

   oh, and send it to her phone as well...

                                                                 and print it.....




             Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au)
            Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
“the classes defining the object structure
    rarely change, but you often want to
define new operations over the structure.
   Changing the object structure classes
   requires redefining the interface to all
  visitors, which is potentially costly. If the
object structure classes change often, then
       it’s probably better to define the
           operations in those classes”

          Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au)
         Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au)
Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
Consequences



 Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au)
Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
Visitor makes adding new operations easy




         Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au)
        Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
A visitor gathers related operations and
        separates unrelated ones




        Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au)
       Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
Adding new ConcreteElement classes is
               hard




       Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au)
      Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
Visitors can cross object hierarchies




      Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au)
     Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
Visitors can accumulate state




   Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au)
  Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
Visitors may compromise encapsulation




       Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au)
      Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
Discussion



 Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au)
Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.

More Related Content

More from melbournepatterns (20)

Code Contracts API In .Net
Code Contracts API In .NetCode Contracts API In .Net
Code Contracts API In .Net
 
LINQ/PLINQ
LINQ/PLINQLINQ/PLINQ
LINQ/PLINQ
 
Gpu Cuda
Gpu CudaGpu Cuda
Gpu Cuda
 
Facade Pattern
Facade PatternFacade Pattern
Facade Pattern
 
Phani Kumar - Decorator Pattern
Phani Kumar - Decorator PatternPhani Kumar - Decorator Pattern
Phani Kumar - Decorator Pattern
 
Composite Pattern
Composite PatternComposite Pattern
Composite Pattern
 
Adapter Design Pattern
Adapter Design PatternAdapter Design Pattern
Adapter Design Pattern
 
Prototype Design Pattern
Prototype Design PatternPrototype Design Pattern
Prototype Design Pattern
 
Factory Method Design Pattern
Factory Method Design PatternFactory Method Design Pattern
Factory Method Design Pattern
 
Abstract Factory Design Pattern
Abstract Factory Design PatternAbstract Factory Design Pattern
Abstract Factory Design Pattern
 
A Little Lisp
A Little LispA Little Lisp
A Little Lisp
 
State Pattern in Flex
State Pattern in FlexState Pattern in Flex
State Pattern in Flex
 
Active Object
Active ObjectActive Object
Active Object
 
Extract Composite Talk Andy
Extract Composite Talk AndyExtract Composite Talk Andy
Extract Composite Talk Andy
 
Selenium Interpreter
Selenium InterpreterSelenium Interpreter
Selenium Interpreter
 
Move Accumulation To Collecting Parameter
Move Accumulation To Collecting ParameterMove Accumulation To Collecting Parameter
Move Accumulation To Collecting Parameter
 
Mpg Dec07 Gian Lorenzetto
Mpg Dec07 Gian Lorenzetto Mpg Dec07 Gian Lorenzetto
Mpg Dec07 Gian Lorenzetto
 
Mpg Feb08 Gian Lorenzetto
Mpg Feb08 Gian Lorenzetto Mpg Feb08 Gian Lorenzetto
Mpg Feb08 Gian Lorenzetto
 
Dynamic Vs Static
Dynamic Vs StaticDynamic Vs Static
Dynamic Vs Static
 
Command Pattern Geoff Burns 2006 Nov
Command Pattern Geoff Burns 2006 NovCommand Pattern Geoff Burns 2006 Nov
Command Pattern Geoff Burns 2006 Nov
 

Recently uploaded

The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Kaya Weers
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observabilityitnewsafrica
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkPixlogix Infotech
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxfnnc6jmgwh
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 

Recently uploaded (20)

The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App Framework
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 

Visitor Pattern By Steve Hayes

  • 1. Visitor Steve Hayes Cogent Consulting Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au) Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
  • 2. The Problem Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au) Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
  • 3. Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au) Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
  • 4. Show me everything in a consistent manner... Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au) Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
  • 5. Show me everything in a consistent manner... ... and send it to my friend via email Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au) Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
  • 6. Show me everything in a consistent manner... ... and send it to my friend via email oh, and send it to her phone as well... Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au) Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
  • 7. Show me everything in a consistent manner... ... and send it to my friend via email oh, and send it to her phone as well... and print it..... Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au) Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
  • 8. Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au) Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
  • 9. Some analysis music please... Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au) Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
  • 10. Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au) Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
  • 11. Commonality is in the eye of the beholder Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au) Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
  • 12. Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au) Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
  • 13. With a little casual application of polymorphism... Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au) Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
  • 14. Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au) Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
  • 15. Does this look bad to you? Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au) Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
  • 16. The solution Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au) Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
  • 17. Visitors Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au) Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
  • 18. “Represent an operation to be performed on the elements of an object structure. Visitor lets you define a new operation without changing the classes of the elements on which it operates” -- GOF Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au) Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
  • 19. Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au) Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
  • 20. A solution to a problem in a context Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au) Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
  • 21. Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au) Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
  • 22. Headings, Details, ... Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au) Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
  • 23. and the Iterator Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au) Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
  • 24. Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au) Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
  • 25. Let’s show it in code! Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au) Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
  • 26. Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au) Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
  • 27. Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au) Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
  • 28. Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au) Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
  • 29. Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au) Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
  • 30. Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au) Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
  • 31. Time for visitors... Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au) Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
  • 32. Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au) Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
  • 33. Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au) Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
  • 34. Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au) Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
  • 35. Melbourne Pushes Boundaries The Wolves in the Wall Redhill Consulting Pty Ltd - Ruby on Rails Plugins Let's talk about tests, baby... Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au) Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
  • 36. Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au) Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
  • 37. Melbourne Pushes Boundaries Tim Colebatch Melbourne is experiencing its biggest growth surge since the 1960's The Wolves in the Wall 12.06 Redhill Consulting Pty Ltd - Ruby on Rails Plugins Here are some Ruby on Rails plugins we've developed... Let's talk about tests, baby... Some long babbling about test naming heuristics Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au) Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
  • 38. Cool! Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au) Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
  • 39. When? Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au) Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
  • 40. “an object structure contains many classes of objects with differing interfaces, and you want to perform operations on these objects that depend on their concrete classes” Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au) Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
  • 41. Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au) Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
  • 42. “many distinct and unrelated operations need to be performed on objects in an object structure, and you want to avoid ‘polluting’ their classes with these operations.Visitor lets you keep unrelated operations together by defining them in one class. When the object structure is shared by many applications, use Visitor to put operations in just those applications that need them” Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au) Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
  • 43. Show me everything in a consistent manner... ... and send it to my friend via email oh, and send it to her phone as well... and print it..... Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au) Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
  • 44. “the classes defining the object structure rarely change, but you often want to define new operations over the structure. Changing the object structure classes requires redefining the interface to all visitors, which is potentially costly. If the object structure classes change often, then it’s probably better to define the operations in those classes” Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au) Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
  • 45. Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au) Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
  • 46. Consequences Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au) Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
  • 47. Visitor makes adding new operations easy Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au) Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
  • 48. A visitor gathers related operations and separates unrelated ones Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au) Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
  • 49. Adding new ConcreteElement classes is hard Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au) Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
  • 50. Visitors can cross object hierarchies Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au) Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
  • 51. Visitors can accumulate state Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au) Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
  • 52. Visitors may compromise encapsulation Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au) Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.
  • 53. Discussion Copyright Cogent Consulting Pty Ltd (http://www.cogentconsulting.com.au) Licensed under a Creative Commons Attribution-Noncommercial 3.0 License.