没有合适的资源?快使用搜索试试~ 我知道了~
首页Rails 4th版:专为Rails 3.2开发者设计的敏捷web开发指南
"《敏捷Web开发与Rails 4th》(Agile Web Development with Rails 4th for Rails_3.2)是一本专为Rails 3.2版本定制的实用指南,旨在帮助开发者在快速变化的IT领域中取得成功。该书继承了其前作的传统,以其全面的视角和对Rails框架以及社区的深入理解,为初学者提供了坚实的基础。读者评论中,Mikel Lindsaar,Rails Core团队成员,Ruby Mail库的创建者,以及RubyX的负责人,高度赞扬了本书。他提到,这本书以一种愉快且易于记忆的方式介绍了Rails环境,特别强调了它对模型-视图-控制器(MVC)设计模式的清晰解释,通过实例让复杂概念变得简单易懂,消除了新开发者可能遇到的困惑。 另一方面,Ken Coar,一位开源软件倡导者和Apache开发者,也表示该书成功地保持了既能让新手享受阅读乐趣,又能在介绍Rails(及其底层语言Ruby)基础知识的同时,深入讲解平台的一些高级特性。他指出,这本书在初级教程和高级技术指南之间找到了很好的平衡,有效地填补了其他资源的空白,成为推荐给新Rails开发者的第一本书。 《敏捷Web开发与Rails 4th》对于希望进入或进一步提升Rails技能的开发者来说,是一部不可或缺的参考书籍。无论是初学者还是经验丰富的开发人员,都能从中找到适合自己的学习路径和实践指导,从而在敏捷开发的浪潮中保持竞争力。"
资源详情
资源推荐
Introduction
Ruby on Rails is a framework that makes it easier to develop, deploy, and
maintain web applications. During the months that followed its initial release,
Rails went from being an unknown toy to being a worldwide phenomenon,
and more important, it has become the framework of choice for the implemen-
tation of a wide range of so-called Web 2.0 applications.
Why is that?
Rails Simply Feels Right
First, a large number of developers were frustrated with the technologies they
were using to create web applications. It didn’t seem to matter whether they
were using Java, PHP, or .NET—there was a growing sense that their job was
just too damn hard. And then, suddenly, along came Rails, and Rails was
easier.
But easy on its own doesn’t cut it. We’re talking about professional developers
writing real-world websites. They wanted to feel that the applications they
were developing would stand the test of time—that they were designed and
implemented using modern, professional techniques. So, these developers
dug into Rails and discovered it wasn’t just a tool for hacking out sites.
For example, all Rails applications are implemented using the Model-View-
Controller (MVC) architecture. Java developers are used to frameworks such
as Tapestry and Struts, which are based on MVC. But Rails takes MVC further:
when you develop in Rails, you start with a working application, there’s a
place for each piece of code, and all the pieces of your application interact in
a standard way.
Professional programmers write tests. And again, Rails delivers. All Rails
applications have testing support baked right in. As you add functionality to
the code, Rails automatically creates test stubs for that functionality. The
framework makes it easy to test applications, and as a result, Rails applica-
tions tend to get tested.
report erratum • discuss
Rails applications are written in Ruby, a modern, object-oriented scripting
language. Ruby is concise without being unintelligibly terse—you can express
ideas naturally and cleanly in Ruby code. This leads to programs that are
easy to write and (just as important) are easy to read months later.
Rails takes Ruby to the limit, extending it in novel ways that make a program-
mer’s life easier. This makes our programs shorter and more readable. It also
allows us to perform tasks that would normally be done in external configu-
ration files inside the codebase instead. This makes it far easier to see what’s
happening. The following code defines the model class for a project. Don’t
worry about the details for now. Instead, just think about how much informa-
tion is being expressed in a few lines of code.
class Project < ActiveRecord::Base
belongs_to :portfolio
has_one :project_manager
has_many :milestones
has_many :deliverables, through: milestones
validates :name, :description, presence: true
validates :non_disclosure_agreement, acceptance: true
validates :short_name, uniqueness: true
end
Two other philosophical underpinnings keep Rails code short and readable:
DRY and convention over configuration. DRY stands for don’t repeat yourself:
every piece of knowledge in a system should be expressed in just one place.
Rails uses the power of Ruby to bring that to life. You’ll find very little dupli-
cation in a Rails application; you say what you need to say in one place—a
place often suggested by the conventions of the MVC architecture—and then
move on. For programmers used to other web frameworks, where a simple
change to the schema could involve them in half a dozen or more code
changes, this was a revelation.
Convention over configuration is crucial, too. It means that Rails has sensible
defaults for just about every aspect of knitting together your application.
Follow the conventions, and you can write a Rails application using less code
than a typical Java web application uses in XML configuration. If you need
to override the conventions, Rails makes that easy, too.
Developers coming to Rails found something else, too. Rails isn’t playing
catch-up with the new de facto web standards; it’s helping define them. And
Rails makes it easy for developers to integrate features such as Ajax and
RESTful interfaces into their code, because support is built in. (And if you’re
xviii • Introduction
report erratum • discuss
not familiar with Ajax and REST interfaces, never fear—we’ll explain them
later in the book.)
Developers are worried about deployment too. They found that with Rails you
can deploy successive releases of your application to any number of servers
with a single command (and roll them back equally easily should the release
prove to be somewhat less than perfect).
Rails was extracted from a real-world, commercial application. It turns out
that the best way to create a framework is to find the central themes in a
specific application and then bottle them up in a generic foundation of code.
When you’re developing your Rails application, you’re starting with half of a
really good application already in place.
But there’s something else to Rails—something that’s hard to describe.
Somehow, it just feels right. Of course, you’ll have to take our word for that
until you write some Rails applications for yourself (which should be in the
next forty-five minutes or so…). That’s what this book is all about.
Rails Is Agile
The title of this book is Agile Web Development with Rails. You may be sur-
prised to discover that we don’t have explicit sections on applying agile
practices X, Y, and Z to Rails coding.
The reason is both simple and subtle. Agility is part of the fabric of Rails.
Let’s look at the values expressed in the Agile Manifesto as a set of four
preferences:
1
• Individuals and interactions over processes and tools
• Working software over comprehensive documentation
• Customer collaboration over contract negotiation
• Responding to change over following a plan
Rails is all about individuals and interactions. There are no heavy toolsets,
no complex configurations, and no elaborate processes. There are just small
groups of developers, their favorite editors, and chunks of Ruby code. This
leads to transparency; what the developers do is reflected immediately in
what the customer sees. It’s an intrinsically interactive process.
Rails doesn’t denounce documentation. Rails makes it trivially easy to create
HTML documentation for your entire codebase. But the Rails development
1. http://agilemanifesto.org/. Dave Thomas was one of the seventeen authors of this
document.
report erratum • discuss
Introduction • xix
process isn’t driven by documents. You won’t find 500-page specifications at
the heart of a Rails project. Instead, you’ll find a group of users and developers
jointly exploring their need and the possible ways of answering that need.
You’ll find solutions that change as both the developers and the users become
more experienced with the problems they’re trying to solve. You’ll find a
framework that delivers working software early in the development cycle. This
software may be rough around the edges, but it lets the users start to get a
glimpse of what you’ll be delivering.
In this way, Rails encourages customer collaboration. When customers see
just how quickly a Rails project can respond to change, they start to trust
that the team can deliver what’s required, not just what has been requested.
Confrontations are replaced by “What if?” sessions.
That’s all tied to the idea of being able to respond to change. The strong, almost
obsessive, way that Rails honors the DRY principle means that changes to
Rails applications impact a lot less code than the same changes would in
other frameworks. And since Rails applications are written in Ruby, where
concepts can be expressed accurately and concisely, changes tend to be local-
ized and easy to write. The deep emphasis on both unit and functional testing,
along with support for test fixtures and stubs during testing, gives developers
the safety net they need when making those changes. With a good set of tests
in place, changes are less nerve-racking.
Rather than constantly trying to tie Rails processes to the agile principles,
we’ve decided to let the framework speak for itself. As you read through the
tutorial chapters, try to imagine yourself developing web applications this
way: working alongside your customers and jointly determining priorities and
solutions to problems. Then, as you read the more advanced concepts that
follow in Part III, see how the underlying structure of Rails can enable you to
meet your customers’ needs faster and with less ceremony.
One last point about agility and Rails: although it’s probably unprofessional
to mention this, think how much fun the coding will be.
Who This Book Is For
This book is for programmers looking to build and deploy web-based applica-
tions. This includes application programmers who are new to Rails (and
perhaps even new to Ruby) and ones who are familiar with the basics but
want a more in-depth understanding of Rails.
We presume some familiarity with HTML, Cascading Style Sheets (CSS), and
JavaScript, in other words, the ability to view source on web pages. You need
xx • Introduction
report erratum • discuss
not be an expert on these subjects; the most you will be expected to do is to
copy and paste material from the book, all of which can be downloaded.
How To Read This Book
The first part of this book makes sure you are ready. By the time you are
done with it, you will have been introduced to Ruby (the language), you will
have been exposed to an overview of Rails itself, you will have Ruby and Rails
installed, and you will have verified the installation with a simple example.
The next part takes you through the concepts behind Rails via an extended
example; we build a simple online store. It doesn’t take you one by one through
each component of Rails (“here is a chapter on models, here is a chapter on
views,” and so forth). These components are designed to work together, and
each chapter in this section tackles a specific set of related tasks that involve
a number of these components working together.
Most folks seem to enjoy building the application along with the book. If you
don’t want to do all that typing, you can cheat and download the source code
(a compressed tar archive or a zip file).
2
This download contains separate sets
of source code for Rails 3.0 Rails 3.1, and Rails 3.2. The files you will want
will be in a
rails32
directory. See the
README-FIRST
file for more details.
Part III, Rails in Depth, on page 253 surveys the entire Rails ecosystem. This
starts with the functions and facilities of Rails that you will now be familiar
with. It then covers a number of key dependencies that the Rails framework
makes use of that contribute directly to the overall functionality that the Rails
framework delivers. Finally, there is a survey of a number of popular plugins
that augment the Rails framework and make Rails an open ecosystem rather
than merely a framework.
Along the way, you’ll see various conventions we’ve adopted.
Ruby Tips
Although you need to know Ruby to write Rails applications, we realize
that many folks reading this book will be learning both Ruby and Rails
at the same time. You will find a (very) brief introduction to the Ruby
language in Chapter 4, Introduction to Ruby, on page 37. When we use a
Ruby-specific construct for the first time, we’ll cross-reference it to that
:name
↪
on page 38
chapter. For example, this paragraph contains a gratuitous use of
:name
,
a Ruby symbol. In formats that support margins, you’ll see a reference
to where symbols are explained.
2. http://pragprog.com/titles/rails4/source_code has the links for the downloads.
report erratum • discuss
Introduction • xxi
剩余475页未读,继续阅读
littlebear
- 粉丝: 1
- 资源: 9
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 十种常见电感线圈电感量计算公式详解
- 军用车辆:CAN总线的集成与优势
- CAN总线在汽车智能换档系统中的作用与实现
- CAN总线数据超载问题及解决策略
- 汽车车身系统CAN总线设计与应用
- SAP企业需求深度剖析:财务会计与供应链的关键流程与改进策略
- CAN总线在发动机电控系统中的通信设计实践
- Spring与iBATIS整合:快速开发与比较分析
- CAN总线驱动的整车管理系统硬件设计详解
- CAN总线通讯智能节点设计与实现
- DSP实现电动汽车CAN总线通讯技术
- CAN协议网关设计:自动位速率检测与互连
- Xcode免证书调试iPad程序开发指南
- 分布式数据库查询优化算法探讨
- Win7安装VC++6.0完全指南:解决兼容性与Office冲突
- MFC实现学生信息管理系统:登录与数据库操作
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功