SlideShare a Scribd company logo
1 of 20
Chapter 10.
Diego Alejandro Rios Londoño.
 Objects are all about the interfaces. Coming up with the interfaces that are easy
to understand and use is a key in developing good object-oriented software.
 Often the simplest and most important thing you can do is to change the name of
a method, naming is a key tool in communication.
 If you understand what a programm is doing you should not be afraid to use
Rename method to pass on that knowledge. You can also rename variables and
classes
 Small methods to factor complex processes are very importat, done badly can lead
you on a merry dance to find out what all the Little methods do.
The key to avoid this merry dance is naming the methods.
 The methods must be named in a way that communicates their intention.
 Normally used when you need more information in a method and this information
was not sent yet.
 Remove parameter
 Normally used when a method is no longer using the information sent by the
parameter.
 You can easily add or remove parameter but you have to be careful because it can
lead you on troubles,
 If you have more than two parameters, you must be careful because you
parameter list is getting bigger and it can be forgot.
 “When you have a function that gives you a value and has no observable side
effects, you have a very valuable thing. You can call this function as often as you
like. You can move the call to other places in the method. In short, you have a lot
less to worry about. ”
 “It is a good idea to clearly signal the difference between methods with side
effects and those without. A good rule to follow is to say that any method that
returns a value should not have observable side effects. Some programmers treat
this as an absolute rule [Meyer]. I'm not 100 percent pure on this (as on anything),
but I try to follow it most of the time, and it has served me well. ”
 Create a parameter for methods that do similar things and replace them with a
new method with that parameter.
 When you are using methods that do something in base a parameter. You should
create other methods that do what you want, just to avoid the conditional.
 You can send an object as a parameter when you need different information from
the same object.
 Remove all methods that only affect one field and that do this just one time.
 A method is not used by any other class.
Making method calls_simpler

More Related Content

What's hot

Spreadsheet Errors Nm
Spreadsheet Errors NmSpreadsheet Errors Nm
Spreadsheet Errors NmNipun
 
Assignment 3
Assignment 3  Assignment 3
Assignment 3 NURINCHO
 
One learning challenge: Three Designers put their Skills to the Test: Amanda ...
One learning challenge: Three Designers put their Skills to the Test: Amanda ...One learning challenge: Three Designers put their Skills to the Test: Amanda ...
One learning challenge: Three Designers put their Skills to the Test: Amanda ...Twitterpatedwithlearning
 
Top Five Tips For ISC Computer Practicals
Top Five Tips For ISC Computer PracticalsTop Five Tips For ISC Computer Practicals
Top Five Tips For ISC Computer PracticalsLearnPick
 
Oredev: An Exploratory Tester's Lessons on Security Threat Modeling
Oredev: An Exploratory Tester's Lessons on Security Threat ModelingOredev: An Exploratory Tester's Lessons on Security Threat Modeling
Oredev: An Exploratory Tester's Lessons on Security Threat ModelingMaaret Pyhäjärvi
 

What's hot (14)

Spreadsheet Errors Nm
Spreadsheet Errors NmSpreadsheet Errors Nm
Spreadsheet Errors Nm
 
Assignment 3
Assignment 3  Assignment 3
Assignment 3
 
Test framing(sqa)
Test framing(sqa)Test framing(sqa)
Test framing(sqa)
 
Robots, Testing and LAST
Robots, Testing and LASTRobots, Testing and LAST
Robots, Testing and LAST
 
One learning challenge: Three Designers put their Skills to the Test: Amanda ...
One learning challenge: Three Designers put their Skills to the Test: Amanda ...One learning challenge: Three Designers put their Skills to the Test: Amanda ...
One learning challenge: Three Designers put their Skills to the Test: Amanda ...
 
Top Five Tips For ISC Computer Practicals
Top Five Tips For ISC Computer PracticalsTop Five Tips For ISC Computer Practicals
Top Five Tips For ISC Computer Practicals
 
Debugging
DebuggingDebugging
Debugging
 
Inefficiency pandemic test
Inefficiency pandemic testInefficiency pandemic test
Inefficiency pandemic test
 
Debugging
DebuggingDebugging
Debugging
 
Oredev: An Exploratory Tester's Lessons on Security Threat Modeling
Oredev: An Exploratory Tester's Lessons on Security Threat ModelingOredev: An Exploratory Tester's Lessons on Security Threat Modeling
Oredev: An Exploratory Tester's Lessons on Security Threat Modeling
 
Imrad structure
Imrad structureImrad structure
Imrad structure
 
Debbuger
DebbugerDebbuger
Debbuger
 
Debugging Design [EN]
Debugging Design [EN]Debugging Design [EN]
Debugging Design [EN]
 
Basic abap oo
Basic abap ooBasic abap oo
Basic abap oo
 

Viewers also liked (13)

