- 浏览: 274730 次
- 性别:
- 来自: 尤溪
文章分类
最新评论
-
palytoxin:
我现在也发现是这样
关于分享 -
float2net:
Java社区,分享有利于提高。
关于分享 -
hz_qiuyuanxin:
头晕啊,啊邱
RSpec学习笔记 -
reyesyang:
...
关于分享 -
Hooopo:
一般实现map都先实现each
在 Ruby 中对树状结构(tree)进行 map 操作
晚上看到这个链接:http://ywencn.iteye.com/blog/605750
想起来之前自己草稿箱里还有下面这篇东东,也扔出来吧。刚好蜗牛翻译了后面部分。
传统的Rails开发(Traditional Rails Development)
Rails开发者通常使用由内而外的方式来开发应用程序。首先设计schema,并实现models。然后是controllers,最后是views和helpers。
Rails developers typically use an inside-out approach to developing
applications. You design the schema and implement models first, then
the controllers, and lastly the views and helpers.
这样的过程会使你在系统的其它部分存在之前创建一些你相像中的将会被用到的东西。这种开发过程一开始进展得很快,但是经常会导致你创建一些不能以你相像中的方式使用的东西,或者根本就用不到。当你意识到model并没有按照你设想的方式工作的时候,你要么回想一下你已经创建了些什么,要么就凑合着继续干。在这个关键时刻,你的良心可能会告诉你“做最简单的事”。
This progression has you build things you think other parts of the system
are going to need before those other parts exist. This approach
moves quickly at first, but often leads to building things that won’t be
used in the way you imagined, or perhaps won’t get used at all. When
you realize that the models don’t really do what you need, you’ll need
to either revisit what you’ve already built or make do. At this juncture,
you might hear your conscience telling you to “do the simplest thing.”
由内而外的开发方式中,“简单”的假象(The Illusion of "simple" with Inside-Out)
by Zach Dennis
我曾经做过一个显示用户事件(events)的应用程序。采用由内而外的方式开发,我们创建了一些我们认为足够描述应用程序的models,包括一些按照一系列用户的条件查找events的自定义搜索功能。当我们到了实现views的时候,我们认识到我们需要根据一些额外的条件来过滤events的列表:event是属于user还是属于user所在的group?user的身份是admin吗?
I once worked on an application that had to display events to a user.
Working inside-out, we had built several of the models that we felt
adequately represented the application, including some custom search
functionality that would find events based on a set of criteria from the
user. When we got to implementing the views we realized that we needed
to filter the list of events based on some additional criteria. Did the event
belong to the user or to a group the user belonged to? Was the user an
admin?
我们已经建立起了events和users、groups的关联,与其回头修改自定义搜索功能,看起来不如利用我们已经建立的东西来得简单。于是,我们把那些检查条件的代码添加到了views上,而不是重构model(refactoring the model)来提供额外的过滤规则。然后我们重构了页面,把这些检查代码提取到了helper module中,错误的减轻了我们把逻辑放入views的罪恶感。对于这个决定我们当时觉得还不错,我们认为自己是实用主义的(pragmatic),做的是最简单的事(the "simplest thing")。
We had already set up the associations for events belonging to users and
groups. Rather than go back and change the custom search functionality,
it seemed simpler to take advantage of what we had already built. So
instead of refactoring the model to support the additional filtering, we
added those checks in the views. Afterwards we refactored the view,
extracting the checks to a method in a helper module, erroneously easing
our guilt over putting logic in a view. We felt good at the time about the
decision. We were being pragmatic and doing the “simplest thing.”
随着时间的推移,我们遇到许多类似的情况,并且做出了同样的决定。不久,这个程序在难以重用和使用的地方到处隐藏着这种“简单”。最后我们确实需要在程序的其它地方重用一部分逻辑,但是这(重用)已经再也不简单了。现在我们似乎不得不权衡这3种罪行并从中做出选择:为了重用强制使用一些不优雅的方法访问逻辑、复制逻辑或者回头在程序上做一个费时的外科手术,使它更容易使用。
Over time, we were presented with similar situations and made similar
decisions. Before long the application had all of this “simple-ness” tucked
away in places where it was very difficult to re-use and work with. We did
end up needing to re-use some of this logic in other parts of the
application, but it wasn’t simple any longer. Now it felt like we had to
choose between the lesser of three evils: force some awkward way of
accessing the logic for re-use, duplicate the logic, or go back and perform
time-consuming surgery on the application to make it easier to work with.
从models到views的构建顺序意味着你将基于你认为你需要的东西写代码。讽刺的是,当你专注于UI的时候,你才会发现你在modles上真正需要的是什么,但到那个时候,已经有了一群开发好了、重构过的并且被很好的测试过的的支持代码(supporting code)等着你使用(我的理解是,这些已经写好的“支持代码”当中,往往有些你最后用不到,或者不能按照实际的需求来工作。也就是说,自底向上——文中的说法是由内而外——的开发比较脱离需求,是基于假设的开发过程。这里边如此的强调自顶向下,我就不明白为啥论坛上老有人说TDD必须是自底向上的。比如这个:http://www.iteye.com/topic/480096,再比如:http://www.iteye.com/topic/583164#1369471,那真的是TDD吗?)。
Building from the models out to the views means writing code based
on what you think you’re going to need. Ironically, it’s when you focus
on the UI that you discover what is really needed from the models,
and at that point there’s already a bunch of supporting code developed,
refactored, and well tested—ready to be used.
实事证明,你可以通过由外到内的开发方式来减缓这些问题,并且建立起你真正需要的而不是你假设你需要的……的……的东西。
It turns out that you can alleviate these issues and build what you need
rather than building what you think you need by working Outside-In.
由外到内的Rails开发(Outside-In Rails Development)
由外到内的Rails开发则是把由内而外的开发过程倒过来。按从views到models的顺序开发,而不是从models到views。
Outside-in Rails development is like standing the traditional inside-out
approach on its head. Instead of working from the models out to views,
you work from the views in toward the models.
这种方式由客户认可的标准来驱动开发,是更直接的方式。这种方式会使你在项目的早期处于一个更好的位置来更好的发现程序中的对象和接口,同时基于真正的需求做出设计决策。
This approach lets customer-defined acceptance criteria drive development
in a much more direct way. It puts you in a better position to
discover the objects and interfaces earlier on in the process and make
design decisions based on real need.
#
The BDD cycle with Rails is the same Outside-In process you’d use with
any other framework (or no framework), web, desktop, command line,
or even an API. The cycle depicted in Figure 17.1, on the following page
is the same cycle depicted in Figure 1.1, on page 19, but we’ve added
some detail to help you map it to Rails.
以一个场景开始。确保你能够清晰的理解这个场景以及它该如何工作,包括……接:http://ywencn.iteye.com/blog/605750
Start with a scenario. Make sure you have a clear understanding
of the scenario and how it is expected to work, including how the
UI should support a user interacting with the app (see the sidebar
on page 201)..........
想起来之前自己草稿箱里还有下面这篇东东,也扔出来吧。刚好蜗牛翻译了后面部分。
传统的Rails开发(Traditional Rails Development)
Rails开发者通常使用由内而外的方式来开发应用程序。首先设计schema,并实现models。然后是controllers,最后是views和helpers。
Rails developers typically use an inside-out approach to developing
applications. You design the schema and implement models first, then
the controllers, and lastly the views and helpers.
这样的过程会使你在系统的其它部分存在之前创建一些你相像中的将会被用到的东西。这种开发过程一开始进展得很快,但是经常会导致你创建一些不能以你相像中的方式使用的东西,或者根本就用不到。当你意识到model并没有按照你设想的方式工作的时候,你要么回想一下你已经创建了些什么,要么就凑合着继续干。在这个关键时刻,你的良心可能会告诉你“做最简单的事”。
This progression has you build things you think other parts of the system
are going to need before those other parts exist. This approach
moves quickly at first, but often leads to building things that won’t be
used in the way you imagined, or perhaps won’t get used at all. When
you realize that the models don’t really do what you need, you’ll need
to either revisit what you’ve already built or make do. At this juncture,
you might hear your conscience telling you to “do the simplest thing.”
由内而外的开发方式中,“简单”的假象(The Illusion of "simple" with Inside-Out)
by Zach Dennis
我曾经做过一个显示用户事件(events)的应用程序。采用由内而外的方式开发,我们创建了一些我们认为足够描述应用程序的models,包括一些按照一系列用户的条件查找events的自定义搜索功能。当我们到了实现views的时候,我们认识到我们需要根据一些额外的条件来过滤events的列表:event是属于user还是属于user所在的group?user的身份是admin吗?
I once worked on an application that had to display events to a user.
Working inside-out, we had built several of the models that we felt
adequately represented the application, including some custom search
functionality that would find events based on a set of criteria from the
user. When we got to implementing the views we realized that we needed
to filter the list of events based on some additional criteria. Did the event
belong to the user or to a group the user belonged to? Was the user an
admin?
我们已经建立起了events和users、groups的关联,与其回头修改自定义搜索功能,看起来不如利用我们已经建立的东西来得简单。于是,我们把那些检查条件的代码添加到了views上,而不是重构model(refactoring the model)来提供额外的过滤规则。然后我们重构了页面,把这些检查代码提取到了helper module中,错误的减轻了我们把逻辑放入views的罪恶感。对于这个决定我们当时觉得还不错,我们认为自己是实用主义的(pragmatic),做的是最简单的事(the "simplest thing")。
We had already set up the associations for events belonging to users and
groups. Rather than go back and change the custom search functionality,
it seemed simpler to take advantage of what we had already built. So
instead of refactoring the model to support the additional filtering, we
added those checks in the views. Afterwards we refactored the view,
extracting the checks to a method in a helper module, erroneously easing
our guilt over putting logic in a view. We felt good at the time about the
decision. We were being pragmatic and doing the “simplest thing.”
随着时间的推移,我们遇到许多类似的情况,并且做出了同样的决定。不久,这个程序在难以重用和使用的地方到处隐藏着这种“简单”。最后我们确实需要在程序的其它地方重用一部分逻辑,但是这(重用)已经再也不简单了。现在我们似乎不得不权衡这3种罪行并从中做出选择:为了重用强制使用一些不优雅的方法访问逻辑、复制逻辑或者回头在程序上做一个费时的外科手术,使它更容易使用。
Over time, we were presented with similar situations and made similar
decisions. Before long the application had all of this “simple-ness” tucked
away in places where it was very difficult to re-use and work with. We did
end up needing to re-use some of this logic in other parts of the
application, but it wasn’t simple any longer. Now it felt like we had to
choose between the lesser of three evils: force some awkward way of
accessing the logic for re-use, duplicate the logic, or go back and perform
time-consuming surgery on the application to make it easier to work with.
从models到views的构建顺序意味着你将基于你认为你需要的东西写代码。讽刺的是,当你专注于UI的时候,你才会发现你在modles上真正需要的是什么,但到那个时候,已经有了一群开发好了、重构过的并且被很好的测试过的的支持代码(supporting code)等着你使用(我的理解是,这些已经写好的“支持代码”当中,往往有些你最后用不到,或者不能按照实际的需求来工作。也就是说,自底向上——文中的说法是由内而外——的开发比较脱离需求,是基于假设的开发过程。这里边如此的强调自顶向下,我就不明白为啥论坛上老有人说TDD必须是自底向上的。比如这个:http://www.iteye.com/topic/480096,再比如:http://www.iteye.com/topic/583164#1369471,那真的是TDD吗?)。
Building from the models out to the views means writing code based
on what you think you’re going to need. Ironically, it’s when you focus
on the UI that you discover what is really needed from the models,
and at that point there’s already a bunch of supporting code developed,
refactored, and well tested—ready to be used.
实事证明,你可以通过由外到内的开发方式来减缓这些问题,并且建立起你真正需要的而不是你假设你需要的……的……的东西。
It turns out that you can alleviate these issues and build what you need
rather than building what you think you need by working Outside-In.
由外到内的Rails开发(Outside-In Rails Development)
由外到内的Rails开发则是把由内而外的开发过程倒过来。按从views到models的顺序开发,而不是从models到views。
Outside-in Rails development is like standing the traditional inside-out
approach on its head. Instead of working from the models out to views,
you work from the views in toward the models.
这种方式由客户认可的标准来驱动开发,是更直接的方式。这种方式会使你在项目的早期处于一个更好的位置来更好的发现程序中的对象和接口,同时基于真正的需求做出设计决策。
This approach lets customer-defined acceptance criteria drive development
in a much more direct way. It puts you in a better position to
discover the objects and interfaces earlier on in the process and make
design decisions based on real need.
#
The BDD cycle with Rails is the same Outside-In process you’d use with
any other framework (or no framework), web, desktop, command line,
or even an API. The cycle depicted in Figure 17.1, on the following page
is the same cycle depicted in Figure 1.1, on page 19, but we’ve added
some detail to help you map it to Rails.
以一个场景开始。确保你能够清晰的理解这个场景以及它该如何工作,包括……接:http://ywencn.iteye.com/blog/605750
Start with a scenario. Make sure you have a clear understanding
of the scenario and how it is expected to work, including how the
UI should support a user interacting with the app (see the sidebar
on page 201)..........
发表评论
-
我也有自己要做的事!
2012-11-27 22:40 15管理人员似乎总会在看 ... -
一个讨论反模式
2011-09-17 15:14 1887症状: DB网员工A:我们应该这么做。 DB网员工B:为什么呢 ... -
对TDD/BDD的一些理解
2010-10-13 08:35 0以下内容均为我自己对T ... -
TDD/BDD问与答。
2010-09-08 11:44 0gigix ——什么是测试驱动开发: 看“测试驱动开发”这个 ... -
谈谈性能
2010-05-18 15:58 0以下言论收集于javaeye论 ... -
伪代码法
2010-04-25 19:16 25012011-05-11 补充一个链接 ... -
点点滴滴
2010-01-23 23:21 0长度超过1个的链式调用经常可以封装起来,例如: 在contro ... -
聊天记录,放这记一下。
2010-01-03 16:59 0(15时24分08秒) Kadvin: 其实写Test Cas ... -
o6z说code review
2009-12-17 12:38 1645ozzzzzz在agilechina上 写道 ... -
意外收获,关于mock和stub。
2009-09-17 14:25 10236记录一些自己的想法, ... -
从AWDWR中的depot思考软件设计
2009-08-18 17:52 1399一般对购物车简单的描述会是这样的(其实就是AWDWR中的那个d ... -
回复: 以截拳道看"太极模式"
2009-04-13 01:51 272wendong007 写道我们编程的时候不要老想着这样那样的模 ... -
回复: 我对针对接口编程的浅解
2009-03-30 00:18 1221其实吧,接口这东西。。我举个例子来说,你如果正在写业务代码,考 ... -
“山寨”框架3宗罪
2009-03-22 23:44 4096刚看了个自制框架的帖 ... -
TDD中,产品代码的接口是如何产生的?我的理解
2009-01-08 01:44 18452010年10月13日 再次补充 ... -
初学TDD,小记
2008-10-25 18:25 1580回头看了看。。本篇纯属误导人之作。 我正在学TDD,这算是 ...
相关推荐
行为驱动开发(BDD)是一种敏捷软件开发的技术,它鼓励软件项目中的开发者、质量保证和非技术或商业参与者之间的协作。Cucumber是一个支持行为驱动开发的工具,它允许业务分析师、测试人员和开发者以一种他们都能...
Title: The Cucumber for Java Book: Behaviour-Driven Development for Testers and Developers Author: Aslak Hellesoy, Matt Wynne, Seb Rose Length: 338 pages Edition: 1 Language: English Publisher: ...
With this book you’ll also discover how to design simple and easily maintainable code, work with mocks, utilise behaviour-driven development, refactor old legacy code, and release a half-finished ...
"Behaviour Driven Development" is about writing software that matters. It is an approach to agile software development that takes cues from Test Driven Development, Domain Driven Design, and ...
With this book you'll also discover how to design simple and easily maintainable code, work with mocks, utilise behaviour-driven development, refactor old legacy code, and release a half-finished ...
在Unity引擎的游戏开发中,行为树(Behaviour Tree)已经成为控制角色智能行为的重要工具。"Behaviour Machine Pro",正如其标题所示,是Unity平台上的一个顶尖行为树插件,被誉为游戏与项目开发的必备神器。这个...
《RSpec Book》是关于行为驱动开发(BDD)的一本权威书籍,特别是针对Rspec这一Ruby语言的测试框架。本书的最新版包含了Cucumber章节,使得读者能够更好地理解和实践BDD理念。 行为驱动开发(BDD)是一种软件开发...
The RSpec Book: Behaviour Driven Development with Rspec, Cucumber, and Friends beta 15版本,包括Rails 3 beta的内容
非等温自催化模型中的时空行为是指在自催化反应过程中,温度的非均一性对化学反应动力学和扩散行为产生影响的情况。这种现象在实验和数值模拟中都得到了广泛的研究。非等温自催化模型关注的是在化学反应中由于反应热...
### Erlang Supervisor Behaviour详解 #### 一、Erlang Supervisor简介与作用 Erlang Supervisor是Erlang四大Behaviour之一,主要负责管理监控树(supervision tree)中的子进程,确保系统的稳定运行。在Erlang...
Behaviour Designer Ver.1.6.2 最新版 官方下载 新鲜出炉 仅供学习使用 适用版本Unity5.6.0以上
### 动态系统行为探索:并行与分布式仿真系统 #### 标题解析 标题“Modeling and Simulation: Exploring Dynamic System Behavior”(建模与仿真:探索动态系统行为)指出本文档的主要研究方向是通过建模和仿真技术...
gimbal_behaviour.c
桥梁结构
从给定的文件信息中,我们可以提取并详细解释以下知识点: ### 标题中的知识点: - **Tribological behavior and wear mechanism of MoS2–Cr coatings**:说明文档主要研究二硫化钼(MoS2)和铬(Cr)组成的涂层在不同...
Behaviour Machine is a visual scripting plugin that enables the design of Hierarchical Finite State Machines and Behaviour Trees in the Unity game engine. With Behaviour Machine, designers and artists...
FeCoNiCuSnx高熵合金腐蚀性能,李建忱,张翠,FeCoNiCuSnx 高熵合金为单一的FCC固溶体。当Sn含量达0.09%时,出现少量的BCC相。FeCoNiCuSnx 合金在碱性溶液中有宽化的钝化区,而在氯化钠溶�
《用户行为数据分析:GrowingIO 实战指南》是一本深度探讨如何利用用户行为数据来驱动企业增长的专业书籍。书中详尽地介绍了用户行为分析的重要性和实施步骤,旨在帮助互联网及互联网+企业的相关人员建立全面的数据...
unity BehaviourTree流程控制插件
Breeze - Advanced Character Behaviour v1.02