敏捷开发需求文档
In my training courses, we discuss many topics. Including: how do you document requirements in the long term, in an agile environment?
在我的培训课程中,我们讨论了许多主题。 包括:如何在敏捷环境中长期记录需求?
Documentation is stored knowledge. As things are forgotten, its value increases over time. That’s why I think the question of long-term documentation is interesting.
文档是存储的知识。 随着事物的遗忘,它的价值会随着时间而增加。 这就是为什么我认为长期记录问题很有趣。
I’d like to start with two options for long-term documentation that don’t make sense in an agile environment. Then I’d like to point out sensible options. Each with advantages and disadvantages.
我想从长期文档的两个选项开始,这些选项在敏捷环境中没有意义。 然后,我想指出一些明智的选择。 每种都有优点和缺点。
不是有用的选项:详细的前期规范 (Not a useful option: Detailed up-front specification)
It does not make sense to specify all requirements in detail in advance. In a complex environment, there are frequent changes. Requirements are re-prioritized. This is one of the advantages of agile development. Some requirements are considered, but never implemented. Or not as planned, because you gain new knowledge during development.
事先详细指定所有要求没有意义。 在复杂的环境中,经常进行更改。 需求被重新排序。 这是敏捷开发的优势之一。 考虑了一些要求,但从未实施。 是否按计划进行,因为您在开发过程中会获得新知识。
Discussion and documentation of a requirement costs time. If the requirement is not implemented as documented, it was a waste of time. Time that is urgently needed in development.
讨论和记录需求会花费时间。 如果未按文档要求实施要求,那将是浪费时间。 开发中迫切需要的时间。
也不是一个有用的选择:积压 (Not a useful option either: The backlog)
Let’s say you start to work in an agile way. Maybe you think: there isn‘t any detailed specification. But a backlog. Let’s use it to document the requirements on a long-term basis.
假设您开始以敏捷的方式工作。 也许您认为:没有任何详细的规范。 但是积压。 让我们用它来长期记录需求。
But a backlog serves the future, not the past. It’s more like a to-do list. What do we implement next? The backlog isn't a sensible option for long-term documentation. It doesn’t document what has already been implemented.
但是,积压的订单是为未来而不是过去服务的。 它更像是一个待办事项清单。 接下来我们要实现什么? 对于长期文档而言,积压不是明智的选择。 它没有记录已实施的内容。
选项1:实施后存档用户故事 (Option 1: Archive user stories after implementation)
In a training course, a participant told me that his company manages user stories in JIRA. And the developers archive them after implementation. Of course, you can search this archive. The participant reported that it worked well for them.
在培训课程中,一位参与者告诉我他的公司在JIRA中管理用户故事。 开发人员在实施后将其存档。 当然,您可以搜索此存档。 参加者报告说,对他们来说效果很好。
An agile pragmatist can hardly disagree. What works, works. At least in a certain context. I see 2 risks of this approach:
敏捷的实用主义者几乎不会不同意。 什么有效,有效。 至少在某些情况下。 我看到这种方法有两个风险:
Too many details: In order to be able to use the stories in the long term, you certainly have to document many details. What if the details cannot be implemented as planned? Will the user stories be adjusted afterwards? The stories may no longer document the implementation correctly.
太多细节:为了能够长期使用故事,您当然必须记录许多细节。 如果细节无法按计划实施怎么办? 用户故事会在以后进行调整吗? 这些故事可能不再正确地记录实现。
Delta documentation instead of system documentation: User stories describe what needs to be done. The “delta” from one state to another state. In order to find out the current state, it may be necessary to analyze several past user stories. Stories lack context information. They are not system documentation, but only small fragments.
Delta文档而不是系统文档:用户案例描述了需要做的事情。 从一个状态到另一状态的“增量”。 为了找出当前状态,可能有必要分析几个过去的用户故事。 故事缺少上下文信息。 它们不是系统文档,而是小片段。
选项2:系统文档的增量调整 (Option 2: Incremental adaption of the system documentation)
The documentation can be maintained continuously. During a Scrum Sprint, you document the current state. The requirements that have just been implemented. The documentation grows over time. It is supplemented incrementally.
该文档可以连续维护。 在Scrum Sprint期间,您记录当前状态。 刚实施的要求。 该文档随时间增长。 逐步补充。
If you follow this approach consistently, it has a great advantage. The system documentation is always up to date. It documents which requirements have actually been implemented.
如果您始终遵循此方法,则将具有很大的优势。 系统文档始终是最新的。 它记录了实际上已经实施了哪些要求。
One challenge with this option is discipline. Only if you document consistently, the documentation will remain up-to-date. And that costs time.
使用此选项的一个挑战是纪律。 仅当您始终记录文档时,文档才会保持最新状态。 这会花费时间。
Moreover, not every developer is a born documentation writer. If, however, the developers do not document themselves, but instead delegate it to other employees, then there is a risk of information loss.
而且,并非每个开发人员都是天生的文档编写者。 但是,如果开发人员不记录自己,而是将其委派给其他员工,则存在信息丢失的风险。
One way to promote this discipline within a team is to put it into the Definition of Done. Something like: “System documentation has been updated”. To be checked in Sprint Review.
在团队中促进这种纪律的一种方法是将其纳入“完成的定义”中。 诸如:“系统文档已更新”。 在Sprint Review中检查。
选项3:代码内的要求 (Option 3: Requirements inside the code)
A completely underestimated type of long-term documentation is the code of the software. If you structure code appropriately and use naming conventions, you can generate documentation from the code.
完全被低估的长期文档类型是软件代码。 如果适当地构造代码并使用命名约定,则可以从代码生成文档。
To realize this, I have developed a library. With it you can specify executable Use Case models in the code. They act similar to a state machine. Here is a code example for a Use Case for a credit card:
为此,我开发了一个图书馆 。 使用它,您可以在代码中指定可执行的用例模型。 它们的行为类似于状态机 。 这是信用卡用例的代码示例:
Model model = Model.builder()
.useCase("Use credit card")
.basicFlow()
.step(ASSIGN).user(requestsToAssignLimit).system(assignsLimit)
.step(WITHDRAW).user(requestsWithdrawal).system(withdraws).reactWhile(accountOpen)
.step(REPAY).user(requestsRepay).system(repays).reactWhile(accountOpen)
.flow("Withdraw again").after(REPAY)
.step(WITHDRAW_AGAIN).user(requestsWithdrawal).system(withdraws)
.step(REPEAT).continuesAt(WITHDRAW)
.flow("Cycle is over").anytime()
.step(CLOSE).on(requestToCloseCycle).system(closesCycle)
.flow("Assign limit twice").condition(limitAlreadyAssigned)
.step(ASSIGN_TWICE).user(requestsToAssignLimit).system(throwsAssignLimitException)
.flow("Too many withdrawals").condition(tooManyWithdrawalsInCycle)
.step(WITHDRAW_TOO_OFTEN).user(requestsWithdrawal).system(throwsTooManyWithdrawalsException)
.build();
The documentation generated from this code follows.
从此代码生成的文档如下。
GENERATED DOCUMENTATION - START
生成的文档-开始
使用信用卡 (Use Credit Card)
基本流程 (Basic flow)
Assign limit : User requests to assign limit. System assigns limit.Withdraw : As long as account open: User requests withdrawal. System withdraws.Repay : As long as account open: User requests repay. System repays.
分配限制 :用户请求分配限制。 系统分配限制。 提款 :只要开户:用户要求提款。 系统退出。 回报 :只要户口不限:用户请求偿还。 系统还款。
再次提款 (Withdraw again)
After Repay:Withdraw again : User requests withdrawal. System withdraws.Repeat : System continues at Withdraw.
退款后: 再次提款 :用户要求提款。 系统退出。 重复 :系统继续退出。
周期结束 (Cycle is over)
Anytime:Close cycle : Handles RequestToCloseCycle: System closes cycle.
随时: 关闭周期 :处理RequestToCloseCycle:系统关闭周期。
分配限制两次 (Assign limit twice)
Anytime, when limit already assigned:Assign limit twice : User requests to assign limit. System throws assign limit exception.
任何时候,如果已经分配了限制 : 两次分配限制 :用户请求分配限制。 系统抛出分配限制异常。
提款太多 (Too many withdrawals)
Anytime, when too many withdrawals in cycle:Withdraw too often : System throws too many withdrawals exception.
任何时候,当循环中的提取次数过多时 : 提取次数过多 :系统抛出过多的提取异常。
GENERATED DOCUMENTATION - END
生成的文档-结束
The same code controls the application behavior and is the source for the documentation. The advantage is obvious: You can generate documentation with little effort. And it reflects the actual behavior of the software.
相同的代码控制应用程序的行为,并且是文档的来源。 优点是显而易见的:您可以轻松生成文档。 它反映了软件的实际行为。
Of course, this approach also requires discipline. Especially on the side of developers. Before using any approach, you should try it out. Is it suitable for the type of software being developed?
当然,这种方法也需要纪律。 特别是在开发者方面。 在使用任何方法之前,您都应该尝试一下。 是否适合正在开发的软件类型?
In addition, you can’t achieve completeness with such an approach. For example, you can’t generate quality requirements like robustness from the code. Design trade-offs are not part of the code either.
此外,使用这种方法无法实现完整性。 例如,您无法从代码中生成质量要求,如健壮性。 设计权衡也不是代码的一部分。
I am looking forward to your feedback. Which options for long-term documentation do you use?
期待您的反馈。 您使用哪些长期文档选项?
This article was first published on HOOD Blog in German. If you want to keep up with what I'm doing or drop me a note, follow me on dev.to, LinkedIn or twitter. Or visit my GitHub project.
本文最初 以德语 发布在 HOOD Blog 上。 如果您想跟上我的工作进度或给我留言 ,请在dev.to , LinkedIn或twitter上关注我。 或访问我的GitHub项目 。
翻译自: https://www.freecodecamp.org/news/long-term-agile-documentation-of-requirements/
敏捷开发需求文档