Chapter 5 refactoring
Chapter 5 refactoringChapter 5 refactoring
Chapter 5 refactoring
 
Chapter 8
Chapter 8Chapter 8
Chapter 8
 
Capitulo 7 moving features between objects
Capitulo 7  moving features between objectsCapitulo 7  moving features between objects
Capitulo 7 moving features between objects
 
Expo 2 parametros
Expo 2   parametrosExpo 2   parametros
Expo 2 parametros
 
Continuos Delivery Commit stage
Continuos Delivery Commit stageContinuos Delivery Commit stage
Continuos Delivery Commit stage
 
Construir tests
Construir testsConstruir tests
Construir tests
 
Design patterns
Design patternsDesign patterns
Design patterns
 
Refactoring: Improving the design of existing code. Chapter 6.
Refactoring: Improving the design of existing code. Chapter 6.Refactoring: Improving the design of existing code. Chapter 6.
Refactoring: Improving the design of existing code. Chapter 6.
 
Capitulo 2
Capitulo 2Capitulo 2
Capitulo 2
 
Implementing a testing strategy
Implementing a testing strategyImplementing a testing strategy
Implementing a testing strategy
 
Continuous delivery
Continuous deliveryContinuous delivery
Continuous delivery
 
Continuos Delivery
Continuos DeliveryContinuos Delivery
Continuos Delivery
 
Refactoring: improving the desing of existing code Cap 1
Refactoring: improving the desing of existing code Cap 1Refactoring: improving the desing of existing code Cap 1
Refactoring: improving the desing of existing code Cap 1
 

Similar to Making method calls_simpler

Get things done : pragmatic project management
Get things done : pragmatic project managementGet things done : pragmatic project management
Get things done : pragmatic project managementStan Carrico
 
Introduction to Programming
Introduction to ProgrammingIntroduction to Programming
Introduction to ProgrammingProf Ansari
 
Refactoring Tips by Martin Fowler
Refactoring Tips by Martin FowlerRefactoring Tips by Martin Fowler
Refactoring Tips by Martin FowlerIgor Crvenov
 
introduction to machine learning
introduction to machine learningintroduction to machine learning
introduction to machine learningJohnson Ubah
 
Approaches to unraveling a complex test problem
Approaches to unraveling a complex test problemApproaches to unraveling a complex test problem
Approaches to unraveling a complex test problemJohan Hoberg
 
Clean code quotes - Citações e provocações
Clean code quotes - Citações e provocaçõesClean code quotes - Citações e provocações
Clean code quotes - Citações e provocaçõesAndré de Fontana Ignacio
 
PATTERNS05 - Guidelines for Choosing a Design Pattern
PATTERNS05 - Guidelines for Choosing a Design PatternPATTERNS05 - Guidelines for Choosing a Design Pattern
PATTERNS05 - Guidelines for Choosing a Design PatternMichael Heron
 
Refactoring e Code Smells: Seu código está apodrecendo!
Refactoring e Code Smells:  Seu código está apodrecendo!Refactoring e Code Smells:  Seu código está apodrecendo!
Refactoring e Code Smells: Seu código está apodrecendo!Emanuel Canuto
 
An Introduction to Usability
An Introduction to UsabilityAn Introduction to Usability
An Introduction to Usabilitydirk.swart
 
When Things Go Bump in the Night
When Things Go Bump in the NightWhen Things Go Bump in the Night
When Things Go Bump in the Nightahamilton55
 
Design process design rules
Design process  design rulesDesign process  design rules
Design process design rulesPreeti Mishra
 
Automation testing: how tools are important?
Automation testing: how tools are important?Automation testing: how tools are important?
Automation testing: how tools are important?MD ISLAM
 
Heuristic principles
Heuristic principlesHeuristic principles
Heuristic principlesSwathy Tantry
 
Get the Balance Right: Acceptance Test Driven Development, GUI Automation and...
Get the Balance Right: Acceptance Test Driven Development, GUI Automation and...Get the Balance Right: Acceptance Test Driven Development, GUI Automation and...
Get the Balance Right: Acceptance Test Driven Development, GUI Automation and...Michael Larsen
 
Software engineering
Software engineeringSoftware engineering
Software engineeringsweetysweety8
 

Similar to Making method calls_simpler (20)

Get things done : pragmatic project management
Get things done : pragmatic project managementGet things done : pragmatic project management
Get things done : pragmatic project management
 
Interaction Patterns In User Interfaces
Interaction Patterns In User InterfacesInteraction Patterns In User Interfaces
Interaction Patterns In User Interfaces
 
Introduction to Programming
Introduction to ProgrammingIntroduction to Programming
Introduction to Programming
 
Refactoring Tips by Martin Fowler
Refactoring Tips by Martin FowlerRefactoring Tips by Martin Fowler
Refactoring Tips by Martin Fowler
 
