Observer Pattern Pros & Cons

Pros:

  • Supports the principle to strive for loosley coupled designs between objects that interact.
  • Allows you to send data to many other objects in a very efficient mannor.
  • No modification is need to be done to the subject to add new observers.
  • You can add and remove observers at anytime.

Cons

  • Java’s built in class Observable forces the use of inheritance vs programming to an interface
  • Observable protects crucial methods which means you can’t even create an instance of the Observable class and compose it with your own objects, you have to subclass.
  • If not used carefully the observer pattern can add unecessary complexity
  • The order of Observer notifications is undependable
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s


%d bloggers like this: