如何使用 CRC 卡进行精心设计?
我一直想知道人们如何使用 CRC(班级责任协作)卡。 我在书中读到过它们,在互联网上找到了模糊的信息,但从未真正理解它们。 我认为有人应该制作一个 youtube 视频来展示 CRC 卡的会话,因为我的一本书描述它很难用文本表达,它应该“由已经掌握它的人来教授”。 遗憾的是,据我所知,这里没有人使用 CRC 卡,我想了解更多信息。
更新
任何显示人们详细说明此技术的视频链接将不胜感激。
I've always been wondering how people use CRC (class responsiblity collaboration) cards. I've read about them in books, found vague information on the internet, but never grasped it really. I think someone ought to make a youtube video showing a session with CRC cards, since one of my books described it as being very hard to formulate in text, that it should be "taught by someone who already masters it". Sadly, I know noone around here who uses CRC cards and I'd like to learn more.
UPDATE
Any links to videos showing people elaborating with this technique would be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
在他们的书中 对象设计:角色、职责和协作 发表于 2003 年 丽贝卡·维尔夫斯-布洛克 & Alan McKean 详细讨论了 CRC 卡。 他们真正强调了它对整个过程的影响,这应该是一种非常有触觉的体验,并且在尝试充实设计/需求时,它放松了人们绕过物理对象的思维。
该章的副标题表明,使用卡片是“探索性设计”阶段的一部分,因此它可能先于进行大量编码,但我认为您没有理由不在每次迭代中继续回到它们一个敏捷项目,提醒自己你认为自己要去哪里,并在需要时进行审查(当然作为一个团队)。
我似乎记得他们甚至建议在房间里传一个球,这样只有拿球的人才能发言,所以也许这与其说是 CRC 卡,不如说是让每个人都在一个房间里讨论角色和责任重要的对象?
如果您想阅读 CRC 卡的实际案例研究(当然还有 Kent 和 Ward 的原始论文),请查看 CRC 卡书。
In their book Object Design: roles, responsibilities, and collaborations published in 2003 Rebecca Wirfs-Brock & Alan McKean discuss CRC cards in some detail. They really emphasise the difference it makes to the whole procedure that this should be a very tactile experience and it loosens people's thinking to be passing round a physical object when trying to flesh out a design / requirement.
The sub-title of that chapter suggests that using the cards is a part of the 'exploratory design' phase so it probably comes prior to doing much coding, but I see no reason you wouldn't keep coming back to them in each iteration of an Agile project and reminding yourself where you thought you were going and reviewing that if need-be (as a group of course).
I seem to remember that they even suggest passing a ball around the room so that only the person that has the ball is allowed to speak, so perhaps it's not so much the CRC cards as the getting everyone in a room talking about roles and responsibilites of objects that matters?
If you'd like to read a case-study of CRC cards in action (in addition to Kent and Ward's original paper of course) then have a look at The CRC card book.
我会尝试给出答案。
因此,CRC 卡通常用于在面向对象的环境中进行建模,以便更好地理解必须开发的系统(但我想您已经知道了)。
CRC 卡出现在最后,即在实际实施之前。 达到该级别的不同步骤可能如下:
CRC 会议应该从头脑风暴会议开始,开发人员之间进行积极的讨论,并且应该在直接使用实际的索引卡。
我希望我能够以某种方式帮助你。
问候,
树里
I'll try to give an answer.
So CRC cards are generally used for modelling in a Object-Oriented environment to get a better understanding of the system that has to be developed (but that I think you'll know already).
CRC cards come at the very end, when you arrive just before the actual implementation. The different steps to reach that level could be the following:
A CRC session should start with a brainstorming meeting, having an active discussion among the developers and it should be performed on the actual index cards directly.
I hope I was able to somehow help you.
Regards,
Juri
我认为您的陈述“我知道这里没有人使用 CRC 卡” 几乎概括了 CRC 卡的开发状态。 在我看来,CRC 卡是从传统的计划驱动开发向敏捷开发迈出的一步。 世界已经向前发展。 我不会关注如何使用 CRC 卡,而是研究诸如 TDD 之类的技术,这些技术可以利用 UML 和 CRC 卡等技术作为中间工件,但它专注于代码,尤其是测试。 这是 CRC 卡的发明者所采取的方向,我建议您也采取这种方向。
I think your statement "I know noone around here who uses CRC cards" pretty much sums up the state of CRC cards in development. CRC cards, in my opinion, were a step on the road from traditional, plan-driven development to agile development. The world has moved on. Instead of focusing on how to use CRC cards, I'd investigate techniques like TDD, which can make use of techniques like UML and CRC cards as intermediate artifacts but which concentrates on code, and more particularly on tests. This is the direction that the inventors of CRC cards have taken and I'd recommend that you take also.
前往来源 - Kent Beck、Ward Cunningham,听说过他们吗?
go to the source - Kent Beck, Ward Cunningham, ever heard of them?
在我看来,使用它们而不陷入混乱的最简单方法是在文件头中写下小 CRC 卡,如下所示:
然后每次需要添加功能时检查您的卡并确保没有违反任何合同你在里面说的。 例如,突然之间依赖于 UIMouseEvent,这在卡上不存在,因此禁止包含它。
Easiest way to use them in my opinion without getting into a mess is to write down little CRC cards in your file headers like this:
Then everytime you need to add a feature check your card and be sure you don't break any of the contracts you stated in it. Such as all of the sudden depending on UIMouseEvent for example, that's nowhere on the Card so its a no-no to include it.
很难用一个答案来概括,但我会尝试。 设计对象的挑战之一是平衡从整体角度的思考和从单个对象的角度的思考。 你需要整体视角来完成计算,但你需要个体对象视角来有效细分逻辑和数据。
保持这种平衡就是 CRC 卡的用武之地。当它们放在桌子上时,您可以从整体上查看计算。 然而,当你拿起一张卡片时,你会在身体上、动觉上被鼓励从那个物体的角度来看——我需要用有限的资源来完成这一小部分计算,我将如何完成它?
随着时间的推移,同时持有两种观点的能力似乎会渗透到大脑中。 卡片上写的东西越来越少。 然后卡片是空白的。 过了一会儿,如果人们愿意从一堆空白卡片中取出一张卡片,他们就会指出卡片所在的位置。 最终,人们无需卡片就能享受到思维方式的好处。 不过,当与尚未掌握平衡的人交谈时,拿出真实的卡片可能是一种有用的沟通辅助。
我发现这些卡片的最大弱点是缺乏反馈。 您可以欺骗自己代码的结果如何。 我建议仅在出现有趣的问题之前使用卡片,转向测试/代码进行确认,然后继续设计。
沃德和我在大约 15 年前制作了一个设计会议的视频,但我在网上找不到它,也没有副本。 无论如何,我不确定它作为教学工具是否有用。 我不知道其他视频,但它们可能很有趣,特别是如果您必须比较几个不同设计师的风格。
It's hard to summarize in an SO answer, but I'll try. One of the challenges of designing objects is balancing thinking from an overall perspective with thinking from the perspective of an individual object. You need the overall perspective to get the computation completed, but you need the individual object perspective to effectively subdivide the logic and data.
Maintaining this balance is where CRC cards come in. When they are sitting there on the table, you get to look at the computation as a whole. When you pick up a single card, though, you are physically, kinesthetically encouraged to take the point of view of that one object--I have this little piece of this computation to do with limited resources, how am I going to accomplish it?
Over time, the ability to simultaneously hold both perspectives seems to soak into the brain. Less and less gets written on the cards. Then the cards are blank. After a while people just point to where the card would be if they would bother taking a blank one off the stack. Eventually, people have the benefits of the thinking style without needing cards at all. When talking with someone who hasn't mastered the balance, pulling out reals cards can be a useful communication assist, though.
The biggest weakness I find with the cards is the lack of feedback. You can fool yourself about how the code is going to turn out. I would suggest using cards only until an interesting question comes up, turn to tests/code for confirmation, and then resume designing.
Ward and I made a video 15 or so years ago of a design session, but I don't find it online anywhere and I don't have a copy. I'm not sure it would be useful as a teaching tool in any case. I don't know of other videos, but they could be interesting, especially if you got to compare several different designer's styles.