Synopses & Reviews
What does it take to develop an enterprise application with Rails? Enterprise Rails introduces several time-tested software engineering principles to prepare you for the challenge of building a high-performance, scalable website with global reach. You'll learn how to design a solid architecture that ties the many parts of an enterprise website together, including the database, your servers and clients, and other services as well.
Many Rails developers think that planning for scale is unnecessary. But there's nothing worse than an application that fails because it can't handle sudden success. Throughout this book, you'll work on an example enterprise project to learn first-hand what's involved in architecting serious web applications.
With this book, you will:
- Tour an ideal enterprise systems layout: how Rails fits in, and which elements don't rely on Rails
- Learn to structure a Rails 2.0 application for complex websites
- Discover how plugins can support reusable code and improve application clarity
- Build a solid data model -- a fortress -- that protects your data from corruption
- Base an ActiveRecord model on a database view, and build support for multiple table inheritance
- Explore service-oriented architecture and web services with XML-RPC and REST
- See how caching can be a dependable way to improve performance
Building for scale requires more work up front, but you'll have a flexible website that can be extended easily when your needs change. Enterprise Rails teaches you how to architect scalable Rails applications from the ground up.
"Enterprise Rails is indispensable for anyone planning to build enterprise web services. It's one thing to get your service off the ground with a framework like Rails, but quite another to construct a system that will hold up at enterprise scale. The secret is to make good architectural choices from the beginning. Chak shows you how to make those choices. Ignore his advice at your peril."-- Hal Abelson, Prof. of Computer Science and Engineering, MIT
The book that helps Rails developers make the leap from simple websites to complex enterprise web applications. The Ruby on Rails web development framework has a low technical threshold to entry. Building web applications with it is relatively easy, but developing something complex is not. This book teaches new Rails developers how to design applications that scale to the enterprise level -- a must for those who want to increase their skills.
About the Author
Dan Chak's varied education in real-world web architecture gives him a unique perspective on the challenges of building rock-solid web applications. Dan has worked at Amazon.com, the world's biggest online retail store, where seemingly small technology problems become big ones due to enormous scale. Dan also directed software development at CourseAdvisor Inc., a Ruby on Rails startup company. A nearly instant success, CourseAdvisor was acquired by the Washington Post Company in October 2007. You can hear his thoughts on his blog at http://blog.chak.org.
Table of Contents
Preface; The Tale of Twitter; Speed Versus Scalability; What to Expect in This Book; Conventions Used in This Book; Using Code Examples; Safari® Books Online; Comments and Questions; Acknowledgments; Chapter 1: The Big Picture; 1.1 What Is Enterprise?; 1.2 Growing Slowly; 1.3 Understanding All the Pieces; Chapter 2: Organizing with Plugins; 2.1 Benefits; 2.2 Writing Your Own Plugins; 2.3 Deployment; Chapter 3: Organizing with Modules; 3.1 Files and Directories; 3.2 Module Boundaries for Namespacing; 3.3 Exercises; 3.4 Refactor Steps; Chapter 4: Database As a Fortress; 4.1 Your Database Is an Application, Too; 4.2 Sit Atop the Shoulders of Giants; 4.3 Operations and Reporting; Chapter 5: Building a Solid Data Model; 5.1 Theatre Tickets; Chapter 6: Refactoring to Third Normal Form; 6.1 Third Normal Form; 6.2 Refactoring: Inheritance and Mixins; 6.3 Exercises; 6.4 Refactor Steps; Chapter 7: Domain Data; 7.1 Dealing with Zip Codes; 7.2 Strategy Pattern with Domain Tables; 7.3 Refactor from Day One; Chapter 8: Composite Keys and Domain Key/Normal Form; 8.1 Why Composite Natural Keys Matter; 8.2 Atop the Shoulders of...; 8.3 Exercises; 8.4 Refactor Steps; Chapter 9: Guaranteeing Complex Relationships with Triggers; 9.1 Constraint Checking with Triggers; Chapter 10: Multiple Table Inheritance; 10.1 The Problem; 10.2 What Is Polymorphism?; 10.3 Inheritance and Persistence; 10.4 Factory Classes; 10.5 Exercises; 10.6 Refactor Steps; Chapter 11: View-Backed Models; 11.1 Database Views; 11.2 Basing a Model on a View; 11.3 Considerations; 11.4 Exercises; 11.5 Refactor Steps; Chapter 12: Materialized Views; 12.1 Materialized View Principles; 12.2 A View to Materialize; 12.3 The Target Table; 12.4 Refresh and Invalidation Functions; 12.5 Triggered Refreshes and Invalidations; 12.6 Hiding the Implementation with the Reconciler View; 12.7 Cache Indexes; 12.8 Results; 12.9 Cascading Caches; 12.10 Exercises; Chapter 13: SOA Primer; 13.1 What Is SOA?; 13.2 Why SOA?; 13.3 Exercises; Chapter 14: SOA Considerations; 14.1 Service Considerations; 14.2 API Design Best Practices; 14.3 REST Versus XML-RPC Versus SOAP; Chapter 15: An XML-RPC Service; 15.1 ActionWebService and Rails 2.0; 15.2 Creating an Abstraction Barrier; 15.3 More Testing; 15.4 The Client Plugin; Chapter 16: Refactoring to Services; 16.1 An Orders Service; 16.2 Integrating with the MoviesService; 16.3 MoviesService Object Model; 16.4 Putting It All Together; Chapter 17: REST Primer; 17.1 REST Basics; 17.2 Mapping REST to SOA; Chapter 18: A RESTful Web Service; 18.1 Scoping the Problem; 18.2 MoviesWebService; Chapter 19: Caching End to End; 19.1 Data Layer Caching, Revisited; 19.2 Logical Model Caching; 19.3 Other Caching; Colophon;