站内搜索: 请输入搜索关键词

当前页面: 开发资料首页J2SE 专题软件工程与系统框架

软件工程与系统框架

摘要: J道的老大banq曾经说过设计模式是衡量一个程序员水平高低最重要的标准。个人非常赞同这个观点,从这个角度看学好J2EE第一个要了解的就是作为一个庞大复杂的系统,它是如何由各个模块拼装并协同有效地运作。
J道的老大banq曾经说过设计模式是衡量一个程序员水平高低最重要的标准。个人非常赞同这个观点,从这个角度看学好J2EE第一个要了解的就是作为一个庞大复杂的系统,它是如何由各个模块拼装并协同有效地运作。

先来几个定义暖暖身 Definitions of Different Dimensions in J2EE

Tiers: A logical or physical organization of components into an ordered chain of service providers and consumers. Components within a tier typically consume the services of those in an "adjacent" provider tier and provide services to one or more "adjacent" consumer tiers. Within a tier, services are grouped to like requirements, such as functionality, security, or load distribution.

Layers: The hardware and software stack that hosts services within a given tier. Physical, network, and software platforms and standard API sets support the components that provide a service. Layers, like tiers, represent a well-ordered relationship across boundaries that are mediated by interfaces. Whereas tiers represent processing chains across components, layers represent container/component relationships in implementation and deployment of services.

Tiers层的概念是我们最常听到的,一般来说它可以分为 (客户) <---交互---> [ Client Interface --- Presentation Tier --- BizLogic Tier --- Integration Tier --- Resource Tier ]

Client Interface 典型的客户界面为IE, Swing, Applet, WAP等,客户与之直接交互
Presentation Tier 负责接受客户请求并返回相应的处理结果。登陆,权限检查,会话管理在此进行,从技术角度就是JSP HTML等
Business Logic Tier 负责处理业务逻辑和数据,是J2EE的核心,它也同时管理事务Transaction,EJB等在这一层
Integration Tier 负责连接业务逻辑层与系统资源层,最常见的JDBC数据库连接就是一个例子
Resource Tier 负责提供上层所需要的资源,比如数据库, File System, Legacy System等等

结合实际应用和设计模式,我们可以将层次进一步划分。多层次会降低效率,也会导致出现很多看似“无用”的代码,但正是这些代码实现了低耦合从而降低了后期维护成本。
1) Presentation Tier应用MVC模式, 将程序流程控制器(Controller) 视图(View)和数据三者分离,如Struts就是其中一员大将。Filtering和User-Role-Priviledge-Resource也常在使用(具体还会开新贴细谈)
2) Business Logic Tier 和Presentation Tier的低耦合由Business Delegate层实现,很典型的例子 BusinessDelegate -> BusinessMgr (EJB) -> ...而Facade模式也经常在这里被用来做封装。

主要参考文献:软件体系架构模式在J2EE中的应用
主要参考项目:Medlog Logistic PACE2 SCS



↑返回目录
前一篇: ArrayList的使用
后一篇: 掌握数据结构和算法的知识很重要吗?