没有合适的资源?快使用搜索试试~ 我知道了~
首页Rails 5敏捷web开发经典指南:实战与推荐
Rails 5敏捷web开发经典指南:实战与推荐
4星 · 超过85%的资源 需积分: 31 53 下载量 196 浏览量
更新于2024-07-18
1
收藏 15.72MB PDF 举报
"《Agile Web Development with Rails 5》是一本备受推崇的英文原版IT教材,专为快速掌握Ruby on Rails(简称Rails)框架而设计。尽管出版多年,其内容依然具有高度相关性和实用性。这本书由Prathamesh Sonpatki、Jeff Holland、Charles Stran等业内专家推荐,他们赞誉它组织结构清晰,引导读者通过实例项目(如demoproject)学习,使初学者能轻松理解同时领略框架带来的开发价值。 在第一部分,作者带领读者逐步构建应用程序,注重实践操作,这对于快速上手Rails至关重要。Part III则深入探讨了许多关键主题,进一步提升开发者的技术深度。Jeff Holland作为高级软件工程师表示,这是一本无论对哪种编程语言的web开发都是极佳入门指南的书籍。 Charles Stran,产品工程与设计总监,强调这是他在与Rails合作过程中反复参考的经典之作,强调了该书在Rails领域的权威地位。Stephen Orr,作为Siftware的资深开发者,虽然在电子版和纸质书中留白以保持页码一致,但并未掩盖他对本书的高度评价。 《Agile Web Development with Rails 5》是一本既能帮助新手快速入门,又能满足经验丰富的开发者深化理解的实用教程,是Rails开发者必备的学习资料。无论是想进入Web开发领域,还是寻求技术提升的开发者,都能从中获益匪浅。通过阅读和实践书中的内容,读者将能够熟练运用Rails进行高效敏捷开发,适应不断变化的IT行业需求。"
资源详情
资源推荐
learning curve. So while we’re still watching this, for the moment it remains
an advanced topic beyond the scope of this book. We’re confident that
those who find themselves needing this feature can find the material they
need online. More on this point later.
Turbolinks 3
Turbolinks 3, although technically a separate package, is something that
Rails applications depend on by default, so it might as well be considered
part of the core. So why isn’t it covered more?
Mostly because it’s too successful at being transparent. When it works,
you don’t have to think about it. It just makes things faster.
Prior editions of this book covered disabling Turbolinks when it got in the
way. This turns out not to be necessary for the scenarios in this book, so
Turbolinks has less coverage in this edition than in prior editions.
So what changes got comparatively more coverage?
• By far the change with the biggest impact is that all of the
rake
tasks have
been replaced by the
rails
command. For example,
rake test
has become
rails
test
. For the most part, this was a global search and replace. But what’s
notable is that it isn’t explicitly covered, because the target audience for
the book is people new to Rails, and spending a lot of time covering the
way things used to be isn’t helpful to them.
• Controller tests now are integration tests instead of essentially unit tests.
This also means that methods such as
assigns()
have been moved out of
Rails (but can still be added via the
rails-controller-testing
gem). Most definitely
not a simple search and replace, this change required many tests to be
completely rewritten. But again, the changes aren’t highlighted—the focus
of the book is on what works now.
• Synchronous mail delivery has been replaced by asynchronous mail
delivery. This is largely transparent to the application but required some
changes to the tests.
There were other changes. For example,
belongs_to
is now required by default.
This required one existing relationship to be changed to be explicitly marked
as optional. But the preceding features affected more pages.
So what does this mean to you, the reader?
It’s important to understand this book in the context of the web as it exists
today. The first edition of this book predated Stack Overflow, Hacker News,
GitHub, and many other resources that are available now. These days, if you
report erratum • discuss
Preface to the Rails 5 Edition • xv
know the right question to ask and know how to recognize the right answer,
you can go far.
This book embraces that reality. It realizes that the answers for Rails questions
are out there. It understands that the incubation period for Rails 5 was longer
than usual (Rails 4.2 was released in December of 2014, and Rails 4.0 was
released in June of 2013), so a plethora of documentation and answers (some
bad, most good, and some excellent) for new features in Rails is available.
What’s important to note is that you’re more likely to be led astray by slightly
stale examples of controller tests than you are by documentation of early
betas of Action Cable.
So if this book gives you the basics to build on, helps you phrase the right
answers, and helps you weed out the conflicting answers that you can find
online, then it’s done its job.
Before you proceed, a final word of caution. The Ruby language in general,
and the Rails web application framework in particular, tend to attract the
attention of people who are unrepentantly opinionated. And for some reason
this is particularly true when it comes to testing libraries. That’s fine; there’s
room for all. But be aware that the approach this book takes is to focus first
and foremost on the choices made by the Rails core team. Only when that’s
complete does it mention a few of the myriad choices available to you, and
how to find what you’re looking for.
Over time, you might find that you like one of those other choices better.
Should you come to that point, welcome to the club. You’ve become as opin-
ionated as the rest of us, and this book will have done its job.
Sam Ruby
rubys@intertwingly.net
September 2016
Preface to the Rails 5 Edition • xvi
report erratum • discuss
Acknowledgments
Rails is constantly evolving and, as it has, so has this book. Parts of the Depot
application were rewritten several times, and all of the text and code was
updated. The avoidance of features as they become deprecated has repeatedly
changed the structure of the book, as what was once hot became just lukewarm.
So, this book would not exist without a massive amount of assistance from
the Ruby and Rails communities. We had many helpful reviewers of drafts of
this edition:
Sage HamblinKosmas ChatzimichalisSefik Kanat Bolazar
Jeff HollandRod HiltonMichael Hansen
Nigel LowryAskarbek KarasaevBruce Jackon
Prathamesh SonpatkiNathan RuehsGraham Menhennitt
David WilburMasaki SuketaCharles Stran
Stephen Orr
Each edition of this book has been released as a beta book: early versions
were posted as PDFs, and people made comments online. And comment they
did; over time, more than fifty suggestions and bug reports were posted. The
vast majority ended up being incorporated, making this book immeasurably
more useful than it would otherwise have been. While thanks go out to all
for supporting the beta book program and for contributing so much valuable
feedback, one contributor in particular—Kosmas Chatzimichalis—went well
beyond the call of duty.
Finally, the Rails core team has been incredibly helpful, answering questions,
checking out code fragments, and fixing bugs—even to the point where part
of the release process includes verifying that new releases of Rails don’t break
the examples provided in this book.
Sam Ruby
report erratum • discuss
Introduction
Ruby on Rails is a framework that makes it easier to develop, deploy, and
maintain web applications. During the ten years since its initial release, Rails
went from being an unknown toy to being a worldwide phenomenon; more
important, it has become the framework of choice for the implementation of
a wide range of applications.
Why is that?
Rails Simply Feels Right
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 used
Java, PHP, or .NET—there was a growing sense that their jobs were 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, think about how much information
is being expressed in a few lines of code:
class Project < ApplicationRecord
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 one place. Rails
uses the power of Ruby to bring that to life. You’ll find little duplication 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 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 doesn’t merely
play catch-up with the de facto web standards; it helps define them. And
Rails makes it easy for developers to integrate features such as Ajax, RESTful
interfaces, and WebSockets into their code because support is built in. (And
if you’re not familiar with Ajax, REST interfaces, or WebSockets, never fear—
we’ll explain what these terms mean in Chapter 11, Task F: Add a Dash of
Ajax, on page 145 and REST: Representational State Transfer, on page 316.)
Introduction • xx
report erratum • discuss
剩余466页未读,继续阅读
yinkaisheng-nj
- 粉丝: 762
- 资源: 6231
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 贵州煤矿矿井水分类与处理策略:悬浮物、酸性与非酸性
- 醛固酮增多症肾上腺静脉采样对比:ACTH后LR-CAV的最优评估
- 开源云连接传感器监控平台:农业土壤湿度远程监测
- 母婴用品企业年度生产计划线性规划优化模型:实证与应用
- 井下智能变电站:Rogowski线圈电流检测系统的研发与性能验证
- 霍州矿区煤巷稳定性分析及支护策略
- ARM嵌入式系统远程软件更新方案:基于TFTP协议
- 煤炭选煤中汞分布规律与洗选脱汞效果
- 提升码垛机器人性能:拉格朗日动力学模型与滑模模糊控制的应用
- 增强现实技术提升学前手写教学:设计与开发案例
- 不规则工作面沉陷三角剖分算法提升与应用
- 卡尔曼滤波在瞬变电磁干扰压制中的应用研究
- 煤矿安全能力研究:理论与系统构建
- LonWorks总线技术在斜巷运输车辆定位与跑车防护中的应用
- 神东煤炭集团高效煤粉锅炉系统:节能环保新实践
- Ti/SnO2+Sb2Ox/PbO2电极分形维数与电催化性能研究
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功