Fearless Refactoring: Rails controllers
by Andrzej Krzywda,Robert Pankowecki
Product details
File Size: 742 KB
Print Pages 页数: 324 pages
Simultaneous Device Usage: Unlimited
Publisher Finelybook 出版社: Arkency; 1 edition (27 April 2017)
Sold by 作者: Amazon Media EU S.à r.l.
Language 语言: English
ASIN: B0722L7D1M
Coding an app in Rails is always fun… for the first 3 months.
After some time,small,little things show up. The tests are no longer below 1 minute. Thin controllers are not really so thin anymore. Single Responsibility Principle is more of a not-so-funny joke than something that you can apply to your Rails models.
The build is taking so long at your machine,that you’ve almost automated it to immediately open Twitter,gmail,FB,HackerNews because nothing else can be done during the tests.
The speed of adding features slows down. It’s no longer fun to demonstrate new features to the Customer.
Your development plan for this release sounds so great. The users could be so happy with the new features. Your code could be so elegantly designed.
Is this really all you did this week?
“Can we agree that we keep controllers thin?” – the team starts to have those little arguments. The model callbacks are killing you. They started simple and now you just keep adding the conditionals.
How can we unit test if it’s all coupled together?
You’d love to unit test your models and controllers,but something doesn’t feel right about the endless section of mocks,stubs. User.should_receive(this),should_receive(that). It feels like repeating the code. What’s the point of such tests?
How do other Rails developers deal with such problems? Rails conventions are great at the start,after that you’re on your own.
This shouldn’t be so hard!
What if you could have speedy and intuitive conventions even after the app grew over time?
If you had conventions,you would spend less time moving code from one place to another,hoping that you will hide it somewhere. Less time arguing in the team means more features being delivered. More features means happy customers. We want to have happy users and customers.
What if you could add features as fast as at the start?
Fearless Refactoring: Rails Controllers – the e-book
It’s possible to have the same speed of delivering features over time and the “Fearless Refactoring: Rails Controllers” e-book will teach you how.
Make your application better,simply,step-by-step,under control.
I took what’s best from the popular architectures,got rid of things that don’t fit well with the Rails specifics and prepared recipes how to deal with a messy Rails code.
Who has time to stay on top of all the latest articles,ideas,and code samples? You need good,working,easy to change code.
This book is a step-by-step guide how to introduce a service layer in your existing Rails app. Every step is described in every detail,with code changes. All of that,so that you can safely refactor your codebase,even without a full test coverage.
Contents
Rails controllers
Refactoring recipes
Example: TripReservationsController#create
Example: logging time
Patterns
Testing
Related topics
Appendix
Bonus
在Rails中编写一个应用程序总是很有趣…在前3个月。
过了一段时间,小事情就出现了。测试不再低于1分钟。薄控制器不再那么瘦了。单一责任原则更像是一个不太可笑的笑话,而不是您可以将其应用于Rails模型。
这个版本在您的机器上花费了漫长的时间,您几乎可以自动将其自动化,立即打开Twitter,gmail,FB,HackerNews,因为在测试期间无法完成任何其他操作。
添加功能的速度减慢。向客户展示新功能已经不再有趣了。
您的这个发行版的发展计划听起来如此之大。用户可以对新功能感到满意。您的代码可能非常优雅的设计。
这真的是你这周做的吗?
“我们可以同意我们保持控制器薄吗? – 团队开始有这些小论据。模型回调正在杀死你。他们开始简单,现在你只是继续添加条件。
我们如何单元测试是否全部耦合在一起?
你会喜欢对你的模型和控制器进行单元测试,但是对于无休止的嘲讽,存根来说,一些东西根本就不是正确的。 User.should_receive(this),should_receive(that)。感觉像重复代码。这些测试的重点是什么?
其他Rails开发人员如何处理这些问题?在开始之后,Rails约定很棒,之后就是你自己。
这不应该那么难!
如果即使应用程序随着时间的推移而变得快速和直观,那怎么办?
如果你有惯例,你会花费更少的时间将代码从一个地方转移到另一个地方,希望你能将它隐藏在某个地方。在团队中减少时间意味着更多的功能被交付。更多功能意味着快乐的客户。我们希望有快乐的用户和客户。
如果您可以像开始一样快速添加功能,该怎么办?
无惧重构: Rails控制器 – 电子书
随着时间的推移,可以提供相同的功能交付速度,“无畏重建: Rails控制器”电子书将会教你如何。
使您的应用程序更好,简单地,一步一步,在控制之下。
我从流行的架构中获得了最好的结果,摆脱了与Rails的细节不兼容的事情,并准备了如何处理凌乱的Rails代码的食谱。
谁有时间留在所有最新的文章,想法和代码示例中?你需要好,工作,易于更改代码。
本书是如何在现有的Rails应用程序中引入服务层的分步指南。每个细节都会描述每一步,代码更改。所有这一切,使您可以安全地重构您的代码库,即使没有完整的测试覆盖。
Arkency Fearless Refactoring Rails controllers B0722L7D1M.azw3
Arkency Fearless Refactoring Rails controllers B0722L7D1M.pdf