SlideShare una empresa de Scribd logo
1 de 17
Descargar para leer sin conexión
Agile Saturday VI




        Choose a pattern
         for a problem!


Anton Keks
anton@codeborne.com
The Increasing Complexity

Complexity of software systems
                                    Time

New programming paradigms
Higher level of abstraction
HW Assembler Structural   (objects+functions?)
  CPUs  Procedural    <OOP>                ...
What are design patterns?
●
    Anywhere in the world you can find recurring
    patterns
●   Design patterns
    –   are building blocks of a system's
        architecture
    –   are recurring solutions to design problems
        that you see over
    –   identify and specify abstractions that are
        above the level of single classes and
        instances
Pattern classification
The GOF book defines 3 major types of patterns:
–   Creational patterns – substitute the new keyword. This
    gives your program more flexibility in deciding which
    objects need to be created for a given case
–   Structural patterns - compose groups of objects into
    larger structures, such as complex user interfaces or
    accounting data
–   Behavioral patterns - define the communication
    between objects and how the flow is controlled in a
    complex program.
Decorator
Adapter
 Composite      Strategy
                 State
                   Observer
     Factory
                Iterator
  Builder
    Prototype
Software Design: The Good
●
    Loose coupling
●
    Immutability
●
    Encapsulation
●   Short code blocks
●   Appropriate typing
●
    Duplication avoidance
●   Simplicity
●
    Consistent terminology
●   Clear naming
Bad, bad, bad!
●
    Loose coupling                       Tight coupling
●
    Immutability                Mutable data structures
●
    Encapsulation                          Tramp data
●   Short code blocks        Monster functions/methods
●   Appropriate typing           String/Integer overuse
●
    Duplication avoidance                   Copy-Paste
●   Simplicity                        Over-engineering
●
    Consistent terminology            Mixture of terms
●   Clear naming                     Runtime surprises
Let's get to business!
●   Next slides describe problems
       – What is given
          (existing code)
       – What we want to achieve
          (using a pattern)

●
    As usual, the code is on github:
       http://github.com/angryziber/patterns
Problem 1: Pizza
●
    We have:
    –   A pizzeria
    –   Multitude of options for pizzas: name, toppings,
        thickness, size, delivery address, etc
●   We want:
    –   Allow users to “order” custom pizzas
    –   Disallow changing the order once the pizza is
        already in the oven
    –   Keep the ordering code readable
Problem 2: Unzipper
●
    We have:
    –   unzip() method
    –   It is able to decompress a single compressed
        stream
●   We need:
    –   Support multiple-volume archives
    –   Compressed data is split into multiple floppies
Problem 3: Maps
●
    We have:
    –   Map data of entire Tallinn with all the streets,
        buildings, etc
    –   The MapVisualizer class that can draw the full map
        on the screen
●
    We want:
    –   User to see only a section of the map at any given
        time
    –   User to be able to move around the map
Problem 4: CD Player
●
    We have:
    –   A CD player with buttons play, stop, next, eject
●
    We want:
    –   Play to switch the player on
    –   Play again to pause playback, again to resume
    –   Stop to turn off the player
    –   Eject to open the disk tray (if no disk – no playback
        possible)
    –   etc, etc, etc
Problem 5: Vending Machine
●
    We have:
    –   A vending machine that can sell any small enough
        items
●
    We want:
    –   To deploy several such machines selling bottles of
        pepsi, sushi boxes, and Hintai magazines
    –   Each machine to sell items of one type
Problem 6: Spreadsheet
●
    We have:
    –   A spreadsheet-type program
    –   Containing a table for entering data and formulas
●   We want:
    –   The program to support charts
    –   The charts to be updated automatically if user
        changes the data in the table
    –   To sell the chart add-on separately for only $99.99
Problem 7: Battlefield
●
    We have:
    –   A tank
    –   Several types of bullets
    –   Lots of enemies around, e.g. airplanes, other
        tanks, guys with Molotov-coctails
●
    We want:
    –   To survive
    –   To kill 'em all
Problem 8: TCP over DNS
●
    We have:
    –    A paid Wi-Fi network (e.g. in an airport)
    –    Lots of spare time, but no credit card
●   We want:
    –    To be able to read emails and surf Facebook
    –    (Most likely, during our next trip)
