跳到主要内容

敏捷开发

来源书籍 “Agile! The Good, the Hype and the Ugly”,

学习好处

  • 它以严格客观的视角看待敏捷流程,使你能够保留最佳的敏捷原则和实践。

  • 通过深入分析敏捷流程并展示如何从中受益,它将使你成为更优秀的开发人员,具备应对大型软件项目挑战的能力。

  • 这门课程并不是宣扬某种方法 而是强调软件质量和软件生产力

敏捷方法

A number of agile methods They share the basics but differ in their goals and emphases

XP

出现于 90 年代。

XP(极限编程)是对当时软件工程圈内盛行的文化(流程、计划、图表)的反应。 ➢ 例如,UML(统一建模语言)或 CMMI(能力成熟度模型集成,即定义软件开发最佳实践的标准)。

强调最终真正重要的是程序,当然还有编程和程序员。

XP 通过重振程序员的工作,将程序和编程置于软件开发的中心,做出了重大贡献。

协商范围合同

“为软件开发撰写合同,固定时间、成本和质量,但要求对系统的具体范围持续协商。通过签署一系列短期合同而不是一个长期合同来降低风险。”

“您可以朝着协商范围的方向发展。大的、长期的合同可以分成两半或三分之一,只有在双方同意的情况下才执行可选部分。对于变更请求成本较高的合同,可以在前期固定较少的范围,并降低变更成本。”

Lean

精益软件

  • 尝试将一些在其他工程领域(特别是汽车行业)中已证明其价值的理念和原则应用于软件。

  • 这是一套由日本丰田公司特别开发的著名实践,不仅在汽车行业,而且在整个工业界,尤其是制造实物的行业中产生了很大影响。

  • Poppendiecks 将这些理念应用于软件,特别强调需要消除他们所谓的浪费。

  • Poppendiecks 声称我们也应该在软件中寻找浪费,并去除例如无用的文档等被视为浪费的东西,以便专注于实际交付给客户的内容。

Crystal

  • 结合了敏捷理念和更传统的理念。

  • Crystal 实际上是指一套方法,这些方法以管理过程中不同程度的重要性为特征。

  • 开发 Crystal 方法集的 Alistair Coburn 试图将敏捷的优点与更注重流程的方法的优点结合起来。

Scrum

  • 近年来主导了这一领域。

  • 技术性较少,不像 XP 那样专注于软件。

  • 一种管理方法,强调自组织团队的重要性,而不是由经理密切管理的团队,以及一种被称为 Sprints 的短期发布迭代的重要性。

  • 需要注意的是,如今在实践中,当我们谈论敏捷时,我们实际上是在谈论 Scrum。

    • 这种观点并不完全准确……很多来自其他方法的理念,特别是 XP。

敏捷价值观

Agile values A New, reduced role for manager 新,管理者的角色占比减少 B No “Big Upfront” steps 没有“大前期”步骤 C Iterative development 迭代开发 D Limited, negotiated scope 有限的、协商的范围 E Focus on quality, achieved through testing 通过测试实现的质量关注

敏捷原则

Organizational

  • 1 Put the customer at the center 将客户置于中心

  • 2 Accept change 接受变化

  • 3 Let the team self-organize 让团队自我组织

  • 4 Maintain a sustainable pace 保持可持续的节奏

  • 5 Produce minimal software 生产最少的软件

    • 5.1 Produce minimal functionality 生产最小化的功能
    • 5.2 Produce only the product requested 只生产所需的产品
    • 5.3 Develop only code and tests 仅开发代码和测试

Technical 技术方面

  • 6 Develop iteratively 迭代开发 • 6.1 Produce frequent working iterations 频繁产生可工作的迭代 • 7.2 Freeze requirements during iterations 在迭代期间冻结需求

  • 7 Treat tests as a key resource: 将测试视为关键资源 • 7.1 Do not start any new development until all tests pass 在所有测试通过之前,不开始任何新的开发 • 7.2 Test first 先测试

  • 8 Express requirements through scenarios 通过场景表达需求

Life cycle model 解决 The enemy: Big Upfront Anything

Scope: describe the set of processes involved in the production of software systems, and their sequencing

范围:描述软件系统生产中涉及的一系列过程及其顺序

瀑布模型

