Useful classes



  • I think I've found the most useful class. Ever. And it's on our SVN server. Yay.


    import java.io.Serializable;

    final class Address implements Serializable
    {
           String value;
           public Address(String value)
           {
                   this.value = value;
           }
           public String getValue()
           {
                   return value;
           }
           public void setValue(String value)
           {
                   this.value = value;
           }
           public String toString()
           {
                   return value;
           }
    }



  • That is so incredibly useful! I can hardly believe it. It's a Java Bean wrapper for a String! It may be badly named, but the design is absolutely bomb-proof.

    Eclipse can autogenerate that code with about 3 clicks, so I hope that's what happened.

    The only reason for this codes existance must be someone unaware of their own framework, trying to hack random Beans together to store some data. Was the author named Paula by any chance?



  • Hmm, another class, same as above, just the keyword "final" changed to "public". That's more advanced now. No doubt.



  • It's a little known fact that the so-called Gang of Four, Hoffman, Adelman, Bryce, and Roland, authors of a now famous book on design patterns, originally had many more design patterns than they ended up publishing.  What you have here is a pattern known as the "Newbieton".  It's actually quite useful, and archaeologists have even found evidence of its early use in the production of Egyptian pottery.

    Recent findings have placed this particular "Newbieton" pattern in the top 5 most underrated design patterns, and the top 10 for widespread use.  If you'd like more information, I'd recommend visiting your local bar.  Ask for Cliff.



  • "AntiPatterns" are discussed in great details here:




Log in to reply