●   Background info:
     –   Paid Wi-Fi usually resolves DNS just fine
     –   DNS packets can contain any payload
Thank you!




Codeborne is the only true extreme
programming company in the region.

Come and join us for an experience of
a lifetime you can't find elsewhere!

                job@codeborne.com

Más contenido relacionado

La actualidad más candente

Top Tips Every Notes Developer Needs To Know
Top Tips Every Notes Developer Needs To KnowTop Tips Every Notes Developer Needs To Know
Top Tips Every Notes Developer Needs To KnowKathy Brown
 
Detangling Your JavaScript
Detangling Your JavaScriptDetangling Your JavaScript
Detangling Your JavaScriptChris Powers
 
J9: Under the hood of the next open source JVM
J9: Under the hood of the next open source JVMJ9: Under the hood of the next open source JVM
J9: Under the hood of the next open source JVMDanHeidinga
 
XPDays Ukraine: Legacy
XPDays Ukraine: LegacyXPDays Ukraine: Legacy
XPDays Ukraine: LegacyVictor_Cr
 
It's all about behaviour, also in php - phpspec
It's all about behaviour, also in php - phpspecIt's all about behaviour, also in php - phpspec
It's all about behaviour, also in php - phpspecGiulio De Donato
 
Refactoring Legacy Code
Refactoring Legacy CodeRefactoring Legacy Code
Refactoring Legacy CodeAdam Culp
 
Test Driven Development Powered by LEGO
Test Driven Development Powered by LEGOTest Driven Development Powered by LEGO
Test Driven Development Powered by LEGOAgile Montréal
 
Javascript Tests with Jasmine for Front-end Devs
Javascript Tests with Jasmine for Front-end DevsJavascript Tests with Jasmine for Front-end Devs
Javascript Tests with Jasmine for Front-end DevsChris Powers
 
invokedynamic: Evolution of a Language Feature
invokedynamic: Evolution of a Language Featureinvokedynamic: Evolution of a Language Feature
invokedynamic: Evolution of a Language FeatureDanHeidinga
 
Oh the compilers you'll build
Oh the compilers you'll buildOh the compilers you'll build
Oh the compilers you'll buildMark Stoodley
 
How we tested our code "Google way"
How we tested our code "Google way"How we tested our code "Google way"
How we tested our code "Google way"Oleksiy Rezchykov
 
FOSDEM 2017 - Open J9 The Next Free Java VM
FOSDEM 2017 - Open J9 The Next Free Java VMFOSDEM 2017 - Open J9 The Next Free Java VM
FOSDEM 2017 - Open J9 The Next Free Java VMCharlie Gracie
 

La actualidad más candente (13)

Top Tips Every Notes Developer Needs To Know
Top Tips Every Notes Developer Needs To KnowTop Tips Every Notes Developer Needs To Know
Top Tips Every Notes Developer Needs To Know
 
Making Strongly-typed NETCONF Usable
Making Strongly-typed NETCONF UsableMaking Strongly-typed NETCONF Usable
Making Strongly-typed NETCONF Usable
 
Detangling Your JavaScript
Detangling Your JavaScriptDetangling Your JavaScript
Detangling Your JavaScript
 
J9: Under the hood of the next open source JVM
J9: Under the hood of the next open source JVMJ9: Under the hood of the next open source JVM
J9: Under the hood of the next open source JVM
 
XPDays Ukraine: Legacy
XPDays Ukraine: LegacyXPDays Ukraine: Legacy
XPDays Ukraine: Legacy
 
It's all about behaviour, also in php - phpspec
It's all about behaviour, also in php - phpspecIt's all about behaviour, also in php - phpspec
It's all about behaviour, also in php - phpspec
 
Refactoring Legacy Code
Refactoring Legacy CodeRefactoring Legacy Code
Refactoring Legacy Code
 
Test Driven Development Powered by LEGO
Test Driven Development Powered by LEGOTest Driven Development Powered by LEGO
Test Driven Development Powered by LEGO
 
Javascript Tests with Jasmine for Front-end Devs
Javascript Tests with Jasmine for Front-end DevsJavascript Tests with Jasmine for Front-end Devs
Javascript Tests with Jasmine for Front-end Devs
 
