SlideShare une entreprise Scribd logo
1  sur  18
Télécharger pour lire hors ligne
How Object-Oriented Are You
      Feeling Today?



      Software Craftsmanship 2011
        26th May, Bletchley Park

            Krzysztof Jelski
Krzysztof Jelski

 PRAGMATISTS,PL
Agenda
INTRO




                 WRAP-UP
The Nine Rules
1. Use One level of indentation per method
2. Don't use the else keyword
3. Wrap all primitives and strings
4. Use only one dot per line
5. Don't abbreviate (one­ or two­words names)
6. Keep all entities small (50 lines/class, 10 classes/package)
7. Don't use any classes with more than two instance variables
8. Use first class collections
9. Don't use any getters, setters or properties
Bank Accounts Kata
   Think of your personal bank account experience
   When in doubt, go for the simplest solution
Features
   Deposit, Withdrawal
   Transfer
   Account Statement (date, amount, balance)
   Statement printing
   Statement filters
You can start with
   Bank Accounts Kata sample code

    http://bit.ly/jtOP6F
   if you need joda­time

    http://bit.ly/kSpwNj
Wrap-up
Which rules:
       were simplest to follow?
       hardest?
       had biggest impact on design?
       you think you could use in production?
Rule 1: Use One Level of
        Indentation per Method
   Method ­> does exactly one thing
   Reuse
   Readability
   Implementation matches name ­> easier to find bugs
Rule 2: Don't Use the else
               Keyword
   Simple cases ­> guard clauses, early returns
   Complex cases ­> polymorphism (Strategy, Null Object)
Rule 3: Wrap All Primitives and
           Strings
   Express intent
   Type­safe
   Place for behaviour
Rule 4: Use Only One Dot per
                Line
   Place responsibilities properly
   The Law of Demeter
            your toys
            toys that you make
            toys someone gives you
Rule 5: Don't Abbreviate
   Remove duplication
   Place responsibilities properly
Rule 6: Keep All Entities Small
   Single Responsibility Principle
   Cohesive packages
Rule 7: Don't Use Any Classes
    with More Than Two Instance
   Class cohesion
                   Variables
   Find commonality of instance variables
   Object Model decomposition
Rule 8: Use First-Class
                Collections
   Home for collection­related behaviour
Rule 9: Don't Use Any
      Getters/Setters/Properties
   Strong encapsulation boundaries
   “Tell, don't ask”
References
   Object Calisthenics, Jeff Bay in: The ThoughtWorks Anthology, 
      Pragmatic Bookshelf 2008.


                              Pics

   http://www.flickr.com/photos/jiheffe/3462940215/
   http://www.flickr.com/photos/singapore2010/4916726882

Contenu connexe

Tendances

REST API Pentester's perspective
REST API Pentester's perspectiveREST API Pentester's perspective
REST API Pentester's perspectiveSecuRing
 
Git branching strategies
Git branching strategiesGit branching strategies
Git branching strategiesjstack
 
Understanding Apache Kafka® Latency at Scale
Understanding Apache Kafka® Latency at ScaleUnderstanding Apache Kafka® Latency at Scale
Understanding Apache Kafka® Latency at Scaleconfluent
 
Begineers guide to cardano
Begineers guide to cardanoBegineers guide to cardano
Begineers guide to cardanozaarahary
 
Apache Flink, AWS Kinesis, Analytics
Apache Flink, AWS Kinesis, Analytics Apache Flink, AWS Kinesis, Analytics
Apache Flink, AWS Kinesis, Analytics Araf Karsh Hamid
 
FIDO & PSD2: Solving the Strong Customer Authentication Challenge in Europe
FIDO & PSD2: Solving the Strong Customer Authentication Challenge in EuropeFIDO & PSD2: Solving the Strong Customer Authentication Challenge in Europe
FIDO & PSD2: Solving the Strong Customer Authentication Challenge in EuropeFIDO Alliance
 
API Security in a Microservice Architecture
API Security in a Microservice ArchitectureAPI Security in a Microservice Architecture
API Security in a Microservice ArchitectureMatt McLarty
 
