在敏捷开发中,您如何处理“架构不太完善”的问题?源于以冲刺为中心的思维方式的代码

发布于 2024-08-18 21:47:07 字数 1431 浏览 10 评论 0原文

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

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

发布评论

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

评论(5

勿忘心安 2024-08-25 21:47:07

是的,偶尔出现这样的情况有时并不是一件坏事。但是,如果您使用 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.

贵在坚持 2024-08-25 21:47:07

你对“完成”有定义吗?

当您完成编码并准备好签入时,您应该满足团队对“完成”的定义。

此定义应包括满足您的验收标准/代码审查/测试审查/以及满足商定的编码标准。

如果经过几次冲刺后您的代码库需要认真重构,我建议您需要检查完成的定义。

这是 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'

迷途知返 2024-08-25 21:47:07

您不一定需要将整个冲刺专门用于重构,它也可以在任务级别发挥作用。当您的故事需要使用一些繁琐的代码时,请在该故事中包含一个重构任务,作为对该部分进行任何明智的操作的先决条件。这样,您不仅可以在功能方面取得进展,还可以逐步完成一些重构。

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.

雨后彩虹 2024-08-25 21:47:07

对于我的团队,我通常大约每三到四个月开始一次重构冲刺。考虑到我们运行两周的冲刺,大约每七个冲刺就有一次重构冲刺。

我像任何其他冲刺一样运行重构冲刺 - 严格限制 2 周的时间限制。有时我们甚至只进行 1 周的重构冲刺(当出现紧急情况时)。

关于重构冲刺的注意事项:不要太雄心勃勃:

  1. 要意识到重构是一个无限循环:你总会找到更好的做事方法。
  2. 如果只重构需要重构的 10% 就可以了。
  3. 像对待任何其他故事一样对待重构,以便您被迫优先考虑重构的内容并识别代码中最需要重构的位置。唯一的区别是,对于重构故事,我让开发人员设置优先级。
  4. 部分重构仍然会让您的代码处于比完全不重构更好的状态。另外,它往往会使进一步的重构变得更加容易。
  5. 在处理故事时,即使在重构冲刺之外也会发生重构,但前提是重构是一个容易实现的目标,不会干扰故事的完成。

这是我个人用作重构指南的内容。它不仅使重构变得易于管理,而且还可以作为重构过度的良好指标。

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:

  1. Realize that refactoring is an infinite cycle: you'll always find a better way to do things.
  2. It's OK if you refactor only 10% of what needs to be refactored.
  3. 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.
  4. 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.
  5. 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.

离笑几人歌 2024-08-25 21:47:07

在我工作的地方,我们会有专门针对错误和技术债务的冲刺。它对于改善事物以及在某种程度上具有持续改进的精神非常有效。

这里还需要考虑的是是否存在客户想要但尚未请求的增强功能。客户是否真的对当前系统感到满意,或者只是工作得足够好以至于他不想抱怨?

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?

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