Don't make two or more things at once.
TL;DR: Try to be as atomic as possible in your methods
Harder to test
Harder to read
- Break the method
Refactoring 002 - Extract Method
Maxi Contieri ⭐⭐⭐ ・ Nov 25 '21 ・ 2 min read
If you name a method with 'And' you are probably missing an extract-and-break method opportunity.
calculatePrimeFactorsRemoveDuplicatesAndPrintThem() // Three responsibilities
calculatePrimeFactors(); removeDuplicates(); printNumbers(); // Three diferent methods // We can test them and reuse them
Some linters can warn us about methods including the term 'and'.
When making methods, it is very important to play some rubber duck story and tell ourselves if we are making things right.
Code Smell 85 - And Functions
Maxi Contieri ⭐⭐⭐ ・ Aug 21 '21 ・ 1 min read
Code Smells are just my opinion.
Photo by Scott Sanker on Unsplash
Learning the art of programming, like most other disciplines, consists of first learning the rules and then learning when to break them.
Software Engineering Great Quotes
Maxi Contieri ⭐⭐⭐ ・ Dec 28 '20 ・ 13 min read
This article is part of the CodeSmell Series.
Oldest comments (0)