Tag Archives: YAGNI

When Getters and Setters are not Needed

Getter and setters (also called accessors and mutators) are small pieces of code that run to provide a value stored in the object instead of accessing it directly.  Sometimes they are good, sometimes bad, this post explores which is which.

Posted in Coding, Example Code | Tagged , , , , , , , | Leave a comment

Code Only What You Need

Only commit to code that which needs to committed to code.  Only write what needs to be written.  How hard can that be?  You might be surprised, but there are developers out there that are so enamored with the code … Continue reading

Posted in Coding, Design, practice | Tagged , , , , | Leave a comment

Brainless Getters & Setters are a Waste

Someone long ago set a pattern that all members should have a getter and setter method.  Some are persuaded that this is OO and this is encapsulation, so a lot of inexperienced programmers do this by default.  But this is … Continue reading

Posted in Coding, Example Code, practice | Tagged , , , , | Leave a comment

#26 Don't add Methods and Classes that you don't need.

This should be obvious, but it is a rule that is violated quite often. This is one corollary to the YAGNI (You Aren’t Gonna Need It) Principle.    This post discusses that there is a proper time to do things, … Continue reading

Posted in Coding, Design | Tagged , | Leave a comment