Review on Expert J2EE 1

来源:互联网 发布:静态nat加端口号配置 编辑:程序博客网 时间:2024/04/27 23:52

J2EE Myths
1. Portability;
过分强调可移植性,会失去一些平台所特有的能力,增大投入,降低生产力。应该是Design Once, Re-implement a Few

Interface Anywhere.
2. Performance:
不能依靠应用程序服务器和硬件来提高性能,在设计时就应该把性能因素考虑进去。
3. Transparent:
尽管应用程序服务器可以管理很多底层的工作,但是不能完全依赖。
4. J2EE-EJB:
EJB并不是在所有的地方都能适用。
5. 适用性:
J2EE并不能解决所有问题,不能让所用的技术来决定解决问题的方法。

Goals of an Enterprise Architecture.
1. Be robust,reliable, and bug free
2. Be performant and scalable
3. Take advantage of OO design principles
4. Avoid unnecessary complexity
5. Be maintaninable and extensible
6. Be delivered on time.
7. Be easy to test
8. Promote reuse.
下面两点是由商业需求所决定的,并不是所有Enterprise Architecture都需要。
1. Support for multiple client types.
2. Portability.

Whether to User a Distributed Architecture
Benefits:
1. Support different type of client.
2. 可以将组件发布到多个服务器,解决瓶颈问题。

Problems:
1. Performance(remote call)
2. Complexity
3. Contraint on practicing OO design.

分布式并不是取得scalable, robust的唯一方法。同时,随着技术的发展,已可以避免通过RMI来使用EJB,例如Local

interface, soap web service.

When to Use EJB
EJB并不是J2EE中必要的技术,如果客户需求中需要分布式结构,并且使用RMI作为远程协议时才有必要使用EJB

在以下情况中使用EJB有优势:
1. Remote access over RMI
2. Distributed applications
3. Support multiple type of client
4. Message-driven application

在以下情况中需要衡量
1. Multi-threaded code
2. Transaction managemnet
3. Role-based security

Accessing Data
数据访问策略的选择是决定性能的关键
不管选择怎样的数据访问方法,最好能通过一抽象层将商业逻辑和具体数据访问实现相分离。

1. Entity Beans
考虑效率、复杂度、对container的依赖性
2. JDO
3. O/R Mapping
4. JDBC,可以作为O/R Mapping的补充。

State Management
Application that do not maintain server-side state is more scalable than application that do.
In cluster, the server-side state must be replicated.

存放地点:
HTTP session object, stateful session bean.

Enterprise Archtecture
Divide into UI, Business, EIS tiers
Each tier should only depends on the tier immediately beneath it.

Four J2EE Architectures:
1. Web application with business component interface
2. Web application accessing Local EIB
3. Distributed application with remoted EJB
4. Web application exposing web services interface.
 

原创粉丝点击