Sponsored Link •
|
Advertisement
|
Would you rather have 20 or 200 buttons on your TV's remote control?
package java.lang; public class String { // Returns the index within this string of the // first occurrence of the specified character. int indexOf(int ch) { //... } // Returns the index within this string of the // first occurrence of the specified character, // starting at the specified index. int indexOf(int ch, int fromIndex) { //... } //... }
Scott Meyers in his book effective C++ said, "Strive for interfaces that are minimal and complete." Keeping the interface simple is not sufficient grounds for leaving out functionality the clients need. If you end up with too many methods, perhaps you've alotted too much responsibility to that object. That object might be trying to do too much. Consider factoring out some responsibilities to other objects. Good to minimize features, ship product, and get user feedback for next release. It is easier to add things later that change something that already exists.
Can go to far in minimizing. What are the heuristics? What about 500 objects each with 5 methods?
It is easier to add things later than to change something that already exists.
Sponsored Links
|