Best practices dictate continuously that a method should be responsible for only one thing. I have come across a method that does 3 things, and I dont know how to 1. decompose it according to best practices. 2. name it. Also I wonder how many methods in real life really do just one thing as text books advise all the time?
method ( entryId ) {
if (this.checkDuplicate(entryId)) {
this.deleteDuplicate(entryId);
return true;
} else {
return false;
}
}
As we can see that method named method, is doing more than just one thing. Is it even possible to abide by 'method should be responsible for only one thing rule' ?
If yes, how can the above algorithm be decomposed into it ?
If not, what can I name a method that does so many things ?