invokedynamic: Evolution of a Language Feature
invokedynamic: Evolution of a Language Featureinvokedynamic: Evolution of a Language Feature
invokedynamic: Evolution of a Language Feature
 
Oh the compilers you'll build
Oh the compilers you'll buildOh the compilers you'll build
Oh the compilers you'll build
 
How we tested our code "Google way"
How we tested our code "Google way"How we tested our code "Google way"
How we tested our code "Google way"
 
FOSDEM 2017 - Open J9 The Next Free Java VM
FOSDEM 2017 - Open J9 The Next Free Java VMFOSDEM 2017 - Open J9 The Next Free Java VM
FOSDEM 2017 - Open J9 The Next Free Java VM
 

Similar a Choose a pattern for a problem

Making A Game Engine Is Easier Than You Think
Making A Game Engine Is Easier Than You ThinkMaking A Game Engine Is Easier Than You Think
Making A Game Engine Is Easier Than You ThinkGorm Lai
 
DevOps Days Vancouver 2014 Slides
DevOps Days Vancouver 2014 SlidesDevOps Days Vancouver 2014 Slides
DevOps Days Vancouver 2014 SlidesAlex Cruise
 
Software Engineering Advice from Google's Jeff Dean for Big, Distributed Systems
Software Engineering Advice from Google's Jeff Dean for Big, Distributed SystemsSoftware Engineering Advice from Google's Jeff Dean for Big, Distributed Systems
Software Engineering Advice from Google's Jeff Dean for Big, Distributed Systemsadrianionel
 
Reading Notes : the practice of programming
Reading Notes : the practice of programmingReading Notes : the practice of programming
Reading Notes : the practice of programmingJuggernaut Liu
 
Preventing Complexity in Game Programming
Preventing Complexity in Game ProgrammingPreventing Complexity in Game Programming
Preventing Complexity in Game ProgrammingYaser Zhian
 
Creating great Unity games for Windows 10 - Part 2
Creating great Unity games for Windows 10 - Part 2Creating great Unity games for Windows 10 - Part 2
Creating great Unity games for Windows 10 - Part 2Jiri Danihelka
 
Facets Of Fragmentation by Mark Murphy
Facets Of Fragmentation by Mark MurphyFacets Of Fragmentation by Mark Murphy
Facets Of Fragmentation by Mark MurphySkills Matter
 
Microservices, the lean way - Bruno Bossola - Codemotion Amsterdam 2016
Microservices, the lean way - Bruno Bossola - Codemotion Amsterdam 2016Microservices, the lean way - Bruno Bossola - Codemotion Amsterdam 2016
Microservices, the lean way - Bruno Bossola - Codemotion Amsterdam 2016Codemotion
 
Microservices, the lean way
Microservices, the lean wayMicroservices, the lean way
Microservices, the lean wayBruno Bossola
 
Infrastructure as code might be literally impossible part 2
Infrastructure as code might be literally impossible part 2Infrastructure as code might be literally impossible part 2
Infrastructure as code might be literally impossible part 2ice799
 
EuroMPI 2013 presentation: McMPI
EuroMPI 2013 presentation: McMPIEuroMPI 2013 presentation: McMPI
EuroMPI 2013 presentation: McMPIDan Holmes
 
Cerebro general overiew eng
Cerebro general overiew engCerebro general overiew eng
Cerebro general overiew engCineSoft
 
Management Information System 8/E | Chapter 8 |
Management Information System 8/E | Chapter 8 | Management Information System 8/E | Chapter 8 |
Management Information System 8/E | Chapter 8 | sarahyago17
 
Full stack development
Full stack developmentFull stack development
Full stack developmentArnav Gupta
 

Similar a Choose a pattern for a problem (20)

Making A Game Engine Is Easier Than You Think
Making A Game Engine Is Easier Than You ThinkMaking A Game Engine Is Easier Than You Think
Making A Game Engine Is Easier Than You Think
 
DevOps Days Vancouver 2014 Slides
DevOps Days Vancouver 2014 SlidesDevOps Days Vancouver 2014 Slides
DevOps Days Vancouver 2014 Slides
 