Presentasi malioboro--10-des-2010
Presentasi malioboro--10-des-2010Presentasi malioboro--10-des-2010
Presentasi malioboro--10-des-2010
 
introduction to machine learning
introduction to machine learningintroduction to machine learning
introduction to machine learning
 
Approaches to unraveling a complex test problem
Approaches to unraveling a complex test problemApproaches to unraveling a complex test problem
Approaches to unraveling a complex test problem
 
Clean code quotes - Citações e provocações
Clean code quotes - Citações e provocaçõesClean code quotes - Citações e provocações
Clean code quotes - Citações e provocações
 
PATTERNS05 - Guidelines for Choosing a Design Pattern
PATTERNS05 - Guidelines for Choosing a Design PatternPATTERNS05 - Guidelines for Choosing a Design Pattern
PATTERNS05 - Guidelines for Choosing a Design Pattern
 
Refactoring e Code Smells: Seu código está apodrecendo!
Refactoring e Code Smells:  Seu código está apodrecendo!Refactoring e Code Smells:  Seu código está apodrecendo!
Refactoring e Code Smells: Seu código está apodrecendo!
 
06 java methods
06 java methods06 java methods
06 java methods
 
Feature selection
Feature selectionFeature selection
Feature selection
 
An Introduction to Usability
An Introduction to UsabilityAn Introduction to Usability
An Introduction to Usability
 
Concept Presentation
Concept PresentationConcept Presentation
Concept Presentation
 
When Things Go Bump in the Night
When Things Go Bump in the NightWhen Things Go Bump in the Night
When Things Go Bump in the Night
 
Design process design rules
Design process  design rulesDesign process  design rules
Design process design rules
 
Automation testing: how tools are important?
Automation testing: how tools are important?Automation testing: how tools are important?
Automation testing: how tools are important?
 
Heuristic principles
Heuristic principlesHeuristic principles
Heuristic principles
 
Get the Balance Right: Acceptance Test Driven Development, GUI Automation and...
Get the Balance Right: Acceptance Test Driven Development, GUI Automation and...Get the Balance Right: Acceptance Test Driven Development, GUI Automation and...
Get the Balance Right: Acceptance Test Driven Development, GUI Automation and...
 
Software engineering
Software engineeringSoftware engineering
Software engineering
 

Recently uploaded

Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitolTechU
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.arsicmarija21
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
Blooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxBlooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxUnboundStockton
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
MICROBIOLOGY biochemical test detailed.pptx
MICROBIOLOGY biochemical test detailed.pptxMICROBIOLOGY biochemical test detailed.pptx
MICROBIOLOGY biochemical test detailed.pptxabhijeetpadhi001
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxEyham Joco
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 

Recently uploaded (20)

Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptx
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
Blooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxBlooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docx
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
MICROBIOLOGY biochemical test detailed.pptx
MICROBIOLOGY biochemical test detailed.pptxMICROBIOLOGY biochemical test detailed.pptx
MICROBIOLOGY biochemical test detailed.pptx
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptx
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 

Making method calls_simpler

  • 2.  Objects are all about the interfaces. Coming up with the interfaces that are easy to understand and use is a key in developing good object-oriented software.  Often the simplest and most important thing you can do is to change the name of a method, naming is a key tool in communication.  If you understand what a programm is doing you should not be afraid to use Rename method to pass on that knowledge. You can also rename variables and classes
  • 3.  Small methods to factor complex processes are very importat, done badly can lead you on a merry dance to find out what all the Little methods do. The key to avoid this merry dance is naming the methods.  The methods must be named in a way that communicates their intention.
  • 4.
  • 5.  Normally used when you need more information in a method and this information was not sent yet.
  • 6.  Remove parameter  Normally used when a method is no longer using the information sent by the parameter.
  • 7.  You can easily add or remove parameter but you have to be careful because it can lead you on troubles,  If you have more than two parameters, you must be careful because you parameter list is getting bigger and it can be forgot.
  • 8.  “When you have a function that gives you a value and has no observable side effects, you have a very valuable thing. You can call this function as often as you like. You can move the call to other places in the method. In short, you have a lot less to worry about. ”  “It is a good idea to clearly signal the difference between methods with side effects and those without. A good rule to follow is to say that any method that returns a value should not have observable side effects. Some programmers treat this as an absolute rule [Meyer]. I'm not 100 percent pure on this (as on anything), but I try to follow it most of the time, and it has served me well. ”
  • 9.
  • 10.  Create a parameter for methods that do similar things and replace them with a new method with that parameter.
  • 11.  When you are using methods that do something in base a parameter. You should create other methods that do what you want, just to avoid the conditional.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.  You can send an object as a parameter when you need different information from the same object.
  • 18.  Remove all methods that only affect one field and that do this just one time.
  • 19.  A method is not used by any other class.