J2EE學習筆記(4) 軟體工程與系統架構

來源:互聯網
上載者:User
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

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.