Software Engineering Advice from Google's Jeff Dean for Big, Distributed Systems
Software Engineering Advice from Google's Jeff Dean for Big, Distributed SystemsSoftware Engineering Advice from Google's Jeff Dean for Big, Distributed Systems
Software Engineering Advice from Google's Jeff Dean for Big, Distributed Systems
 
Linux para iniciantes
Linux para iniciantesLinux para iniciantes
Linux para iniciantes
 
Reading Notes : the practice of programming
Reading Notes : the practice of programmingReading Notes : the practice of programming
Reading Notes : the practice of programming
 
Cloud accounting software uk
Cloud accounting software ukCloud accounting software uk
Cloud accounting software uk
 
Preventing Complexity in Game Programming
Preventing Complexity in Game ProgrammingPreventing Complexity in Game Programming
Preventing Complexity in Game Programming
 
Introduction to multicore .ppt
Introduction to multicore .pptIntroduction to multicore .ppt
Introduction to multicore .ppt
 
Creating great Unity games for Windows 10 - Part 2
Creating great Unity games for Windows 10 - Part 2Creating great Unity games for Windows 10 - Part 2
Creating great Unity games for Windows 10 - Part 2
 
Facets Of Fragmentation by Mark Murphy
Facets Of Fragmentation by Mark MurphyFacets Of Fragmentation by Mark Murphy
Facets Of Fragmentation by Mark Murphy
 
Basics of C
Basics of CBasics of C
Basics of C
 
Memory models
Memory modelsMemory models
Memory models
 
Microservices, the lean way - Bruno Bossola - Codemotion Amsterdam 2016
Microservices, the lean way - Bruno Bossola - Codemotion Amsterdam 2016Microservices, the lean way - Bruno Bossola - Codemotion Amsterdam 2016
Microservices, the lean way - Bruno Bossola - Codemotion Amsterdam 2016
 
Microservices, the lean way
Microservices, the lean wayMicroservices, the lean way
Microservices, the lean way
 
Infrastructure as code might be literally impossible part 2
Infrastructure as code might be literally impossible part 2Infrastructure as code might be literally impossible part 2
Infrastructure as code might be literally impossible part 2
 
EuroMPI 2013 presentation: McMPI
EuroMPI 2013 presentation: McMPIEuroMPI 2013 presentation: McMPI
EuroMPI 2013 presentation: McMPI
 
Cerebro general overiew eng
Cerebro general overiew engCerebro general overiew eng
Cerebro general overiew eng
 
Uc13.chapter.05
Uc13.chapter.05Uc13.chapter.05
Uc13.chapter.05
 
Management Information System 8/E | Chapter 8 |
Management Information System 8/E | Chapter 8 | Management Information System 8/E | Chapter 8 |
Management Information System 8/E | Chapter 8 |
 
Full stack development
Full stack developmentFull stack development
Full stack development
 

Más de Anton Keks

Java Course 14: Beans, Applets, GUI
Java Course 14: Beans, Applets, GUIJava Course 14: Beans, Applets, GUI
Java Course 14: Beans, Applets, GUIAnton Keks
 
Java Course 13: JDBC & Logging
Java Course 13: JDBC & LoggingJava Course 13: JDBC & Logging
Java Course 13: JDBC & LoggingAnton Keks
 
Java Course 12: XML & XSL, Web & Servlets
Java Course 12: XML & XSL, Web & ServletsJava Course 12: XML & XSL, Web & Servlets
Java Course 12: XML & XSL, Web & ServletsAnton Keks
 
Java Course 11: Design Patterns
Java Course 11: Design PatternsJava Course 11: Design Patterns
Java Course 11: Design PatternsAnton Keks
 
Java Course 10: Threads and Concurrency
Java Course 10: Threads and ConcurrencyJava Course 10: Threads and Concurrency
Java Course 10: Threads and ConcurrencyAnton Keks
 
Java Course 9: Networking and Reflection
Java Course 9: Networking and ReflectionJava Course 9: Networking and Reflection
Java Course 9: Networking and ReflectionAnton Keks
 
Java Course 8: I/O, Files and Streams
Java Course 8: I/O, Files and StreamsJava Course 8: I/O, Files and Streams
Java Course 8: I/O, Files and StreamsAnton Keks
 
