黄瓜和脚手架

发布于 2024-11-28 05:02:43 字数 440 浏览 2 评论 0原文

我刚刚学习 Cucumber 和 BDD 方式来创建应用程序。 当我开始通过 http://guides.rubyonrails.org/ 学习 Rails 时,我使用脚手架为我的控制器和视图生成 CRUD 功能和骨架。与 PHP 自定义编写代码相比,这种方式可以大大加快速度。但是,当我查看 Cucumber 截屏视频、阅读有关 BDD 的评论或查看 https://github.com/diaspora 时/diaspora 源代码 - 它们都不使用脚手架。当我尝试编写测试时,我花了很长时间来编写和测试,但我知道脚手架生成的基本代码是不会崩溃的。这就是我的问题:如何在 BDD 和脚手架速度之间做出妥协?

I'm just learning Cucumber and BDD way to create applications.
When I'm start learning rails by http://guides.rubyonrails.org/ I'm use scaffolding to generate CRUD functionality and skeleton to my controllers and views. This way give me large speed up versus PHP custom writing code. But when I'm looking to cucumber screencasts, reading comments about BDD, or looking to https://github.com/diaspora/diaspora source code - all of them doesn't use scaffold. When I try to write tests I'm spent long time to compose and test, but I know that the basic code which generated by scaffold isn't crashable. That is my question: How give compromise between BDD and scaffold speed?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

别想她 2024-12-05 05:02:43

当您了解 TDD/BDD 周期时,脚手架是一个很好的起点。我发现,当我第一次阅读 RSpec Book 时,我很困惑要做什么何时使用以及为什么使用!然后出现了Cucumber Book,它会帮助你更多一点,因为它会带你了解步伐有点慢(尽管这本书仍处于测试阶段,但这是一个很棒的资源)。

另一个有用的资源是 Sarah Mei 的一篇博客文章,名为“

当然,通常存在这样的争论:“真正的程序员”不应该使用脚手架。对于大规模生产应用来说可能确实如此。现实是我们都必须学习并从某个地方开始,Rails 也不例外;它是一个大型框架,一旦添加 RSpec + Cucumber,其广度和深度就会快速增长。

The scaffold serves as a good starting point whilst you are getting to know the TDD/BDD cycle. I found that when I first read the RSpec Book that it was confusing with what to use when and why ! Then along came the Cucumber Book which helps a little more since it takes you through the steps a little slower (although the book is still in beta, but a fantastic resource).

One other great resource that helped was a blog post by Sarah Mei called "Outside-in BDD: How?". What is nice about this post is the discussion of the flow and style that you use as a developer. This was useful since it puts some context around the style of doing BDD and not just a re-hash of a basic example.

Of course there is the usual debate that 'real programmers' shouldn't use the scaffold. That may be true for a large scale, production application. The reality is that we all have to learn and start somewhere and Rails is no exception; it's a large framework and once you add in RSpec + Cucumber the breadth and depth grows very fast.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文