- ホーム
- > 洋書
- > 英文書
- > Computer / Languages
Full Description
The Complete Guide to Avoiding and Fixing Common Rails 3 Code and Design Problems As developers worldwide have adopted the powerful Ruby on Rails web framework, many have fallen victim to common mistakes that reduce code quality, performance, reliability, stability, scalability, and maintainability. Rails (TM) AntiPatterns identifies these widespread Rails code and design problems, explains why they're bad and why they happen-and shows exactly what to do instead. The book is organized into concise, modular chapters-each outlines a single common AntiPattern and offers detailed, cookbook-style code solutions that were previously difficult or impossible to find. Leading Rails developers Chad Pytel and Tammer Saleh also offer specific guidance for refactoring existing bad code or design to reflect sound object-oriented principles and established Rails best practices. With their help, developers, architects, and testers can dramatically improve new and existing applications, avoid future problems, and establish superior Rails coding standards throughout their organizations. This book will help you understand, avoid, and solve problems withModel layer code, from general object-oriented programming violations to complex SQL and excessive redundancy Domain modeling, including schema and database issues such as normalization and serialization View layer tools and conventions Controller-layer code, including RESTful code Service-related APIs, including timeouts, exceptions, backgrounding, and response codes Third-party code, including plug-ins and gems Testing, from test suites to test-driven development processes Scaling and deployment Database issues, including migrations and validations System design for "graceful degradation" in the real world
Contents
Foreword xi Introduction xiiiAcknowledgments xviiAbout the Authors xixChapter 1: Models 1AntiPattern: Voyeuristic Models 2AntiPattern: Fat Models 14AntiPattern: Spaghetti SQL 31AntiPattern: Duplicate Code Duplication 50Chapter 2: Domain Modeling 73AntiPattern: Authorization Astronaut 74AntiPattern: The Million-Model March 79Chapter 3: Views 89AntiPattern: PHPitis 91AntiPattern: Markup Mayhem 107Chapter 4: Controllers 117AntiPattern: Homemade Keys 118AntiPattern: Fat Controller 123AntiPattern: Bloated Sessions 154AntiPattern: Monolithic Controllers 161AntiPattern: Controller of Many Faces 167AntiPattern: A Lost Child Controller 170AntiPattern: Rat's Nest Resources 180AntiPattern: Evil Twin Controllers 184Chapter 5: Services 189AntiPattern: Fire and Forget 190AntiPattern: Sluggish Services 195AntiPattern: Pitiful Page Parsing 197AntiPattern: Successful Failure 201AntiPattern: Kraken Code Base 207Chapter 6: Using Third-Party Code 211AntiPattern: Recutting the Gem 213AntiPattern: Amateur Gemologist 214AntiPattern: Vendor Junk Drawer 216AntiPattern: Miscreant Modification 217Chapter 7: Testing 221AntiPattern: Fixture Blues 223AntiPattern: Lost in Isolation 236AntiPattern: Mock Suffocation 240AntiPattern: Untested Rake 246AntiPattern: Unprotected Jewels 251Chapter 8: Scaling and Deploying 267AntiPattern: Scaling Roadblocks 268AntiPattern: Disappearing Assets 271AntiPattern: Sluggish SQL 272AntiPattern: Painful Performance 282Chapter 9: Databases 291AntiPattern: Messy Migrations 292AntiPattern: Wet Validations 297Chapter 10: Building for Failure 301AntiPattern: Continual Catastrophe 302AntiPattern: Inaudible Failures 306Index 311