Java Course 7: Text processing, Charsets & Encodings
Java Course 7: Text processing, Charsets & EncodingsJava Course 7: Text processing, Charsets & Encodings
Java Course 7: Text processing, Charsets & EncodingsAnton Keks
 
Java Course 6: Introduction to Agile
Java Course 6: Introduction to AgileJava Course 6: Introduction to Agile
Java Course 6: Introduction to AgileAnton Keks
 
Java Course 5: Enums, Generics, Assertions
Java Course 5: Enums, Generics, AssertionsJava Course 5: Enums, Generics, Assertions
Java Course 5: Enums, Generics, AssertionsAnton Keks
 
Java Course 4: Exceptions & Collections
Java Course 4: Exceptions & CollectionsJava Course 4: Exceptions & Collections
Java Course 4: Exceptions & CollectionsAnton Keks
 
Java Course 3: OOP
Java Course 3: OOPJava Course 3: OOP
Java Course 3: OOPAnton Keks
 
Java Course 2: Basics
Java Course 2: BasicsJava Course 2: Basics
Java Course 2: BasicsAnton Keks
 
Java Course 1: Introduction
Java Course 1: IntroductionJava Course 1: Introduction
Java Course 1: IntroductionAnton Keks
 
Java Course 15: Ant, Scripting, Spring, Hibernate
Java Course 15: Ant, Scripting, Spring, HibernateJava Course 15: Ant, Scripting, Spring, Hibernate
Java Course 15: Ant, Scripting, Spring, HibernateAnton Keks
 
Being a Professional Software Developer
Being a Professional Software DeveloperBeing a Professional Software Developer
Being a Professional Software DeveloperAnton Keks
 

Más de Anton Keks (16)

Java Course 14: Beans, Applets, GUI
Java Course 14: Beans, Applets, GUIJava Course 14: Beans, Applets, GUI
Java Course 14: Beans, Applets, GUI
 
Java Course 13: JDBC & Logging
Java Course 13: JDBC & LoggingJava Course 13: JDBC & Logging
Java Course 13: JDBC & Logging
 
Java Course 12: XML & XSL, Web & Servlets
Java Course 12: XML & XSL, Web & ServletsJava Course 12: XML & XSL, Web & Servlets
Java Course 12: XML & XSL, Web & Servlets
 
Java Course 11: Design Patterns
Java Course 11: Design PatternsJava Course 11: Design Patterns
Java Course 11: Design Patterns
 
Java Course 10: Threads and Concurrency
Java Course 10: Threads and ConcurrencyJava Course 10: Threads and Concurrency
Java Course 10: Threads and Concurrency
 
Java Course 9: Networking and Reflection
Java Course 9: Networking and ReflectionJava Course 9: Networking and Reflection
Java Course 9: Networking and Reflection
 
Java Course 8: I/O, Files and Streams
Java Course 8: I/O, Files and StreamsJava Course 8: I/O, Files and Streams
Java Course 8: I/O, Files and Streams
 
Java Course 7: Text processing, Charsets & Encodings
Java Course 7: Text processing, Charsets & EncodingsJava Course 7: Text processing, Charsets & Encodings
Java Course 7: Text processing, Charsets & Encodings
 
Java Course 6: Introduction to Agile
Java Course 6: Introduction to AgileJava Course 6: Introduction to Agile
Java Course 6: Introduction to Agile
 
Java Course 5: Enums, Generics, Assertions
Java Course 5: Enums, Generics, AssertionsJava Course 5: Enums, Generics, Assertions
Java Course 5: Enums, Generics, Assertions
 
Java Course 4: Exceptions & Collections
Java Course 4: Exceptions & CollectionsJava Course 4: Exceptions & Collections
Java Course 4: Exceptions & Collections
 
Java Course 3: OOP
Java Course 3: OOPJava Course 3: OOP
Java Course 3: OOP
 
Java Course 2: Basics
Java Course 2: BasicsJava Course 2: Basics
Java Course 2: Basics
 
Java Course 1: Introduction
Java Course 1: IntroductionJava Course 1: Introduction
Java Course 1: Introduction
 
Java Course 15: Ant, Scripting, Spring, Hibernate
Java Course 15: Ant, Scripting, Spring, HibernateJava Course 15: Ant, Scripting, Spring, Hibernate
Java Course 15: Ant, Scripting, Spring, Hibernate
 
