The reality is there is no golden rule that it going to be correct in all cases.
I think the example in this article is something that is manufactured for the purposes of illustration & possibly a bit artificial.
Ultimately, if you can ask the question "what does this function/class do?" and there is one obvious answer you are probably doing ok. It is probably easier to spot a function that is doing too many things rather than one that just does one thing.
Some good indicators of a function that is trying to do too much could be
when a large number of parameters are being passed to the function or
when the function receives a Boolean "flag" as an argument which is designed to modify it's behaviour.
There's a great chapter in "clean code" with lots more information on this topic 👍
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
The reality is there is no golden rule that it going to be correct in all cases.
I think the example in this article is something that is manufactured for the purposes of illustration & possibly a bit artificial.
Ultimately, if you can ask the question "what does this function/class do?" and there is one obvious answer you are probably doing ok. It is probably easier to spot a function that is doing too many things rather than one that just does one thing.
Some good indicators of a function that is trying to do too much could be
when a large number of parameters are being passed to the function or
when the function receives a Boolean "flag" as an argument which is designed to modify it's behaviour.
There's a great chapter in "clean code" with lots more information on this topic 👍