With the arrival of Java EE and EJB 3,
have any of these Core J2EE Patterns become obsolete, or stand deprecated in light of (better) alternativ开发者_Go百科es?
Are there any new patterns that one could use?
Adam Bien has written an excellent book "Real World Java EE Patterns - Rethinking Best Practices" just about this (i.e. updating J2EE patterns to Java EE 5/6). You can see a an overview of the changed and updated J2EE patterns in my Summary of the Real World Java EE Patterns.
Some patterns such as Session Facade still make sense to me. We still need to take care in the of public interfaces and focus on a Facade is helpful for that purpose. The "Session"-ness tends to be less prominent because we simply can annotate a POJO to get the EJB, but the "Facade"-ness is critical.
Service Locator has been pushed down into the annotation-based injection approach for resource access. So it's not so much unimportant as more nicely wrapped in the Java EE framework.
Data Transfer Objects are less widely used, JPA-annotated POJOs, replacing Entity Beans are quite commonly used. There is some debate in this area, in some scenarios DTOs may still be useful, but in simple cases they are probably not needed, and hence there may be less use of related patterns such as Transfer Object Assembler.
精彩评论