Secure Kafka at scale in true multi-tenant environment ( Vishnu Balusu & Asho...
Secure Kafka at scale in true multi-tenant environment ( Vishnu Balusu & Asho...Secure Kafka at scale in true multi-tenant environment ( Vishnu Balusu & Asho...
Secure Kafka at scale in true multi-tenant environment ( Vishnu Balusu & Asho...confluent
 
Introduction to Cryptocurrency trading
Introduction to Cryptocurrency tradingIntroduction to Cryptocurrency trading
Introduction to Cryptocurrency tradingAmir Rafati
 
Apache Kafka in Gaming Industry (Games, Mobile, Betting, Gambling, Bookmaker,...
Apache Kafka in Gaming Industry (Games, Mobile, Betting, Gambling, Bookmaker,...Apache Kafka in Gaming Industry (Games, Mobile, Betting, Gambling, Bookmaker,...
Apache Kafka in Gaming Industry (Games, Mobile, Betting, Gambling, Bookmaker,...Kai Wähner
 
Community live #1 - Gitflow Workflow
Community live #1 - Gitflow WorkflowCommunity live #1 - Gitflow Workflow
Community live #1 - Gitflow WorkflowLiora Milbaum
 
Git Branching for Agile Teams
Git Branching for Agile Teams Git Branching for Agile Teams
Git Branching for Agile Teams Atlassian
 
Discover How Volvo Cars Uses a Time Series Database to Become Data-Driven
Discover How Volvo Cars Uses a Time Series Database to Become Data-DrivenDiscover How Volvo Cars Uses a Time Series Database to Become Data-Driven
Discover How Volvo Cars Uses a Time Series Database to Become Data-DrivenDevOps.com
 
A Deep Dive into Kafka Controller
A Deep Dive into Kafka ControllerA Deep Dive into Kafka Controller
A Deep Dive into Kafka Controllerconfluent
 
Scaling a Core Banking Engine Using Apache Kafka | Peter Dudbridge, Thought M...
Scaling a Core Banking Engine Using Apache Kafka | Peter Dudbridge, Thought M...Scaling a Core Banking Engine Using Apache Kafka | Peter Dudbridge, Thought M...
Scaling a Core Banking Engine Using Apache Kafka | Peter Dudbridge, Thought M...HostedbyConfluent
 
Apache Flink and what it is used for
Apache Flink and what it is used forApache Flink and what it is used for
Apache Flink and what it is used forAljoscha Krettek
 
Deploying Kafka Streams Applications with Docker and Kubernetes
Deploying Kafka Streams Applications with Docker and KubernetesDeploying Kafka Streams Applications with Docker and Kubernetes
Deploying Kafka Streams Applications with Docker and Kubernetesconfluent
 

Tendances (20)

REST API Pentester's perspective
REST API Pentester's perspectiveREST API Pentester's perspective
REST API Pentester's perspective
 
Git branching strategies
Git branching strategiesGit branching strategies
Git branching strategies
 
Understanding Apache Kafka® Latency at Scale
Understanding Apache Kafka® Latency at ScaleUnderstanding Apache Kafka® Latency at Scale
Understanding Apache Kafka® Latency at Scale
 
Begineers guide to cardano
Begineers guide to cardanoBegineers guide to cardano
Begineers guide to cardano
 
Apache Flink, AWS Kinesis, Analytics
Apache Flink, AWS Kinesis, Analytics Apache Flink, AWS Kinesis, Analytics
Apache Flink, AWS Kinesis, Analytics
 
FIDO & PSD2: Solving the Strong Customer Authentication Challenge in Europe
FIDO & PSD2: Solving the Strong Customer Authentication Challenge in EuropeFIDO & PSD2: Solving the Strong Customer Authentication Challenge in Europe
FIDO & PSD2: Solving the Strong Customer Authentication Challenge in Europe
 
API Security in a Microservice Architecture
API Security in a Microservice ArchitectureAPI Security in a Microservice Architecture
API Security in a Microservice Architecture
 
Secure Kafka at scale in true multi-tenant environment ( Vishnu Balusu & Asho...
Secure Kafka at scale in true multi-tenant environment ( Vishnu Balusu & Asho...Secure Kafka at scale in true multi-tenant environment ( Vishnu Balusu & Asho...
Secure Kafka at scale in true multi-tenant environment ( Vishnu Balusu & Asho...
 
Introduction to Cryptocurrency trading
Introduction to Cryptocurrency tradingIntroduction to Cryptocurrency trading
Introduction to Cryptocurrency trading
 
Bitcoin
BitcoinBitcoin
Bitcoin
 
Apache Kafka in Gaming Industry (Games, Mobile, Betting, Gambling, Bookmaker,...
Apache Kafka in Gaming Industry (Games, Mobile, Betting, Gambling, Bookmaker,...Apache Kafka in Gaming Industry (Games, Mobile, Betting, Gambling, Bookmaker,...
Apache Kafka in Gaming Industry (Games, Mobile, Betting, Gambling, Bookmaker,...
 
Community live #1 - Gitflow Workflow
Community live #1 - Gitflow WorkflowCommunity live #1 - Gitflow Workflow
Community live #1 - Gitflow Workflow
 
GitHub Presentation
GitHub PresentationGitHub Presentation
GitHub Presentation
 
Git Branching for Agile Teams
Git Branching for Agile Teams Git Branching for Agile Teams
Git Branching for Agile Teams
 
Discover How Volvo Cars Uses a Time Series Database to Become Data-Driven
Discover How Volvo Cars Uses a Time Series Database to Become Data-DrivenDiscover How Volvo Cars Uses a Time Series Database to Become Data-Driven
Discover How Volvo Cars Uses a Time Series Database to Become Data-Driven
 
A Deep Dive into Kafka Controller
A Deep Dive into Kafka ControllerA Deep Dive into Kafka Controller
A Deep Dive into Kafka Controller
 
Scaling a Core Banking Engine Using Apache Kafka | Peter Dudbridge, Thought M...
Scaling a Core Banking Engine Using Apache Kafka | Peter Dudbridge, Thought M...Scaling a Core Banking Engine Using Apache Kafka | Peter Dudbridge, Thought M...
Scaling a Core Banking Engine Using Apache Kafka | Peter Dudbridge, Thought M...
 
Apache Kafka
Apache KafkaApache Kafka
Apache Kafka
 
Apache Flink and what it is used for
Apache Flink and what it is used forApache Flink and what it is used for
Apache Flink and what it is used for
 
Deploying Kafka Streams Applications with Docker and Kubernetes
Deploying Kafka Streams Applications with Docker and KubernetesDeploying Kafka Streams Applications with Docker and Kubernetes
Deploying Kafka Streams Applications with Docker and Kubernetes
 

Similaire à How object oriented are you feeling today?

How to make a dichotomous key
How to make a dichotomous keyHow to make a dichotomous key
How to make a dichotomous keyLekhan Lodhi
 
Agile leadership practices for PIONEERS
 Agile leadership practices for PIONEERS Agile leadership practices for PIONEERS
Agile leadership practices for PIONEERSStefan Haas
 
Most Useful Design Patterns
Most Useful Design PatternsMost Useful Design Patterns
Most Useful Design PatternsSteven Smith
 
Cinci ug-january2011-anti-patterns
Cinci ug-january2011-anti-patternsCinci ug-january2011-anti-patterns
Cinci ug-january2011-anti-patternsSteven Smith
 
RecSysOps: Best Practices for Operating a Large-Scale Recommender System
RecSysOps: Best Practices for Operating a Large-Scale Recommender SystemRecSysOps: Best Practices for Operating a Large-Scale Recommender System
RecSysOps: Best Practices for Operating a Large-Scale Recommender SystemEhsan38
 
Refactoring page objects The Screenplay Pattern
Refactoring page objects   The Screenplay Pattern Refactoring page objects   The Screenplay Pattern
Refactoring page objects The Screenplay Pattern RiverGlide
 
The View - 30 proven Lotuscript tips
The View - 30 proven Lotuscript tipsThe View - 30 proven Lotuscript tips
The View - 30 proven Lotuscript tipsBill Buchan
 
Open source bridge testing antipatterns presentation
Open source bridge testing antipatterns presentationOpen source bridge testing antipatterns presentation
Open source bridge testing antipatterns presentationmmrobins
 
The View object orientated programming in Lotuscript
The View object orientated programming in LotuscriptThe View object orientated programming in Lotuscript
The View object orientated programming in LotuscriptBill Buchan
 
Best Practices of Software Development
Best Practices of Software DevelopmentBest Practices of Software Development
Best Practices of Software DevelopmentFolio3 Software
 
Test-Driven Development
 Test-Driven Development  Test-Driven Development
Test-Driven Development Amir Assad
 
Working with Legacy Code
Working with Legacy CodeWorking with Legacy Code
Working with Legacy CodeEyal Golan
 
Steve Huffman - Lessons learned while at reddit.com
Steve Huffman - Lessons learned while at reddit.comSteve Huffman - Lessons learned while at reddit.com
Steve Huffman - Lessons learned while at reddit.comCarsonified Team
 
Seven Habits Of Highly Effective Asp Net Mvc D
Seven Habits Of Highly Effective Asp Net Mvc DSeven Habits Of Highly Effective Asp Net Mvc D
Seven Habits Of Highly Effective Asp Net Mvc Dcurtismitchell
 
Prototype design patterns
Prototype design patternsPrototype design patterns
Prototype design patternsThaichor Seng
 
'Best Practices for Elgg Plugin Developers' Cash Costello #ECSF
'Best Practices for Elgg Plugin Developers' Cash Costello #ECSF'Best Practices for Elgg Plugin Developers' Cash Costello #ECSF
'Best Practices for Elgg Plugin Developers' Cash Costello #ECSFCondiminds
 

Similaire à How object oriented are you feeling today? (20)

Object Calisthenics in Objective-C
Object Calisthenics in Objective-CObject Calisthenics in Objective-C
Object Calisthenics in Objective-C
 
Object calisthenics
Object calisthenicsObject calisthenics
Object calisthenics
 
Design_Patterns_Dr.CM.ppt
Design_Patterns_Dr.CM.pptDesign_Patterns_Dr.CM.ppt
Design_Patterns_Dr.CM.ppt
 
How to make a dichotomous key
How to make a dichotomous keyHow to make a dichotomous key
How to make a dichotomous key
 
Agile leadership practices for PIONEERS
 Agile leadership practices for PIONEERS Agile leadership practices for PIONEERS
Agile leadership practices for PIONEERS
 
Most Useful Design Patterns
Most Useful Design PatternsMost Useful Design Patterns
Most Useful Design Patterns
 
Cinci ug-january2011-anti-patterns
Cinci ug-january2011-anti-patternsCinci ug-january2011-anti-patterns
Cinci ug-january2011-anti-patterns
 
RecSysOps: Best Practices for Operating a Large-Scale Recommender System
RecSysOps: Best Practices for Operating a Large-Scale Recommender SystemRecSysOps: Best Practices for Operating a Large-Scale Recommender System
RecSysOps: Best Practices for Operating a Large-Scale Recommender System
 
Refactoring page objects The Screenplay Pattern
Refactoring page objects   The Screenplay Pattern Refactoring page objects   The Screenplay Pattern
Refactoring page objects The Screenplay Pattern
 
The View - 30 proven Lotuscript tips
The View - 30 proven Lotuscript tipsThe View - 30 proven Lotuscript tips
The View - 30 proven Lotuscript tips
 
Open source bridge testing antipatterns presentation
Open source bridge testing antipatterns presentationOpen source bridge testing antipatterns presentation
Open source bridge testing antipatterns presentation
 
The View object orientated programming in Lotuscript
The View object orientated programming in LotuscriptThe View object orientated programming in Lotuscript
The View object orientated programming in Lotuscript
 
Best Practices of Software Development
Best Practices of Software DevelopmentBest Practices of Software Development
Best Practices of Software Development
 
Test-Driven Development
 Test-Driven Development  Test-Driven Development
Test-Driven Development
 
Working with Legacy Code
Working with Legacy CodeWorking with Legacy Code
Working with Legacy Code
 
Steve Huffman - Lessons learned while at reddit.com
Steve Huffman - Lessons learned while at reddit.comSteve Huffman - Lessons learned while at reddit.com
Steve Huffman - Lessons learned while at reddit.com
 
Seven Habits Of Highly Effective Asp Net Mvc D
Seven Habits Of Highly Effective Asp Net Mvc DSeven Habits Of Highly Effective Asp Net Mvc D
Seven Habits Of Highly Effective Asp Net Mvc D
 
Prototype design patterns
Prototype design patternsPrototype design patterns
Prototype design patterns
 
'Best Practices for Elgg Plugin Developers' Cash Costello #ECSF
'Best Practices for Elgg Plugin Developers' Cash Costello #ECSF'Best Practices for Elgg Plugin Developers' Cash Costello #ECSF
'Best Practices for Elgg Plugin Developers' Cash Costello #ECSF
 
C#
C#C#
C#
 

Plus de Krzysztof Jelski

Plus de Krzysztof Jelski (6)

Test-Driven Development Effectiveness - AgileEE 2016
Test-Driven Development Effectiveness - AgileEE 2016 Test-Driven Development Effectiveness - AgileEE 2016
Test-Driven Development Effectiveness - AgileEE 2016
 
05 - Testowalność
05 - Testowalność05 - Testowalność
05 - Testowalność
 
04 - Dublerzy testowi
04 - Dublerzy testowi04 - Dublerzy testowi
04 - Dublerzy testowi
 
03 - Testowanie GUI
03 - Testowanie GUI03 - Testowanie GUI
03 - Testowanie GUI
 
02 - Mechanika TDD
02 - Mechanika TDD02 - Mechanika TDD
02 - Mechanika TDD
 
01 - Wprowadzenie do TDD
01 - Wprowadzenie do TDD01 - Wprowadzenie do TDD
01 - Wprowadzenie do TDD
 

Dernier

How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
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
 
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
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
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
 
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
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 

Dernier (20)

How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
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
 
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?
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
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
 
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...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 

How object oriented are you feeling today?

  • 1. How Object-Oriented Are You Feeling Today? Software Craftsmanship 2011 26th May, Bletchley Park Krzysztof Jelski
  • 3. Agenda INTRO WRAP-UP
  • 4. The Nine Rules 1. Use One level of indentation per method 2. Don't use the else keyword 3. Wrap all primitives and strings 4. Use only one dot per line 5. Don't abbreviate (one­ or two­words names) 6. Keep all entities small (50 lines/class, 10 classes/package) 7. Don't use any classes with more than two instance variables 8. Use first class collections 9. Don't use any getters, setters or properties
  • 5. Bank Accounts Kata  Think of your personal bank account experience  When in doubt, go for the simplest solution
  • 6. Features  Deposit, Withdrawal  Transfer  Account Statement (date, amount, balance)  Statement printing  Statement filters
  • 7. You can start with  Bank Accounts Kata sample code http://bit.ly/jtOP6F  if you need joda­time http://bit.ly/kSpwNj
  • 8. Wrap-up Which rules:  were simplest to follow?  hardest?  had biggest impact on design?  you think you could use in production?
  • 9. Rule 1: Use One Level of Indentation per Method  Method ­> does exactly one thing  Reuse  Readability  Implementation matches name ­> easier to find bugs
  • 10. Rule 2: Don't Use the else Keyword  Simple cases ­> guard clauses, early returns  Complex cases ­> polymorphism (Strategy, Null Object)
  • 11. Rule 3: Wrap All Primitives and Strings  Express intent  Type­safe  Place for behaviour
  • 12. Rule 4: Use Only One Dot per Line  Place responsibilities properly  The Law of Demeter  your toys  toys that you make  toys someone gives you
  • 13. Rule 5: Don't Abbreviate  Remove duplication  Place responsibilities properly
  • 14. Rule 6: Keep All Entities Small  Single Responsibility Principle  Cohesive packages
  • 15. Rule 7: Don't Use Any Classes with More Than Two Instance  Class cohesion Variables  Find commonality of instance variables  Object Model decomposition
  • 16. Rule 8: Use First-Class Collections  Home for collection­related behaviour
  • 17. Rule 9: Don't Use Any Getters/Setters/Properties  Strong encapsulation boundaries  “Tell, don't ask”
  • 18. References  Object Calisthenics, Jeff Bay in: The ThoughtWorks Anthology,  Pragmatic Bookshelf 2008. Pics  http://www.flickr.com/photos/jiheffe/3462940215/  http://www.flickr.com/photos/singapore2010/4916726882