瀑布模型的流程,分为几个阶段:

  • Decide(决策):

    Business Case(商业案例):确定项目的商业目标和理由。 User Requirements(用户需求):收集和定义用户的需求。

  • Design(设计):

    System Specification(系统规格):详细描述系统的功能和特性。 System Design(系统设计):规划系统的整体架构。 Component Design(组件设计):设计系统的各个组件。

  • Develop(开发):

    Construct Component(构建组件):实际开发和构建系统组件。

  • Demonstrate(演示): Test(测试):对系统进行测试,确保其符合需求和规格。

瀑布模型的问题

  • 实际代码出现得晚 Late appearance of actual code

  • 缺乏对需求变更的支持——更普遍地说,缺乏对可扩展性和可重用性的支持 Lack of support for requirements change

  • 缺乏对维护活动的支持(软件成本的 70%?) maintenance activity

  • 劳动力分工妨碍全面质量管理 Division of labor hampering Total Quality Management

  • 阻抗不匹配 Impedance mismatches

  • 高度同步的模型 Highly synchronous model

对需求的两种敏捷批评

  • 变更批评
  • 浪费批评

What does "Collective Code Ownership" mean in XP? Question 1 options:

Code is reviewed monthly for collective feedback.

Each team member reviews their own code individually.

A dedicated reviewer approves changes.

Every team member can make changes to any part of the code.

Only the original developer can modify the code.

XP prefers ownership of every element of the code to be assigned to: Question 2 options: The entire team, regardless of who developed the code. One person, typically the original developer of the code.

XP prefers ownership of every element of the code to be assigned to the entire team, regardless of who developed the code. This is known as "Collective Code Ownership."

Which of the following are expected benefits of Test-Driven Development? (Select all that apply) Question 3 options:

Drive the design of the program.

Having more modular code.

Catch bugs early.

Using the debugger more.

Write fewer tests.

Replace specifications by tests.

Having more tests.

The expected benefits of Test-Driven Development (TDD) include:

  • Drive the design of the program.
  • Having more modular code.
  • Catch bugs early.
  • Having more tests.

Here are explanations for each:

  1. Drive the design of the program: TDD emphasizes writing tests before the actual code, which can help shape and guide the design of the software.

  2. Having more modular code: Since TDD encourages writing small, testable units of code, it often leads to more modular and manageable code.

  3. Catch bugs early: Writing tests before code allows developers to identify and fix problems early in the development process.

  4. Having more tests: TDD inherently results in a larger suite of tests because tests are written continuously as part of the development process.

The other options do not align with typical TDD practices:

  • Using the debugger more: TDD may reduce the need for debugging, as many bugs are caught early by tests.
  • Write fewer tests: TDD usually leads to writing more tests, not fewer.
  • Replace specifications by tests: While tests can serve as a form of documentation, they do not fully replace detailed specifications.

Which statements align with Extreme Programming (XP) practices? (Select all that apply) Question 4 options:

Test-driven development should be used for new features.

Developers should pair program to improve code quality.

Code ownership should be assigned to individual team members.

Maintain a single, shared codebase.

Refactor code only at the end of the project.

The statements that align with Extreme Programming (XP) practices are:

  1. Test-driven development should be used for new features.

    • XP emphasizes Test-Driven Development (TDD) as a core practice to ensure code quality and guide design.
  2. Developers should pair program to improve code quality.

    • Pair programming is a key practice in XP, where two developers work together at one workstation to improve code quality and share knowledge.
  3. Maintain a single, shared codebase.

    • XP advocates for a single, shared codebase to ensure that all team members have access to the latest code and can contribute to any part of the project.

The other statements do not align with XP practices:

  • Code ownership should be assigned to individual team members.

    • XP promotes "Collective Code Ownership," where any team member can modify any part of the codebase.
  • Refactor code only at the end of the project.

    • XP encourages continuous refactoring throughout the development process to improve code quality and adaptability.

Which of the following are true regarding the Product Backlog in Scrum? (Select all that apply) Question 5 options:

It evolves as new information is discovered.

It contains all known work needed for the product.

It is reviewed at every sprint planning meeting.

It is fixed at the start of the project.

It contains only high-priority items.

It is prioritized by the product owner.

