Object.keys()配合indexof 判断对象的可以是否存在某个key

14 篇文章 0 订阅
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Table of Contents Preface ..................................................................... xi 1. The Big Picture ......................................................... 1 What Is Enterprise? 1 Growing Slowly 3 Understanding All the Pieces 5 Persistence Layer 5 Application Layer 8 Caching Layer 11 Messaging System 16 Web Server 16 Firewall 16 2. Organizing with Plugins ................................................ 19 Benefits 20 Writing Your Own Plugins 21 Core Enhancements 22 Custom Extensions 26 Deployment 30 svn:externals 30 3. Organizing with Modules ................................................ 31 Files and Directories 32 Module Boundaries for Namespacing 33 ActiveRecord Associations Between Modules 34 Reciprocal Relationships 35 Modules Presage Services 36 Ensuring Proper Load Order 38 Exercises 39 Refactor Steps 39 High-Level Module Refactor 39 Detangling Utility Methods 40 v 4. Database As a Fortress .................................................. 41 Your Database Is an Application, Too 42 “One Framework to Rule Them All” 42 “No One in My Company Will Ever Write a Bug” 42 “This Rails Application Is the Only Application on Earth” 43 Sit Atop the Shoulders of Giants 43 Choosing the Right RDBMS 44 A Note on Migrations 44 Dispelling Myths 46 Operations and Reporting 47 5. Building a Solid Data Model ............................................. 51 Theatre Tickets 51 Starting Simple 52 Constraints 54 Mythbusting 63 Referential Integrity 64 Intro to Indexing 70 6. Refactoring to Third Normal Form ........................................ 73 Third Normal Form 73 Timing Is Key 77 Refactoring: Inheritance and Mixins 78 Exercises 82 Refactor Steps 82 7. Domain Data .......................................................... 85 Dealing with Zip Codes 87 Strategy Pattern with Domain Tables 89 Refactor from Day One 93 8. Composite Keys and Domain Key/Normal Form ............................. 95 Why Composite Natural Keys Matter 97 Spotting Composite Keys 99 Atop the Shoulders of… 101 Migrating to Domain Key/Normal Form 102 Using Composite Keys in Rails 105 Deferrable Foreign Key Constraints 109 Understanding the Trade-offs 111 Exercises 113 Refactor Steps 113 Single Column Refactor 114 vi|Table of Contents Multiple Column Refactor 115 9. Guaranteeing Complex Relationships with Triggers ........................ 117 Constraint Checking with Triggers 117 Anatomy of a PL/pgSQL Function 121 10. Multiple Table Inheritance ............................................. 127 The Problem 127 What Is Polymorphism? 129 Inheritance and Persistence 131 Single Table Inheritance 132 Multiple Table Inheritance 133 XOR on Columns 135 Elegant MTI in Rails 137 Factory Classes 143 Exercises 144 Refactor Steps 145 Refactoring STI 145 Refactoring: polymorphic => true 145 11. View-Backed Models .................................................. 147 Database Views 148 Creating a View 149 Basing a Model on a View 149 Considerations 150 Insert, Update, Delete 151 References and Constraints 152 Indexing 153 Exercises 153 Refactor Steps 154 12. Materialized Views .................................................... 155 Materialized View Principles 156 A View to Materialize 157 Getting into Form 158 The Target Table 160 Refresh and Invalidation Functions 161 Time Dependency 163 Who Pays the Price? 165 Triggered Refreshes and Invalidations 168 Movie Showtimes 169 Hiding the Implementation with the Reconciler View 174 Periodic Refreshes 177 Table of Contents|vii Cache Indexes 178 Results 179 Cascading Caches 180 Exercises 180 13. SOA Primer .......................................................... 183 What Is SOA? 183 Why SOA? 186 Shared Resources 187 Reduce Database Load 190 Scalability II: Caching Is Tricky 196 Reduce Local Complexity 197 In Summary 200 Exercises 200 14. SOA Considerations ................................................... 201 Service Considerations 201 Implementation Details Are Hidden 202 API Is Accessible 204 API Design Best Practices 205 Send Everything You Need 205 Limit Round Trips 207 Look for Opportunities for Parallelization 209 Send as Little as Possible 210 REST Versus XML-RPC Versus SOAP 212 XML-RPC 212 SOAP 214 15. An XML-RPC Service ................................................... 217 ActionWebService and Rails 2.0 217 Creating an Abstraction Barrier 218 ActiveRecord As the Physical Model Layer 218 The Object Model Layer 220 Defining the API 225 More Testing 230 The Client Plugin 232 Shared Code 234 The Client Singleton 234 Integration Testing 236 16. Refactoring to Services ................................................ 239 An Orders Service 239 Integrating with the MoviesService 251 viii|Table of Contents Other Considerations 253 MoviesService Object Model 254 Putting It All Together 265 17. REST Primer .......................................................... 267 REST Basics 267 Resources and Verbs 267 Hardware Is Part of the Application 269 Mapping REST to SOA 270 Mapping to CRUD 270 Different Clients, One Interface 272 HTTP+POX 274 Defining a Service Contract 274 REST Clients in Ruby 276 The Way the Web Was Meant to Be Used 277 18. A RESTful Web Service ................................................. 279 Scoping the Problem 279 Tools 281 MoviesWebService 284 Resources Server Implementation 285 Actions Server Implementation 288 A Client Implementation 289 19. Caching End to End .................................................... 295 Data Layer Caching, Revisited 296 The Snapshot 296 The Refresh Function 297 Invalidation Triggers 297 Indexing 298 Logical Model Caching 298 Considerations 305 Avoiding Rebuilding with Stale Data 308 Cache Indexes 312 Other Caching 313 Query Plan Caching 313 Database Query Caching 314 Rails Query Caching 315 Fragment, Action, and Page Caching 316 Index ..................................................................... 319

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值