Andrew Smith was attending a presentation on design patterns and ran into a fellow programmer he knew from college. While they were chatting, the colleague asked Andrew a rather curious question: "what pattern do you think is most useful?" Andrew thought about it for a little bit, and said that he had found the Singleton pattern very helpful on some recent projects.

A few months later, Andrew received an email from his colleague telling him that he was wrong about singeltons; he used the pattern and it just doesn't work. Andrew was a bit thrown off by this and asked for some clarification. His colleague replied back with his project code attached; it was filled almost entirely with classes like this ...

public class NotificationMessage
  //singleton pattern
  private NotificationMessage() {}

  private static string _MessageType;
  public static string MessageType
    get { return _MessageType; }
    set { ChangeMessageType(value); }
  private static System.Net.IPEndPoint _Destination;
  public static string Destination
    get { return _Destination; }
    set { _Destination = value; }
  // SNIP - bunch of other properties 

  private static bool Send() { ... }
  private static bool SendAsycnh() { ... }
  // SNIP - bunch of other methods 

[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!