The statements that are true regarding the Product Backlog in Scrum are:

  1. It evolves as new information is discovered.

    • The Product Backlog is a dynamic list that evolves as the product and its environment change.
  2. It contains all known work needed for the product.

    • The Product Backlog includes all the work that is known to be necessary for the product, although it may not be exhaustive at any given time.
  3. It is reviewed at every sprint planning meeting.

    • The Product Backlog is reviewed and updated during Sprint Planning to ensure it reflects the current priorities and understanding of the product.
  4. It is prioritized by the product owner.

    • The Product Owner is responsible for prioritizing the Product Backlog to maximize the value of the product.

The other statements are not true:

  • It is fixed at the start of the project.

    • The Product Backlog is not fixed; it is continuously updated and refined.
  • It contains only high-priority items.

    • The Product Backlog contains items of varying priority, not just high-priority ones.

Which of the following describe a cross-functional team? (Select all that apply) Question 6 options:

Each member is responsible for a specific part of the project.

Team members have all skills necessary to complete the work.

Team relies on external specialists for complex tasks.

Team members work independently to avoid duplication.

Team is empowered to make its own decisions.

The statements that describe a cross-functional team are:

  1. Team members have all skills necessary to complete the work.

    • A cross-functional team possesses all the skills required to complete the project, allowing them to work independently without relying on external resources.
  2. Team is empowered to make its own decisions.

    • Cross-functional teams are typically empowered to make decisions about how to accomplish their work, fostering autonomy and accountability.

The other statements do not accurately describe a cross-functional team:

  • Each member is responsible for a specific part of the project.

    • In a cross-functional team, members often collaborate and share responsibilities rather than being confined to specific parts.
  • Team relies on external specialists for complex tasks.

    • A cross-functional team should have the necessary skills internally to handle complex tasks without relying on external specialists.
  • Team members work independently to avoid duplication.

    • While team members may work on different tasks, cross-functional teams emphasize collaboration and communication to ensure alignment and avoid duplication.

Which of the following statements best describe Agile planning? (Select all that apply) Question 7 options:

Plans are reviewed and adapted at each iteration.

Plans evolve to accommodate uncertainty and changing priorities.

Plans are adjusted based on changes in project scope and stakeholder feedback.

Plans are created once at the start of the project and then followed strictly.

Plans are avoided in favor of flexibility

The statements that best describe Agile planning are:

  1. Plans are reviewed and adapted at each iteration.

    • Agile planning involves regular reviews and adaptations at the end of each iteration (e.g., sprint) to ensure the plan remains relevant and effective.
  2. Plans evolve to accommodate uncertainty and changing priorities.

    • Agile planning is flexible and allows for changes in priorities and uncertainties, adapting as new information becomes available.
  3. Plans are adjusted based on changes in project scope and stakeholder feedback.

    • Agile planning incorporates feedback from stakeholders and adjusts plans to reflect changes in project scope and requirements.

The other statements do not align with Agile planning principles:

  • Plans are created once at the start of the project and then followed strictly.

    • This approach is more characteristic of traditional, waterfall planning, not Agile.
  • Plans are avoided in favor of flexibility.

    • Agile planning does not avoid planning; rather, it emphasizes flexible and adaptive planning.

In Agile’s Planning Poker, why are initial estimates kept hidden until everyone has chosen a value? Question 8 options:

To ensure estimates align with the budget.

To increase transparency.

To keep the discussion lively.

To encourage consensus estimates.

To promote independent thinking.

In Agile's Planning Poker, initial estimates are kept hidden until everyone has chosen a value to:

  • Promote independent thinking.

This approach ensures that each team member provides their own estimate without being influenced by others, leading to a more accurate and unbiased assessment of the task's complexity or effort.

Which of the following best defines the role of feedback in Agile development? (Select all that apply) Question 9 options:

Feedback determines task assignments in each sprint.

Feedback is used to change team composition.

Feedback is used to improve the product incrementally.

Feedback helps refine requirements and backlog items.

Feedback is reviewed quarterly for future adjustments.

The statements that best define the role of feedback in Agile development are:

  1. Feedback is used to improve the product incrementally.

    • Agile development relies on continuous feedback to make incremental improvements to the product, ensuring it meets user needs and expectations.
  2. Feedback helps refine requirements and backlog items.

    • Feedback is crucial for refining and updating requirements and backlog items, ensuring they remain relevant and aligned with stakeholder needs.

