Search This Blog

Monday, March 28, 2011

Common JEE Application Design Patterns

  • Typesafe enum pattern/enum in JDK 1.5+
  • code to an interface not an implementation
  • abstract parent class to promote reuse for subclasses
  • factory method pattern (loose couples calling code from instances created)
  • abstract factory pattern  (specific method for each concrete type)
  • builder pattern (similar to factory except user had more flexibility (builder.add(x), builder.add(y), etc.)
  • strategy pattern (strategy encapsulates algorithms not data)
  • decorator design pattern: (implements same interface as object it decorates)
  • visitor pattern: (avoids lots of typecasts and instanceof to do common method on different types)
  • iterator pattern
  • template method pattern (e.g. Spring JDBC and Spring JMS)
  • composite design pattern: (act on Manager or Staff object in same way. both subs of employee)
  • facade pattern: (interface to large set of classes)
  • observer pattern: (observer registers with publisher, publisher notifies observer of event)
  • command pattern: OO equivalent of callbacks (sender object invokes operation, receiver object  receives request to execute certain operation)
  • proxy pattern: (remote: EJB, RMI, CORBA, virtual: create memory intensive object on demand (lazy load hibernate objects when needed), access: different clients get different access rights)
  • dynamic proxy: (reflection based; come at a performance cost; common in AOP)
  • adapter pattern (wrap API)
  • service activator pattern (ala MessageBean)  services need a way to be activated asynchronously
  • For completion: (bridge, chain of responsibility)
  • For completion JEE (MVC, front controller, composite view, view helper, dispatcher view, service to worker, business delegate, session facade, value object, fast lane reader, service locator)

No comments:

Post a Comment