I can grasp the part "do one thing" via encapsulation, Dependency Injection, Principle of Least Knowledge, and You Ain't Gonna Need It; but how do I understand the second part "do it well?"

An example given was the notion of completeness, given in the same YAGNI article:

for example, among features which allow adding items, deleting items, or modifying items, completeness could be used to also recommend "renaming items".

However, I found reasoning like that could easily be abused into feature creep, thus violating the "do one thing" part.

So, what is a litmus test for seeing rather a feature belongs to the "do it well" category (hence, include it into the function/class/program) or to the other "do one thing" category (hence, exclude it)?

The first part, "do one thing," is best understood via UNIX's ls command as a counterexample for its inclusion of excessive number of flags for formatting its output, which should have been completely delegated to another external program. But I don't have a good example to see the second part "do it well."

What is a good example where removing any further feature would make it not "do it well?"

Edit
Report