The other statements do not accurately reflect the role of feedback in Agile development:

  • Feedback determines task assignments in each sprint.

    • Task assignments are typically determined by team discussions and planning, not solely by feedback.
  • Feedback is used to change team composition.

    • While feedback can influence team dynamics, it is not primarily used to change team composition.
  • Feedback is reviewed quarterly for future adjustments.

    • Feedback in Agile is typically reviewed continuously or at the end of each iteration, not just quarterly.

What happens during a retrospective meeting in Scrum? (Select all that apply) Question 10 options:

All team members answer the question: "What went well?"

All team members reflect on the past sprint.

All team members answer the question: "What could be improved?"

All team members answer the question: "What will we do today?s

During a retrospective meeting in Scrum, the following typically occur:

  1. All team members answer the question: "What went well?"

    • This allows the team to identify and acknowledge the successes of the past sprint.
  2. All team members reflect on the past sprint.

    • The retrospective is a time for the team to reflect on the sprint as a whole, considering what worked and what didn’t.
  3. All team members answer the question: "What could be improved?"

    • This helps the team identify areas for improvement and plan actions to enhance future sprints.

The other option does not apply to a retrospective meeting:

  • All team members answer the question: "What will we do today?"
    • This question is typically part of the Daily Scrum (stand-up) meeting, not the retrospective.

You are a product owner who is participating in a planning meeting. You have the following list of user stories (USs), together with the priority, the estimated complexity, and the estimated completion time (EST):

US1 (Priority-Low, Complexity-Easy, EST=2 days) US2 (Priority-High, Complexity-Medium, EST=3 days) US3 (Priority-High, Complexity-Complex, EST=5 days) US4 (Priority-High, Complexity-Complex, EST=4 days) US5 (Priority-Low, Complexity-Easy, EST=1 day)

Assume that you observed that the team needs some sense of achievement. Which of the following subsets of the user stories above you would choose for your team for the next five-days sprint to allow some "slack" and boost the morale of the team? (Select all that apply) Question 11 options:

US4, US5

US1, US5

US1, US4

US3

US1, US2

To provide both a sense of achievement and "slack" for the team, it's essential to balance high-priority tasks with easier, quicker tasks that can be completed within the sprint. Here are the subsets that would achieve this balance:

  1. US1, US5:

    • These are both low-priority but easy tasks with a combined EST of 3 days. They allow for quick wins and a sense of completion, providing morale boosts, while still leaving room for slack or additional tasks.
  2. US1, US2:

    • This choice includes a high-priority task (US2, Medium complexity, 3 days) paired with an easy, low-priority task (US1, 2 days). This mix allows the team to address some high-priority work while also achieving the satisfaction of completing a task quickly.

Both options collectively utilize the five days available without exceeding the sprint capacity, allowing for some "slack" and potential adaptation to unforeseen complexities or other tasks.

What can be derived from the published experimental studies measuring productivity of pair programming vs. "traditional" programming? Question 12 options:

There is significant evidence in favor of the traditional approach.

There is no significant evidence in favor of one approach or the other.

There is significant evidence in favor of pair programming.

The correct statement is:

There is no significant evidence in favor of one approach or the other.

Experimental studies on the productivity of pair programming versus traditional programming have shown mixed results, with some studies indicating benefits of pair programming in terms of code quality and problem-solving, while others show little to no difference in productivity. As a result, there is no conclusive evidence strongly favoring one approach over the other.

Which of the following is a correct definition of code refactoring? Question 13 options:

A technique for restructuring an existing body of code presenting errors (behaviors that do not adhere to the existing specifications), altering its internal structure without changing its external behavior.

A technique for restructuring an existing body of code, altering its internal structure without changing its external behavior.

A technique for restructuring an existing body of code presenting errors (behaviors that do not adhere to the existing specifications), altering its internal structure and changing its external behavior.

A technique for improving an existing body of code by adding new functionality

The correct definition of code refactoring is:

A technique for restructuring an existing body of code, altering its internal structure without changing its external behavior.

This definition captures the essence of code refactoring, which aims to improve the internal design of the code to enhance readability, maintainability, and efficiency while ensuring that its external functionality and behavior remain unchanged.