出版時(shí)間:2009 出版社:人民郵電出版社 作者:Martin Fowler 頁(yè)數(shù):533
Tag標(biāo)簽:無(wú)
前言
1999年春天,我飛抵芝加哥為ThoughtWorks公司正在開(kāi)發(fā)的一個(gè)項(xiàng)目擔(dān)任顧問(wèn)。ThoughtWorks是一個(gè)規(guī)模雖小但正在快速成長(zhǎng)的應(yīng)用開(kāi)發(fā)公司。這個(gè)項(xiàng)目屬于那種雄心勃勃的企業(yè)級(jí)應(yīng)用——一個(gè)后端租賃系統(tǒng)。簡(jiǎn)單說(shuō),它處理的是租戶簽字認(rèn)可后所有與租賃有關(guān)的事務(wù),包括發(fā)送賬單、處理某些人對(duì)所租房產(chǎn)的改造、追蹤那些未按時(shí)付款的租戶、處理提前退租的情況等。這聽(tīng)起來(lái)好像并不太難實(shí)現(xiàn),但是你大概沒(méi)有意識(shí)到,租賃合同極度復(fù)雜并且總在不斷變化。它的業(yè)務(wù)“邏輯”幾乎不能套用任何已有的邏輯模式,因?yàn)槟切斑壿嫛睔w根到底是商人們?yōu)榱藫屔舛贫ǖ?,一些奇怪的小改?dòng)都可能對(duì)贏得某筆生意起關(guān)鍵作用。而每次這樣的成功就意味著系統(tǒng)復(fù)雜性的增加。我感興趣的正是這類問(wèn)題:如何捕獲這些復(fù)雜情況,并設(shè)計(jì)一個(gè)面向?qū)ο蟮南到y(tǒng)使問(wèn)題更容易解決。事實(shí)上,我認(rèn)為面向?qū)ο蟮淖畲髢?yōu)點(diǎn)就在于它能夠使復(fù)雜邏輯易于處理。為復(fù)雜業(yè)務(wù)問(wèn)題開(kāi)發(fā)一個(gè)好的領(lǐng)域模型(Domain Model,116)很困難,但結(jié)果往往非常令人滿意。但問(wèn)題還沒(méi)有完。我們的領(lǐng)域模型必須持久存儲(chǔ)到數(shù)據(jù)庫(kù)中,與許多項(xiàng)目一樣,我們使用的也是關(guān)系數(shù)據(jù)庫(kù)。我們還必須將該模型與用戶界面連接起來(lái),還要支持遠(yuǎn)程應(yīng)用程序使用本軟件,并將軟件與第三方的軟件包集成。所有這些工作都基于一種稱作J2EE的新技術(shù),當(dāng)時(shí)世界上沒(méi)有人在這方面具備真正的實(shí)戰(zhàn)經(jīng)驗(yàn)。
內(nèi)容概要
面向?qū)ο蟠髱烳artin Fowler及其專家級(jí)合作者將40多種常用解決方案轉(zhuǎn)化成模式,為我們提供了這本能夠應(yīng)用于任何一種企業(yè)應(yīng)用平臺(tái)的、關(guān)于解決方案的參考書?!镀髽I(yè)應(yīng)用架構(gòu)模式(英文版)》敘述深入淺出,采用大量UML圖進(jìn)一步闡明有關(guān)概念。前面介紹企業(yè)應(yīng)用的背景知識(shí),如分層架構(gòu)、Web表現(xiàn)、業(yè)務(wù)邏輯、數(shù)據(jù)庫(kù)映射、并發(fā)、會(huì)話、分布策略等。在此基礎(chǔ)上,隨后的各章分別對(duì)與這些背景知識(shí)相關(guān)的設(shè)計(jì)模式進(jìn)行了詳細(xì)的介紹,并配以詳細(xì)的Java代碼或C#代碼示例?!镀髽I(yè)應(yīng)用架構(gòu)模式(英文版)》適合設(shè)計(jì)和構(gòu)建企業(yè)應(yīng)用的軟件架構(gòu)師、設(shè)計(jì)人員和編程人員閱讀,同時(shí)也可作為高等院校計(jì)算機(jī)專業(yè)及軟件學(xué)院相關(guān)課程的參考教材。
作者簡(jiǎn)介
作者:(美國(guó))Martin FowlerMartin Fowler,享譽(yù)世界的軟件開(kāi)發(fā)大師?,F(xiàn)為著名軟件開(kāi)發(fā)咨詢公司ThoughtWorks的首席科學(xué)家。他在面向?qū)ο蠓治雠c設(shè)計(jì)、UML、設(shè)計(jì)模式、軟件開(kāi)發(fā)方法學(xué)、XP、重構(gòu)等方面都有重要貢獻(xiàn)。他更全球最具影響力的技術(shù)作家之一,除本書外,他的《分析模式》、《UML精粹》和《重構(gòu)》等著作都已經(jīng)成為經(jīng)典。
書籍目錄
Preface xvii Who This Book Is For xx A cknowledgments xxi Colophon xxiii Introduction 1 Architecture 1 EnterpriseApplications 2 Kinds of EnterpriseApplication 5 ThinkingAbout Performance 6 Patterns 9 The Structure of the Patterns 11 Limitations of These Patterns 13 PART 1: The Narratives 15 Chapter 1: Layering 17 The Evolution of Layers in EnterpriseApplications 18 The Three Principal Layers 19 Choosing Where to Run Your Layers 22 Chapter 2: Organizing Domain Logic 25 MakingA Choice 29 Service Layer 30 Chapter 3: Mapping to Relational Databases 33 Architectural Patterns 33 The Behavioral Problem 38 Reading in Data 40 Structural Mapping Patterns 41 Mapping Relationships 41 Inheritance 45 Building the Mapping 47 Double Mapping 48 Using Metadata 49 Database Connections 50 Some Miscellaneous Points 52 Further Reading 53 Chapter 4: Web Presentation 55 View Patterns 58 Input Controller Patterns 61 Further Reading 61 Chapter 5: Concurrency (by Martin FowlerAnd David Rice) 63 Concurrency Problems 64 Execution Contexts 65 IsolationAnd Immutability 66 OptimisticAnd Pessimistic Concurrency Control 67 Preventing Inconsistent Reads 68 Deadlocks 70 Transactions 71 ACID 71 Transactional Resources 72 Reducing Transaction Isolation for Liveness 73 BusinessAnd System Transactions 74 Patterns for Offline Concurrency Control 76 Application Server Concurrency 78 Further Reading 80 Chapter 6: Session State 81 The Value of Statelessness 81 Session State 83 Ways to Store Session State 84 Chapter 7: Distribution Strategies 87 TheAllure of Distributed Objects 87 RemoteAnd Local Interfaces 88 Where You Have to Distribute 90 Working with the Distribution Boundary 91 Interfaces for Distribution 92 Chapter 8: Putting ItAll Together 95 Starting with the Domain Layer 96 Down to the Data Source Layer 97 Data Source for Transaction Script (11 O) 97 Data Source for Table Module (125) 98 Data Source for Domain Model (116) 98 The Presentation Layer 99 Some Technology-SpecificAdvice 100 JavaAnd J2EE 100 NET 101 Stored Procedures 102 Web Services 103 Other Layering Schemes 103 PART 2: The Patterns 107 Chapter 9: Domain Logic Patterns 109 Transaction Script 110 How It Works 110 When to Use It 111 The Revenue Recognition Problem 112 Example: Revenue Recognition (Java) 113 Domain Model 116 How It Works 116 When to Use It 119 Further Reading 119 Example: Revenue Recognition (Java) 120 Table Module 125 How It Works 126 When to Use It 128 Example: Revenue Recognition withA Table Module (C#) 129 Service Layer (by Randy Stafford) 133 How It Works 134 When to Use It 137 Further Reading 13 7 Example: Revenue Recognition (Java) 138 Chapter 10: Data SourceArchitectural Patterns 143 Table Data Gateway 144 How It Works 144 When to Use It 145 Further Reading 146 Example: Person Gateway (C#) 146 Example: UsingADO NET Data Sets (C#) 148 Row Data Gateway 152 How It Works 152 When to Use It 153 Example:A Person Record (Java) 155 Example:A Data Holder forA Domain Object (Java) 158 Active Record 160 How It Works 160 When to Use It 161 Example:A Simple Person (Java) 162 Data Mapper 165 How It Works 165 When to Use It 170 Example:A Simple Database Mapper (Java) 171 Example: Separating the Finders (Java) 176 Example: CreatingAn Empty Object (Java) 179 Chapter 11: Object-Relational Behavioral Patterns 183 Unit of Work 184 How It Works 184 When to Use It 189 Example: Unit of Work with Object Registration (Java) (by David Rice) 190 Identity Map 195 How It Works 195 When to Use It 198 Example: Methods forAn Identity Map (Java) 198 Lazy Load 200 How It Works 200 When to Use It 203 Example: Lazy Initialization (Java) 203 Example: Virtual Proxy (Java) 203 Example: UsingA Value Holder (Java) 205 Example: Using Ghosts (C#) 206 3hapter 12: Object-Relational Structural Patterns 215 Identity Field 216 How It Works 216 When to Use It 220 Further Reading 221 Example: Integral Key (C#) 221 Example: UsingA Key Table (Java) 222 Example: UsingA Compound Key (Java) 224 Foreign Key Mapping 236 How It Works 236 When to Use It 239 Example: Single-Valued Reference (Java) 240 Example: Multitable Find (Java) 243 Example: Collection of References (C#) 244 Association Table Mapping 248 How It Works 248 When to Use It 249 Example: EmployeesAnd Skills (C#) 250 Example: Using Direct SQL (Java) 253 Example: UsingA Single Query for Multiple Employees (Java) (by Matt FoemmelAnd Martin Fowler) 256 Dependent Mapping 262 How It Works 262 When to Use It 263 Example:AlbumsAnd Tracks (Java) .. 264 Embedded Value 268 How It Works 268 When to Use It 268 Further Reading 270 Example: Simple Value Object (Java) 270 Serialized LOB 272 How It Works 272 When to Use It 274 Example: SerializingA Department Hierarchy in XML (Java) 274 Single Table Inheritance 278 How It Works 278 When to Use It 279 Example:A Single Table for Players (C#) 280 LoadingAn Object from the Database 281 Class Table Inheritance 285 How It Works 285 When to Use It 286 Further Reading 287 Example: PlayersAnd Their Kin (C#) 287 Concrete Table Inheritance 293 How It Works 293 When to Use It 295 Example: Concrete Players (C#) 296 Inheritance Mappers 302 How It Works 303 When to Use It 304 Chapter 13: Object-Relational Metadata Mapping Patterns 305 Chapter 14: Web Presentation Patterns 329 Chapter 15: Distribution Patterns 387 Chapter 16: Offline Concurrency Patterns 415 Chapter 17: Session State Patterns 455 Chapter 18: Base Patterns 465 Index 517
章節(jié)摘錄
插圖:The benefit of Service Layer is that it defines a common set o~ apphcatlon oper-ations available to many kinds of clients and it coordinates an application'sresponse in each operation. The response may involve application logic thatneeds to be transacted atomically across multiple transactional resources. Thus,in an application with more than one kind of client of its business logic, andcomplex responses in its use cases involving multiple transactional resources, itmakes a lot of sense to include a Service Layer with container-managed transac-tions, even in an undistributed architecture. The easier question to answer is probably when not to use it. You probablydon't need a Service Layer if your application's business logic will only have onekind of client——say, a user interface——and its use case responses don't involve~nultiple transactional resources. In this case your Page Controllers can manu-ally control transactions and coordinate whatever response is required, perhapsdelegating directly to the Data Source layer. But as soon as you envision a second kind of client, or a second transactionalresource in use case responses, it pays to design in a Service Layer from thebeginning.
編輯推薦
《企業(yè)應(yīng)用架構(gòu)模式(英文版)》是軟件開(kāi)發(fā)大師Martin Fowler的代表作。采用模式的形式系統(tǒng)總結(jié)了業(yè)界多年積累的經(jīng)驗(yàn),被稱為企業(yè)級(jí)應(yīng)用開(kāi)發(fā)領(lǐng)域的圣經(jīng)”,出版以來(lái)一直暢銷不衰,至今仍然無(wú)可替代。作者在精彩地闡述了企業(yè)應(yīng)用開(kāi)發(fā)設(shè)計(jì)中的核心原則基礎(chǔ)上。詳細(xì)、生動(dòng)地講述了51個(gè)模式并給出主流平臺(tái)(Java和.NET)中的應(yīng)用實(shí)例,更分析了許多相似模式之間的差異。提供了具體運(yùn)用和選擇這些模式的大量經(jīng)驗(yàn)之談,使你不僅知其然。更知其所以。這是一部軟件開(kāi)發(fā)領(lǐng)域不朽的經(jīng)典。任何一位真正的軟件開(kāi)發(fā)人員都不可錯(cuò)過(guò)。隨著信息技術(shù)的廣泛應(yīng)用。系統(tǒng)需要處理的數(shù)據(jù)量越來(lái)越大,企業(yè)級(jí)軟件開(kāi)發(fā)已經(jīng)漸成主流,而開(kāi)發(fā)人員面臨的困難與挑戰(zhàn)也是顯而易見(jiàn)的。更糟糕的是,這一領(lǐng)域的資料一直非常缺乏。
圖書封面
圖書標(biāo)簽Tags
無(wú)
評(píng)論、評(píng)分、閱讀與下載
企業(yè)應(yīng)用架構(gòu)模式 PDF格式下載