Being a Professional Software Developer
Being a Professional Software DeveloperBeing a Professional Software Developer
Being a Professional Software Developer
 

Último

Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbuapidays
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Zilliz
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusZilliz
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 

Último (20)

Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 

Choose a pattern for a problem

  • 1. Agile Saturday VI Choose a pattern for a problem! Anton Keks anton@codeborne.com
  • 2. The Increasing Complexity Complexity of software systems Time New programming paradigms Higher level of abstraction HW Assembler Structural (objects+functions?) CPUs Procedural <OOP> ...
  • 3. What are design patterns? ● Anywhere in the world you can find recurring patterns ● Design patterns – are building blocks of a system's architecture – are recurring solutions to design problems that you see over – identify and specify abstractions that are above the level of single classes and instances
  • 4. Pattern classification The GOF book defines 3 major types of patterns: – Creational patterns – substitute the new keyword. This gives your program more flexibility in deciding which objects need to be created for a given case – Structural patterns - compose groups of objects into larger structures, such as complex user interfaces or accounting data – Behavioral patterns - define the communication between objects and how the flow is controlled in a complex program.
  • 5. Decorator Adapter Composite Strategy State Observer Factory Iterator Builder Prototype
  • 6. Software Design: The Good ● Loose coupling ● Immutability ● Encapsulation ● Short code blocks ● Appropriate typing ● Duplication avoidance ● Simplicity ● Consistent terminology ● Clear naming
  • 7. Bad, bad, bad! ● Loose coupling Tight coupling ● Immutability Mutable data structures ● Encapsulation Tramp data ● Short code blocks Monster functions/methods ● Appropriate typing String/Integer overuse ● Duplication avoidance Copy-Paste ● Simplicity Over-engineering ● Consistent terminology Mixture of terms ● Clear naming Runtime surprises
  • 8. Let's get to business! ● Next slides describe problems – What is given (existing code) – What we want to achieve (using a pattern) ● As usual, the code is on github: http://github.com/angryziber/patterns
  • 9. Problem 1: Pizza ● We have: – A pizzeria – Multitude of options for pizzas: name, toppings, thickness, size, delivery address, etc ● We want: – Allow users to “order” custom pizzas – Disallow changing the order once the pizza is already in the oven – Keep the ordering code readable
  • 10. Problem 2: Unzipper ● We have: – unzip() method – It is able to decompress a single compressed stream ● We need: – Support multiple-volume archives – Compressed data is split into multiple floppies
  • 11. Problem 3: Maps ● We have: – Map data of entire Tallinn with all the streets, buildings, etc – The MapVisualizer class that can draw the full map on the screen ● We want: – User to see only a section of the map at any given time – User to be able to move around the map
  • 12. Problem 4: CD Player ● We have: – A CD player with buttons play, stop, next, eject ● We want: – Play to switch the player on – Play again to pause playback, again to resume – Stop to turn off the player – Eject to open the disk tray (if no disk – no playback possible) – etc, etc, etc
  • 13. Problem 5: Vending Machine ● We have: – A vending machine that can sell any small enough items ● We want: – To deploy several such machines selling bottles of pepsi, sushi boxes, and Hintai magazines – Each machine to sell items of one type
  • 14. Problem 6: Spreadsheet ● We have: – A spreadsheet-type program – Containing a table for entering data and formulas ● We want: – The program to support charts – The charts to be updated automatically if user changes the data in the table – To sell the chart add-on separately for only $99.99
  • 15. Problem 7: Battlefield ● We have: – A tank – Several types of bullets – Lots of enemies around, e.g. airplanes, other tanks, guys with Molotov-coctails ● We want: – To survive – To kill 'em all
  • 16. Problem 8: TCP over DNS ● We have: – A paid Wi-Fi network (e.g. in an airport) – Lots of spare time, but no credit card ● We want: – To be able to read emails and surf Facebook – (Most likely, during our next trip) ● Background info: – Paid Wi-Fi usually resolves DNS just fine – DNS packets can contain any payload
  • 17. Thank you! Codeborne is the only true extreme programming company in the region. Come and join us for an experience of a lifetime you can't find elsewhere! job@codeborne.com