Functions should be small
When a function seems to need more than two or three arguments, it is likely that some of those arguments can be wrapped into a class of their own. In such cases, group them within a class:
// Bad
function makeCircle(double $x, double $y, double $radius): Circle;
// Good
function makeCircle(Point $center, double $radius): Circle;
Side effects are lies. Your function promises to do one thing, but it also does other hidden things. Sometimes it will make unexpected changes to the variables of its own class or do unexpected behaviour. Sometimes it will make them to the parameters passed into the function or to system globals. In either case they are devious and damaging mistrusts that often result in strange temporal couplings and order dependencies, or hide some business logic you are missing.
Functions should either do something or answer something, but not both.
- Clean Code (Amazon) [English] by Robert C. Martin
- Object calisthenics Rules that help you write better Oriented Object code
- Medium post about meaningful names and functions
- Functions- Clean Code, Episode 3 By Uncle Bob