Yes, the occasional one of those is sometimes not a bad thing. But if you're agile using Scrum, then you are presumably trying to follow Test-Driven Development (TDD), and it is important that you remember that the sequence is red-green-refactor, not just red-green. Bad quality code is not the output of agile development, but of poor agile development.
When you have finished coding and are ready to check in, you should have met your teams definition of 'done'
This definition should amongst other things include meeting your acceptance criteria / code review / test review / and meeting agreed coding standards.
If after several sprints your code base is in need of serious refactoring I would suggest your definition of done needs reviewing.
You don't necessarily need to dedicate a whole sprint to refactoring, it can also work at the task level. When you have a story that requires working with some hairy piece of code, include a refactoring task in that story as a kind of prerequisite for getting anything sensible done with that part. That way, you make progress with the features but also get some refactoring done incrementally.
For my team I typically start a refactoring sprint roughly once every three to four months. Considering we run 2-week sprints, that's one refactoring sprint roughly every seven sprints.
I run the refactoring sprint like any other sprint - strictly 2 weeks time limit. Sometimes we even run just 1 week refactoring sprints (when something urgent comes along).
A note on refactoring sprints: don't be too ambitious:
Realize that refactoring is an infinite cycle: you'll always find a better way to do things.
It's OK if you refactor only 10% of what needs to be refactored.
Treat refactoring like any other stories so that you are forced to prioritize what to refactor and recognize where in your code is in most need of refactoring. The only difference is that for refactoring stories I let developers set priorities.
A partial refactor will still leave your code in a better state than no refactor at all. Plus, it tends to make further refactoring easier.
Refactoring happens even outside of refactoring sprints when working on stories, but only if the refactoring is a low-hanging-fruit that doesn't interfere with stories being completed.
This is what I personally use as a guide to refactoring. It not only make refactoring managable but also serves as a good indicator for when you're overdoing it.
Where I work, we will have sprints dedicated to bugs and technical debt. It works well for improving things and having a spirit of continuous improvement to some extent.
Something to also ponder here is whether or not there are enhancements that the customer wants but hasn't requested. Does the customer seem genuinely happy with the current system or does it just work good enough that he doesn't want to complain?
发布评论
评论(5)
是的,偶尔出现这样的情况有时并不是一件坏事。但是,如果您使用 Scrum 进行敏捷开发,那么您可能会尝试遵循测试驱动开发 (TDD),并且重要的是要记住顺序是红-绿-重构,而不仅仅是红绿。低质量的代码不是敏捷开发的输出,而是差敏捷开发的输出。
Yes, the occasional one of those is sometimes not a bad thing. But if you're agile using Scrum, then you are presumably trying to follow Test-Driven Development (TDD), and it is important that you remember that the sequence is red-green-refactor, not just red-green. Bad quality code is not the output of agile development, but of poor agile development.
你对“完成”有定义吗?
当您完成编码并准备好签入时,您应该满足团队对“完成”的定义。
此定义应包括满足您的验收标准/代码审查/测试审查/以及满足商定的编码标准。
如果经过几次冲刺后您的代码库需要认真重构,我建议您需要检查完成的定义。
这是 Scrum 联盟的一篇文章,介绍如何定义“完成的定义”< /a>
Do you have a definition of 'done'?
When you have finished coding and are ready to check in, you should have met your teams definition of 'done'
This definition should amongst other things include meeting your acceptance criteria / code review / test review / and meeting agreed coding standards.
If after several sprints your code base is in need of serious refactoring I would suggest your definition of done needs reviewing.
Here's an article from Scrum Alliance on defining your 'definition of done'
您不一定需要将整个冲刺专门用于重构,它也可以在任务级别发挥作用。当您的故事需要使用一些繁琐的代码时,请在该故事中包含一个重构任务,作为对该部分进行任何明智的操作的先决条件。这样,您不仅可以在功能方面取得进展,还可以逐步完成一些重构。
You don't necessarily need to dedicate a whole sprint to refactoring, it can also work at the task level. When you have a story that requires working with some hairy piece of code, include a refactoring task in that story as a kind of prerequisite for getting anything sensible done with that part. That way, you make progress with the features but also get some refactoring done incrementally.
对于我的团队,我通常大约每三到四个月开始一次重构冲刺。考虑到我们运行两周的冲刺,大约每七个冲刺就有一次重构冲刺。
我像任何其他冲刺一样运行重构冲刺 - 严格限制 2 周的时间限制。有时我们甚至只进行 1 周的重构冲刺(当出现紧急情况时)。
关于重构冲刺的注意事项:不要太雄心勃勃:
这是我个人用作重构指南的内容。它不仅使重构变得易于管理,而且还可以作为重构过度的良好指标。
For my team I typically start a refactoring sprint roughly once every three to four months. Considering we run 2-week sprints, that's one refactoring sprint roughly every seven sprints.
I run the refactoring sprint like any other sprint - strictly 2 weeks time limit. Sometimes we even run just 1 week refactoring sprints (when something urgent comes along).
A note on refactoring sprints: don't be too ambitious:
This is what I personally use as a guide to refactoring. It not only make refactoring managable but also serves as a good indicator for when you're overdoing it.
在我工作的地方,我们会有专门针对错误和技术债务的冲刺。它对于改善事物以及在某种程度上具有持续改进的精神非常有效。
这里还需要考虑的是是否存在客户想要但尚未请求的增强功能。客户是否真的对当前系统感到满意,或者只是工作得足够好以至于他不想抱怨?
Where I work, we will have sprints dedicated to bugs and technical debt. It works well for improving things and having a spirit of continuous improvement to some extent.
Something to also ponder here is whether or not there are enhancements that the customer wants but hasn't requested. Does the customer seem genuinely happy with the current system or does it just work good enough that he doesn't want to complain?