440 likes | 454 Views
Learn about the principles, values, and methods of agile software development, including Extreme Programming (XP) practices and user stories. Explore how agile aims to reduce overheads and adapt to changing requirements swiftly.
E N D
Software Engineering ISession 3 Agile Software Development
Recap • Software processes • Plan-driven vs Agile • Fundamental development activities (specification, development, validation, maintenance) • Plan-driven approaches: • each of these stages planned in advance; • Not necessarily waterfall • plan-driven, incremental development is possible; • Software process models • Waterfall, incremental development, integration and configuration • Software process improvements • CMM
Rapid Software Development • Rapid development and delivery is now often the most important requirement for software systems • Software has to evolve quickly to reflect changing business needs • Plan-driven development is essential for some types of system • but does not promote rapid development, or • the ability to deal with rapidly changing requirements • Agile development aims to • radically reduce the delivery time for working software systems • accommodate changing requirements during development.
Overview • Dissatisfaction with the overheads involved in software design methods of the 80s-90s led to the creation of agile methods. • These methods: • Focus on the code rather than the design • Are based on an incremental approach to software development • Are intended to deliver working software quickly and evolve this quickly to meet changing requirements. • The aim of agile methods is to reduce overheads in the software process • by limiting documentation • be able to respond quickly to changing requirements without excessive rework.
Agile • Agile is not a process or a methodology • Agile does not explicitly say what to do, how to do it, or in what order it should be done • Agile is a set of values and principles designed to inform software development practice • The core values of agile are: • Individuals and interactions over processes and tools • Working software over comprehensive documentation • Customer collaboration over contract negotiation • Responding to change over following a plan • The core agile principles are set out in the Agile Manifesto(http://agilemanifesto.org/)
Agile Manifesto • Continued >>
Agile Methods • An agile method is an approach to software development that applies agile values and principles to the development process. • Examples of agile methods are: • Extreme Programming • Scrum (project management) • Kanban • Crystal Methods • Individual agile methods are distinguished from one another by the specific practices they use to realise agile values and principles.
Agile method applicability • Product development • where a software company is developing a small or medium-sized product for sale. • Virtually all software products and apps are now developed using an agile approach (???) • Custom system development within an organisation • where there is a clear commitment from the customer to become involved in the development process • where there are few external rules and regulations that affect the software
Extreme Programming (XP) • Extreme programming is an influential agile method • developed in the late 1990s • introduced a range of revolutionary development techniques • Kent Beck (https://en.wikipedia.org/wiki/Kent_Beck) • XP takes an extreme approach to incremental development • New versions may be built several times per day; • Increments are delivered to customers every 2 weeks; • All tests must be run for every build and the build is only accepted if tests run successfully.
XP – User Stories and Task Cards • In XP, user requirements are expressed as user stories. • User stories are written from the user’s perspective. • One user may have several user stories. • Each user story represents a chunk of functionality. • The customer chooses the stories for inclusion in the successive releases based on their priorities and scheduling estimates. • User stories are decomposed by developers into implementation tasks. • Tasks form the basis of schedule and cost estimates.
XP – User Stories • User stories are written in informal, natural language. • They should be simple and concise (a few sentences). • They describe system requirements from a user perspective. • They do not contain technical detail. • User stories should also specify acceptance criteria • e.g. post-conditions that show that the story has been successfully completed.
XP – User Stories – Tasks • Tasks are derived from user stories. • They are written by a developers. • Again, they should be short and concise, and written in natural language.
XP – Refactoring • Why? • In certain cases, incremental development can lead to overly complex and messy code, and program structure degradation. • Refactoring is a technique for optimising and simplifying code and maintaining program integrity. • XP works on the basis that refactoring should be a constant activity rather than a one off event. • Refactoring is not just debugging. Refactoring is code optimisation. • Refactoring techniques include • Improving readability • Reducing complexity • Modularisation • Type generalisation • Re-organisation of a class hierarchy to remove duplicate code. • Tidying up and renaming attributes and methods to make them easier to understand. • The replacement of inline code with calls to methods that have been included in a program library.
XP Testing Features • Test-first development. • Incremental test development from scenarios. • User involvement in test development and validation • Acceptance testing • Automated test harnesses are used to run all component tests each time that a new release is built.
XP – Test-first Development • XP uses test-first development as a key practice • tests are developed prior to coding rather than after it. • Tests are automated, and development cannot proceed until all tests have been successfully executed. • Tests are written as programs rather than data • can be executed automatically. The test includes a check that it has executed correctly. • Usually relies on a testing framework such as Junit. • All previous and new tests are run automatically when new functionality is added • ensuring that new functionality has not introduced errors (regression test)
Test-first Development: Benefits • Helps clarify the requirements to be implemented. • Helps simplify code. Code is only written in response to the requirements of the tests. • Provides immediate feedback on work done. • Produces code with less bugs. • Avoids test lag • i.e. tests being done so long after coding that the tests are irrelevant.
Test-first Development: Drawbacks • Programmers prefer programming to testing (you should overcome!) • sometimes they take short cuts when writing tests. • Some tests can be very difficult to write • For example, in a complex user interface, it is often difficult to write unit tests for the code that implements the display logic and workflow between screens. • It difficult to judge the completeness of a set of tests. • Although you may have a lot of system tests, a test set may not provide complete coverage. • Changes to the design require changes to relevant tests, which can be time-consuming.
XP – Pair Programming • In pair programming, programmers sit together at the same computer to develop the software. • Pairs are created dynamically so that all team members work with each other during the development process. • Evidence suggests that • a pair working together is more efficient than two programmers working individually in some cases (e.g. a senior and a junior programmer) • but not in others (e.g. two senior programmers)
XP – Pair Programming • Benefits • Supports the idea of collective ownership and responsibility. • Avoids knowledge silos. • Reduce the overall risks to a project when team members leave. • Acts as an informal review process. • Encourages refactoring. • Fosters peer learning. • Encourages communication between team members. Assists team bonding. • Drawbacks • Modus operandi may not suit non-vocal individuals. • Requires radical shift in work-practice that may alienate some (e.g. sharing machines). • Decision by committee may slow development down.
Practical Problems with Agile Methods • Agile methods have proved to be successful for smaller projects that can be developed by co-located teams. • However, using agile methods for larger projects developed by distributed teams has proved a greater challenge. • Issues are: • Contracts • Software maintenance • Team integrity • Organisational culture
Agile Methods – Contracts • Traditionally, contracts tend to require a complete requirements specification for pricing purposes. • The emergent nature of requirements in agile methods means that a contract based on a full requirements specification is impossible. • Rather, agile requires a different type of contract: one based on an estimate of time and resources per release. • Such contracts shift all the risk onto the customer. • Customers might not be willing to accept a significantly increased levels of risk in contract negotiations.
Agile Methods – Maintenance • Many systems have a long lifespan. They require significant maintenance over a significant period of time. • This poses several problems for agile methods: • Absence of detailed system documentation • Keeping customers involved in the development process • Maintaining the continuity of the development team.
Agile Methods – Teams • Agile is premised on the idea of small, co-located teams working on a single homogenous system. • However, large systems are often a collection of systems rather than a single system. • These complex, multi-faceted systems often require distributed teams, often working across time zones, using sophisticated groupware. • This requires a level of planning and control that is anathema to agile methods.
Agile Methods – Organisations • The culture and structure of larger organisations are often incompatible with agile methods • Bureaucratic and have inflexible decision making processes • Rigid quality and change management procedures • Risk averse • Long-term planning cycle • However, there are examples of large organisations who have successfully utilised an agile approach to software development: • Spotify • Barclays • Microsoft
Large system development (I) • Large systems are usually collections of separate, communicating systems • separate teams develop each system. • these teams are working in different places (different time zones) • Large systems are ‘brownfield systems’, • they include and interact with a number of existing systems. • Many of the system requirements are concerned with this interaction • so don’t really lend themselves to flexibility and incremental development. • System configuration rather than original code development.
Large system development (II) • Large systems and their development processes are often constrained by external rules and regulations limiting the way that they can be developed. • Large systems have a long procurement and development time. • It is difficult to maintain coherent teams who know about the system over that period (as, inevitably, people move on to other jobs and projects). • Large systems usually have a diverse set of stakeholders. • It is practically impossible to involve all of these different stakeholders in the development process.
Scaling up to large systems • A completely incremental approach to requirements engineering is impossible. • There cannot be a single product owner or customer representative. • For large systems development, it is not possible to focus only on the code of the system. • Cross-team communication mechanisms have to be designed and used. • Continuous integration is practically impossible. However, it is essential to maintain frequent system builds and regular releases of the system.
Agile or Plan-driven? • Factors to consider when selecting a plan-driven or agile software development approach.
Agile project management • The principal responsibility of software project managers is to manage the project so that the software is delivered on time and within the planned budget for the project. • Standard approach: plan-driven • Managers draw up a plan for the project showing: what should be delivered, when it should be delivered, and who will work on the development of the project deliverables. • Agile project management requires a different approach, which is adapted to incremental development and the practices used in agile methods.
Scrum • Scrum is an agile method that focuses on managing iterative development rather than specific agile practices. • There are three phases in Scrum. • The initial phase is an outline planning phase where you establish the general objectives for the project and design the software architecture. • This is followed by a series of sprint cycles, where each cycle develops an increment of the system. • The project closure phase wraps up the project • completes required documentation such as system help frames and user manual • assesses the lessons learned from the project.
Scrum sprint cycle • Sprints are fixed length, normally 2–4 weeks. • The starting point for planning is the product backlog, which is the list of work to be done on the project. • The selection phase involves all of the project team who work with the customer to select the features and functionality from the product backlog to be developed during the sprint.
The Sprint Cycle • Once these are agreed, the team organise themselves to develop the software. • During this stage the team is isolated from the customer and the organisation, with all communications channelled through the so-called ‘Scrum master’. • The role of the Scrum master is to protect the development team from external distractions. • At the end of the sprint, the work done is reviewed and presented to stakeholders. The next sprint cycle then begins.
Teamwork in Scrum • The ‘Scrum master’ is a facilitator who arranges daily meetings, tracks the backlog of work to be done, records decisions, measures progress against the backlog and communicates with customers and management outside of the team. • The whole team attends short daily meetings (Scrums) where • all team members share information, • describe their progress since the last meeting, problems that have arisen and what is planned for the following day. • This means that everyone on the team knows what is going on and, if problems arise, can re-plan short-term work to cope with them.
Scrum benefits • The product is broken down into a set of manageable and understandable chunks. • Unstable requirements do not hold up progress. • The whole team have visibility of everything and consequently team communication is improved. • Customers see on-time delivery of increments and gain feedback on how the product works. • Trust between customers and developers is established and a positive culture is created in which everyone expects the project to succeed.
Class activity • Extreme programming – user stories, tasks and acceptance tests (see modules) • EX 3.1, 3.2, 3.3