Software Engineering
Dr Kingsley Sage
Copyright By PowCoder代写 加微信 powcoder
More on Agile
• The Agile process
• Test driven development
Testing in XP
• Testing is central to XP and XP has developed an approach where the program is tested after every change has been made.
• XP testing features:
– Test-first development.
– Incremental test development from scenarios.
– User involvement in test development and validation.
– Automated test harnesses are used to run all component tests each time that a new release is built.
Test first development
• Writing tests before code clarifies the requirements to be implemented.
• Tests are written as programs rather than data so that they can be executed automatically. The test includes a check that it has executed correctly.
– Usually relies on a testing framework such as Junit we shall see an example
• All previous and new tests are run automatically when new functionality is added, thus checking that the new functionality has not introduced errors.
Let’s take a look at an example of a JUnit automated test class
• The example here relates to a simple on-line shop application written in Java – the code is on Canvas.
• Consists of a number of class and a unit test class.
• The unit test class does not form part of the main code base, but is used to test that the actual classes are working correctly.
• In XP, nature and scope of tests forms part of a set of test cases.
Test driven development
• In Java, the JUnit test classes provide an automated means of testing classes as they are developed.
• You can take this to an extreme
– Define the tests before ANY significant coding takes place
– And then develop the code until it can pass the tests set out for it
– The concept of “test driven development”
• As testing is automated, there is always a set of tests that can be quickly and easily executed
Challenge of testing
• Programmers prefer programming to testing and sometimes they take short cuts when writing tests. For example, they may write incomplete tests that do not check for all possible exceptions that may occur.
• Some tests can be very difficult to write incrementally. 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, your test set may not provide complete coverage.
Pair programming
• In XP, programmers work in pairs, sitting together to develop code.
• This helps develop common ownership of code and spreads knowledge across the team.
• It serves as an informal review process as each line of code is looked at by more than 1 person.
• It encourages refactoring as the whole team can benefit from this.
• Measurements suggest that development productivity with pair programming is similar to that of two people working independently.
Advantages of pair programming
• It supports the idea of collective ownership and responsibility for the system.
– Individuals are not held responsible for problems with the code. Instead, the team has collective responsibility for resolving these problems.
• It acts as an informal review process because each line of code is looked at by at least two people.
• It helps support refactoring, which is a process of software improvement.
– Where pair programming and collective ownership are used, others benefit immediately from the refactoring so they are likely to support the process.
Managing an Agile project
• 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.
• So how does this play out in Agile?
• The Scrum approach is a general agile method but its focus is on managing iterative development rather than specific agile practices.
• The 3 phases of Scrum
– Outline planning phase where you establish the general objectives for the project and design the software architecture.
– A series of Sprint cycles: each cycle develops an iteration of the system.
– Project close phase: documentation produced, produce user manuals and review lessons learned.
• Sprints are fixed length, normally 2–4 weeks. They correspond to the development of a release of the system in XP.
• 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 to be developed during the sprint.
Sprint cycle
• Team organises itself
• During Sprint, team is cutoff from the customer
• All communications channelled through 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.
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.
Scaling up
• A problem with the Agile concept.
• For large systems development, it is not possible to focus only on the code of the system. You need to do more up-front design and system documentation.
• Also a problem from an organisational perspective if you have multiple teams working across different sites.
• Agile teams really need to be co-located to be effective.
• Needs team members with high degree of skills.
• A particular strength of extreme programming is the development of automated tests before a program feature is created. All tests must successfully execute when an increment is integrated into a system.
• The Scrum method is an agile method that provides a project management framework. It is centred round a set of sprints, which are fixed time periods when a system increment is developed.
• Scaling agile methods for large systems is difficult. Large systems need up-front design and some documentation.
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com