![](https://csdnimg.cn/release/download_crawler_static/11545386/bg14.jpg)
How This Book Is Organized
In Chapter 1, we start out by taking a tour of an ideal enterprise systems layout, high-
lighting all of the elements that aren’t Rails, as well as noting the various places where
Rails can fit in.
The rest of this book can be divided principally into three major sections. The first deals
with the Rails framework itself. The next few chapters examine Rails itself. While Rails
gives you a Model-View-Controller (MVC) framework to start your projects, there is
much to be desired in terms of structuring and maintaining large applications. Chapters
2 and 3 fill these gaps. First, Chapter 2 dives into plugins, and how they can be used
to improve application clarity, while also encouraging you to write reusable code.
Chapter 3 introduces modules: what they are, and how and when to use them.
The next major section of the book, Chapters 4 through 12, deals with the database.
The database layer has not really been given its due in the Rails community, and Chap-
ter 4 begins by providing an overview of why it is such a critical part of your application.
In Chapter 5, we start building a data model for the example application we’ll work
with throughout this book: a sales website for movie tickets.
Although the schema we’ll design would be sufficient for most Rails books, we’ll see
quickly that it was a naive design. In Chapter 6, we refactor the schema to be in third
normal form (3NF). In Chapter 7, we’ll pick out a special type of table called a domain
table, and we’ll incorporate these tables naturally into a Rails application. In Chap-
ter 8, we’ll expose some more problems with our schema, then tighten it one step further
by moving from third normal form to domain key normal form. In Chapter 9, we’ll get
even more advanced with our introduction of stored procedures and triggers. We’ll use
them to enforce relationships that built-in database constraints cannot handle, giving
you the power to completely lock down your database schema.
Chapters 10 through 12 introduce some new database-related features to Rails devel-
opers. In Chapter 10, you’ll see how to base an ActiveRecord model on a database view.
This is useful for automatic filtering, or for filtering on data that’s not easily available
at the application layer. In Chapter 11, we’ll show how to build support for multiple
table inheritance in Rails. Rails supports single table inheritance, but it is not always
the right tool for the job. In Chapter 12, we’ll get our first taste of caching when we
materialize the view we created in Chapter 10, giving our view a huge boost in
performance.
Chapters 13 through 18 deal with service-oriented architectures and different techni-
ques for connecting systems together. In Chapter 13, we start by defining SOA, as well
as going over the scenarios when it is the right choice to solve a problem. Chapter 14
covers considerations that go into designing a service-oriented architecture, including
guidelines for designing an API. In Chapter 15, we build our first SOA service. In
Chapter 16, we build upon our accomplishments in Chapter 15, connecting two back-
end services together and testing them with the same interface a thin front-end client
would use. Chapter 17 is a critical exploration of REST, helpful for placing it in its
Preface | xix