Copyright © 2020, Pearson Education, Inc. All Rights Reserved
Chapter 2
Agile Software Engineering
First Edition
Engineering Software Products
2 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
2 – ‹#›
Software products must be brought to market quickly so rapid software development and delivery is essential.
Virtually all software products are now developed using an agile approach.
Agile software engineering focuses on delivering functionality quickly, responding to changing product specifications and minimizing development overheads.
Agile software engineering (1 of 2)
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
2 – ‹#›
A large number of ‘agile methods’ have been developed.
There is no ‘best’ agile method or technique.
It depends on who is using the technique, the development team and the type of product being developed
Agile software engineering (2 of 2)
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
2 – ‹#›
Plan-driven development evolved to support the engineering of large, long-lifetime systems (such as aircraft control systems) where teams may be geographically dispersed and work on the software for several years.
This approach is based on controlled and rigorous software development processes that include detailed project planning, requirements specification and analysis and system modelling.
However, plan-driven development involves significant overheads and documentation and it does not support the rapid development and delivery of software.
Agile methods (1 of 2)
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
2 – ‹#›
Agile methods were developed in the 1990s to address this problem.
These methods focus on the software rather than its documentation, develop software in a series of increments and aim to reduce process bureaucracy as much as possible.
Agile methods (2 of 2)
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
2 – ‹#›
We are uncovering better ways of developing software by doing it and helping others to do it. Through this work, we have come to value:
– individuals and interactions over processes and tools;
– working software over comprehensive documentation;
– customer collaboration over contract negotiation;
– responding to change over following a plan.
While there is value on the items on the right, we value the items on the left more.
Table 2.1 The agile manifesto
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
2 – ‹#›
All agile methods are based around incremental development and delivery.
Product development focuses on the software features, where a feature does something for the software user.
With incremental development, you start by prioritizing the features so that the most important features are implemented first.
You only define the details of the feature being implemented in an increment.
That feature is then implemented and delivered.
Users or surrogate users can try it out and provide feedback to the development team. You then go on to define and implement the next feature of the system.
Incremental development
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
2 – ‹#›
Incremental development
Figure 2.1
2 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
2 – ‹#›
Activity Description
Choose features to be included in an
Increment Using the list of features in the planned product, select those features that can be implemented in the next product increment.
Refine feature descriptions Add detail to the feature descriptions so that the team members have a common understanding of each feature and there is sufficient detail to begin implementation.
Implement and test Implement the feature and develop automated tests for that feature that show that its behavior is consistent with its description. I explain automated testing in Chapter 9.
Table 2.2 Incremental development activities (1 of 2)
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
2 – ‹#›
Activity Description
Integrate feature and test Integrate the developed feature with the existing system and test it to check that it works in conjunction with other features.
Deliver system increment Deliver the system increment to the customer or product manager for checking and comments. If enough features have been implemented, release a version of the system
for customer use.
Table 2.2 Incremental development activities (2 of 2)
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
2 – ‹#›
Principle Description
Involve the customer Involve customers closely with the software development team. Their role is to provide and prioritize new system requirements and to evaluate each increment of the system.
Embrace change Expect the features of the product and the details of these features to change as the development team and the product manager learn more about the product. Adapt the software to cope with changes as they are made.
Develop and deliver
Incrementally Always develop software products in increments. Test and evaluate each increment as it is developed and feed back required changes to the development team.
Table 2.3 Agile development principles
(1 of 2)
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
2 – ‹#›
Principle Description
Maintain simplicity Focus on simplicity in both the software being
developed and the development process. Wherever possible, do what you can to eliminate complexity from the system.
Focus on people, not the
development process Trust the development team and do not expect
everyone to always do things in the same way.
Team members should be left to develop their
own ways of working without being limited by
prescriptive software processes.
Description
Table 2.3 Agile development principles
(2 of 2)
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
2 – ‹#›
The most influential work that has changed software development culture was the development of Extreme Programming (XP).
The name was coined by Kent Beck in 1998 because the approach was developed by pushing recognized good practice, such as iterative development, to ‘extreme’ levels.
Extreme programming focused on 12 new development techniques that were geared to rapid, incremental software development, change and delivery.
Extreme programming (1 of 2)
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
2 – ‹#›
Some of these techniques are now widely used; others have been less popular.
The most widely used XP techniques (highlighted in red on the following slide) are explained elsewhere in the book.
Extreme programming (2 of 2)
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
2 – ‹#›
Extreme Programming practices
Figure 2.2
2 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
2 – ‹#›
Practice Description
Incremental planning/ user Stories There is no “grand plan” for the system. Instead,what needs to be implemented (the requirements) in each increment are established in discussions with a customer representative. The requirements are written as user stories. The stories to be included in a release are determined by the time available and their relative priority.
Small releases The minimal useful set of functionality that provides business value is developed first. Releases of the system are frequent and incrementally add functionality to the previous release.
Test-driven development Instead of writing code and then tests for that code, developers write the tests first. This helps clarify what the code should actually do and that there is always a “tested” version of the code available. An automated unit test framework is used to run the tests after every change. New code should not “break” code that has already been implemented.
Table 2.4 Widely adopted XP practices
(1 of 2)
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
2 – ‹#›
Practice Description
Continuous integration As soon as the work on a task is complete, it is integrated into the whole system and a new version of the system is created. All unit tests from all developers are run automatically and must be successful before the new version of the system is accepted.
Refactoring Refactoring means improving the structure, readability, efficiency, and security of a program. All developers are expected to refactor the code as soon as potential code improvements are found. This keeps the code simple and maintainable.
Table 2.4 Widely adopted XP practices
(2 of 2)
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
2 – ‹#›
Software company managers need information that will help them understand how much it costs to develop a software product, how long it will take and when the product can be brought to market.
Plan-driven development provides this information through long-term development plans that identify deliverables – items the team will deliver and when these will be delivered.
Plans always change so anything apart from short-term plans are unreliable.
Scrum is an agile method that provides a framework for agile project organization and planning. It does not mandate any specific technical practices.
Scrum
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
2 – ‹#›
Scrum term Explanation
Product The software product that is being developed by the
Scrum team.
Product Owner A team member who is responsible for identifying product features and attributes. The Product Owner reviews work done and helps to test the product.
Product backlog A to-do list of items such as bugs, features, and product
improvements that the Scrum team has not yet completed.
Development team A small self-organizing team of five to eight people who
are responsible for developing the product.
Sprint A short period, typically two to four weeks, when a product increment is developed.
Scrum A daily team meeting where progress is reviewed and work to be done that day is discussed and agreed.
Table 2.5 Scrum terminology (1 of 2)
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
2 – ‹#›
Scrum term Explanation
ScrumMaster A team coach who guides the team in the effective use of Scrum.
Potentially shippable
product increment The output of a sprint that is of high enough quality to be deployed for customer use.
Velocity An estimate of how much work a team can do in a single sprint.
Table 2.5 Scrum terminology (2 of 2)
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
2 – ‹#›
The Product Owner is responsible for ensuring that the development team are always focused on the product they are building rather than diverted into technically interesting but less relevant work.
In product development, the product manager should normally take on the Product Owner role.
Key roles in Scrum (1 of 2)
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
2 – ‹#›
The ScrumMaster is a Scrum expert whose job is to guide the team in the effective use of the Scrum method. The developers of Scrum emphasize that the ScrumMaster is not a conventional project manager but is a coach for the team. They have authority within the team on how Scrum is used.
In many companies that use Scrum, the ScrumMaster also has some project management responsibilities.
Key roles in Scrum (2 of 2)
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
2 – ‹#›
In Scrum, software is developed in sprints, which are fixed-length periods (2 – 4 weeks) in which software features are developed and delivered.
During a sprint, the team has daily meetings (Scrums) to review progress and to update the list of work items that are incomplete.
Sprints should produce a ‘shippable product increment’. This means that the developed software should be complete and ready to deploy.
Scrum and sprints
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
2 – ‹#›
Scrum cycle
Figure 2.3
2 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
2 – ‹#›
The top five benefits of using Scrum
Figure 2.4
2 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
2 – ‹#›
Product backlog
This is a to-do list of items to be implemented that is reviewed and updated before each sprint.
Timeboxed sprints
Fixed-time (2-4 week) periods in which items from the product backlog are implemented,
Self-organizing teams
Self-organizing teams make their own decisions and work by discussing issues and making decisions by consensus.
Key Scrum practices
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
2 – ‹#›
The product backlog is a list of what needs to be done to complete the development of the product.
The items on this list are called product backlog items (PBIs).
The product backlog may include a variety of different items such as product features to be implemented, user requests, essential development activities and desirable engineering improvements.
The product backlog should always be prioritized so that the items that be implemented first are at the top of the list.
Product backlogs
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
2 – ‹#›
1. As a teacher, I want to be able to configure the group of tools that are
available to individual classes. (feature)
2. As a parent, I want to be able to view my children’s work and the
assessments made by their teachers. (feature)
3. As a teacher of young children, I want a pictorial interface for children with
limited reading ability. (user request)
4. Establish criteria for the assessment of open source software that might be
used as a basis for parts of this system. (development activity)
5. Refactor user interface code to improve understandability and performance.
(engineering improvement)
6. Implement encryption for all personal user data. (engineering improvement)
Table 2.6 Examples of product backlog items
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
2 – ‹#›
Heading Description
Ready for consideration These are high-level ideas and feature descriptions that will be considered for inclusion in the product. They are tentative so may radically change or may not be included
in the final product.
Ready for refinement The team has agreed that this is an important item that should be implemented as part of the current development. There is a reasonably clear definition of what is required. However, work is needed to understand and refine the item.
Ready for implementation The PBI has enough detail for the team to estimate the effort involved and to implement the item. Dependencies on other items have been identified.
Table 2.7 Product backlog item states
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
2 – ‹#›
Product backlog activities
Figure 2.5
2 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
2 – ‹#›
Refinement
Existing PBIs are analysed and refined to create more detailed PBIs. This may lead to the creation of new product backlog items.
Estimation
The team estimate the amount of work required to implement a PBI and add this assessment to each analysed PBI.
Product backlog activities (1 of 2)
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
2 – ‹#›
Creation
New items are added to the backlog. These may be new features suggested by the product manager, required feature changes, engineering improvements, or process activities such as the assessment of development tools that might be used.
Prioritization
The product backlog items are reordered to take new information and changed circumstances into account.
Product backlog activities (2 of 2)
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
2 – ‹#›
Effort required
This may be expressed in person-hours or person-days i.e. the number of hours or days it would take one person to implement that PBI. This is not the same as calendar time. Several people may work on an item, which may shorten the calendar time required.
Story points
Story points are an arbitrary estimate of the effort involved in implementing a PBI, taking into account the size of the task, its complexity, the technology that may be required and the ‘unknown’ characteristics of the work.
PBI estimation metrics (1 of 2)
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
2 – ‹#›
Story points
They were derived originally by comparing user stories, but they can be used for estimating any kind of PBI.
Story points are estimated relatively. The team agree on the story points for a baseline task and other tasks are estimated by comparison with this e.g. more/less complex, larger/smaller etc.
PBI estimation metrics (2 of 2)
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
2 – ‹#›
Products are developed in a series of sprints, each of which delivers an increment of the product or supporting software.
Sprints are short duration activities (1-4 weeks) and take place between a defined start and end date. Sprints are timeboxed, which means that development stops at the end of a sprint whether or not the work has been completed.
During a sprint, the team work on the items from the product backlog.
Timeboxed sprints
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
2 – ‹#›
Benefits of using timeboxed sprints
Figure 2.6
2 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
2 – ‹#›
Sprint planning
Work items to be completed in that sprint are selected and, if necessary, refined to create a sprint backlog. This should not last more than a day at the beginning of the sprint.
Sprint execution
The team work to implement the sprint backlog items that have been chosen for that sprint. If it is impossible to complete all of the sprint backlog items, the sprint is not extended. The unfinished items are returned to the product backlog and queued for a future sprint.
Sprint activities (1 of 2)
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
2 – ‹#›
Sprint reviewing
The work done in the sprint is reviewed by the team and (possibly) external stakeholders. The team reflect on what went well and what went wrong during the sprint with a view to improving their work process.
Sprint activities (2 of 2)
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
2 – ‹#›
Sprint activities
Figure 2.7
2 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
2 – ‹#›
Establish an agreed sprint goal
Sprint goals may be focused on software functionality, support or performance and reliability,.
Decide on the list of items from the product backlog that should be implemented
Create a sprint backlog.
This is a more detailed version of the product backlog that records the work to be done during the sprint
Sprint planning (1 of 2)
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
2 – ‹#›
Sprint goals
Figure 2.8
2 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
2 – ‹#›
In a sprint plan, the team decides which items in the product backlog should be implemented during that sprint.
Key inputs are the effort estimates associated with PBIs and the team’s velocity
The output of the sprint planning process is a sprint backlog.
The sprint backlog is a breakdown of PBIs to show the what is involved in implementing the PBIs chosen for that sprint.
During a sprint, the team have daily meetings (scrums) to coordinate their work.
Sprint planning (2 of 2)
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
2 – ‹#›
A scrum is a short, daily meeting that is usually held at the beginning of the day. During a scrum, all team members share information, describe their progress since the previous day’s scrum, and present problems that have arisen and plans for the coming 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 meetings should be short and focused. To dissuade team members from getting involved in long discussions, scrums are sometimes organized as “stand-up” meetings where there are no chairs in the meeting room.
During a scrum, the sprint backlog is reviewed. Completed items are removed from it.New items may be added to the backlog as new information emerges. The team then decides who should work on sprint backlog items that day.
Table 2.8 Scrums
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
2 – ‹#›
Scrum does not suggest the technical agile activities that should be used. However, I think there are two practices that should always be used in a sprint.
Test automation
As far as possible, product testing should be automated. You should develop a suite of executable tests that can be run at any time.
Continuous integration
Whenever anyone makes changes to the software components they are developing, these components should be immediately integrated with other components to create a system. This system should then be tested to check for unanticipated component interaction problems.
Agile activities
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
2 – ‹#›
State Description
Reviewed The code has been reviewed by another team member who has checked that it meets agreed coding standards, is understandable, includes appropriate comments, and has been refactored if necessary.
Unit tested All unit tests have been run automatically and all tests have
executed successfully.
Integrated The code has been integrated with the project codebase and no integration errors have been reported.
Integration tested All integration tests have been run automatically and all tests have been executed successfully.
Accepted Acceptance tests have been run if appropriate and the Product Owner or the development team has confirmed that the product backlog item has been completed.
Table 2.9 Code completeness checklist
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
2 – ‹#›
At the end of each sprint, there is a review meeting, which involves the whole team. This meeting:
reviews whether or not the sprint has met its goal.
sets out any new problems and issues that have emerged during the sprint.
is a way for a team to reflect on how they can improve the way they work.
Sprint reviews (1 of 2)
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
2 – ‹#›
The product owner has the ultimate authority to decide whether or not the goal of the print has been achieved. They should confirm that the implementation of the selected product backlog items is complete.
The sprint review should include a process review, in which the team reflects on its own way of working and how Scrum has been used.
The aim is to identify ways to improve and to discuss how to use Scrum more productively.
Sprint reviews (2 of 2)
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
2 – ‹#›
Self-organizing teams
Figure 2.9
2 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
2 – ‹#›
The ideal Scrum team size is between 5 and 8 people.
Teams have to tackle diverse tasks and so usually require people with different skills, such as networking, user experience, database design and so on.
They usually involve people with different levels of experience.
A team of 5-8 people is large enough to be diverse yet small enough to communicate informally and effectively and to agree on the priorities of the team.
Team size and composition (1 of 2)
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
2 – ‹#›
The advantage of a self-organizing team is that it can be a cohesive team that can adapt to change.
Because the team rather than individuals take responsibility for the work, they can cope with people leaving and joining the team.
Good team communication means that team members inevitably learn something about each other’s areas
Team size and composition (2 of 2)
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
2 – ‹#›
The developers of Scrum assumed that teams would be co-located. They would work in the same room and could communicate informally.
Daily scrums mean that the team members know what’s been done and what others are doing.
Team coordination (1 of 2)
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
2 – ‹#›
However, the use of daily scrums as a coordination mechanism is based on two assumptions that are not always correct:
Scrum assumes that the team will be made up of full-time workers who share a workspace. In reality, team members may be part-time and may work in different places. For a student project team, the team members may take different classes at different times.
Scrum assumes that all team members can attend a morning meeting to coordinate the work for the day. However, some team members may work flexible hours (e.g. because of childcare responsibilities) or may work on several projects at the same time.
Team coordination (2 of 2)
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
2 – ‹#›
External interactions are interactions that team members have with people outside of the team.
In Scrum, the idea is that developers should focus on development and only the ScrumMaster and Product Owner should be involved in external interactions.
The intention is that the team should be able to work on software development without external interference or distractions.
External interactions
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
2 – ‹#›
Managing external interactions
Figure 2.10
2 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
2 – ‹#›
In all but the smallest product development companies, there is a need for development teams to report on progress to company management.
A self-organizing team has to appoint someone to take on these responsibilities.
Because of the need to maintain continuity of communication with people outside of the group, rotating these activities around team members is not a viable approach.
Project management (1 of 2)
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
2 – ‹#›
The developers of Scrum did not envisage that the ScrumMaster should also have project management responsibilities.
In many companies, however, the ScrumMaster has to take on project management responsibilities.
They know the work going on and are in the best position to provide accurate information and project plans and progress.
Project management (2 of 2)
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
2 – ‹#›
Project management responsibilities
Figure 2.11
2 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
2 – ‹#›
The best way to develop software products is to use agile software engineering methods that are geared to rapid product development and delivery.
Agile methods are based around iterative development and the minimization of overheads during the development process.
Extreme programming (XP) is an influential agile method that introduced agile development practices such as user stories, test-first development and continuous integration. These are now mainstream software development activities.
Key points 1 (1 of 2)
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
2 – ‹#›
Scrum is an agile method that focuses on agile planning and management. Unlike XP, it does not define the engineering practices to be used. The development team may use any technical practices that they believe are appropriate for the product being developed.
In Scrum, work to be done is maintained in a product backlog – a list of work items to be completed. Each increment of the software implements some of the work items from the product backlog.
Key points 1 (2 of 2)
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
2 – ‹#›
Sprints are fixed-time activities (usually 2–4 weeks) where a product increment is developed. Increments should be ‘potentially shippable’ i.e. they should not need further work before they are delivered.
A self-organizing team is a development team that organizes the work to be done by discussion and agreement amongst team members.
Scrum practices such as the product backlog, sprints and self-organizing teams can be used in any agile development process, even if other aspects of Scrum are not used.
Key points 2
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
2 – ‹#›
This work is protected by United States copyright laws and is provided solely for the use of instructors in teaching their courses and assessing student learning. Dissemination or sale of any part of this work (including on the World Wide Web) will destroy the integrity of the work and is not permitted. The work and materials from it should never be made available to students except by instructors using the accompanying text in their classes. All recipients of this work are expected to abide by these restrictions and to honor the intended pedagogical purposes and the needs of other instructors who rely on these materials.
Copyright
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
2 – ‹#›
61
Figure 2.1 Incremental development
Product feature list
If all features are
complete, deliver
system release
Choose features to
be included in
increment
Refine feature
descriptions
Deliver system
increment
Integrate feature
into system
Implement and
test feature
Test-first
development
Refactoring
Pair
programming
Simple
design
On-site
customer
Sustainable
pace
Continuous
integration
Small
releases
Incremental
planning
Collective
ownership
Extreme
programming
Figure 2.2 Extreme programming practices
Scrum
Develop
software
Test
software
Select items
to implement
Plan
sprint
Sprint
Review
sprint
Review product
backlog
Figure 2.3. Scrum cycles
Product
backlog
Shippable
product increment
Sprint
backlog
Start
Product
Progress People
Unstable requirements
do not hold up
progress.
The product is broken
down into a set of
understandable chunks
that stakeholders can
relate to.
Customers see on-time
delivery of increments
and gain feedback on
how the product works.
Team communication is
improved because
everyone can see
everything.
Scrum
bene�ts
Figure 2.4 The top-five benefits of using Scrum
Trust between
customers and
developers is
established and a
positive culture is
created.
Figure 2.5 Product backlog activities
PRODUCT BACKLOG
Creation
Refinement
Estimation
PBI 1
PBI 2
PBI 3
PBI 5
PBI 4
PBI 4
PBI 1.1
PBI 1.2
PBI 3E
PBI 2E
Prioritization
Creation PBI 6
PBI 5
REVISED
PRODUCT BACKLOG
Demonstrable progress
Problem discovery Work planning
There is a tangible output (usually a software
demonstrator) that can be delivered at the end of
every sprint.
If errors and omissions are
discovered the rework required is
limited to the duration of a sprint.
The team develops an understand-
ing of how much work they can do
in a fixed time period.
Time-
boxing
benefits
Figure 2.6 Benefits of using timeboxed sprints
Sprint
planning
Sprint
review
Sprint
backlog
Figure 2.7 Sprint activities
Scrum
Develop
software
Integrate
Sprint
execution
Sprint
backlog
Functional
Support Performance and reliability
Implement user roles so that a user can select
their role when they login to the system
Develop analytics that maintain
information about the time users
spend using each feature of the
system.
Ensure that the login response time is less
than 10 seconds for all users where there are
up to 2000 simultaneous login connections.
Sprint
goals
Figure 2.8 Sprint goals
Self-organizing
team
Figure 2.9 Self-organizing teams
coordinates the work
of the team members
by discussing tasks and
reaching a consensus on
who should do what.
limits the involvement of
engineers in external
interactions with
management and
customers.
makes its own decisions
on schedule and
deliverables.
External interactions
ScrumMaster Product owner
Figure 2.10 Managing external interactions
Product-focused
external interactions
Team-focused
external interactions
Project
management
Reporting
Administration
Figure 2.11 Project management responsibilities
Budget
Schedule
Risks
Problems
Progress
Finance
Compliance
Procurement
Liaison
Vacations
Absence
Work quality
Reviewing
Hiring
People
.MsftOfcThm_Text1_Fill {
fill:#000000;
}
.MsftOfcThm_MainDark1_Stroke {
stroke:#000000;
}
Scrum (1 of 2)
Begin the project with a high-level plan that can be changed on the fly
Success of the project is most important
Individual success is secondary
Project leader has some (not much) influence on the detail
Systems team works within a strict time frame (two to four weeks for development)
Roles Played in Scrum
There are three roles in Scrum:
Product owner
Scrum Master
Team member
Scrum (2 of 2)
Product backlog
Sprint backlog
Sprint
Daily scrum
Demo
Scrum is a high-intensity methodology. It is just one of the approaches that adopts the philosophy of agile modeling.
Product backlog—in which a list is derived from product specifications.
Sprint backlog—a dynamically changing list of tasks to be completed in the next sprint.
Sprint—a 30-day period in which the development team transforms the backlog into software that can be demonstrated.
Daily scrum—a brief meeting in which communication is the number-one rule.
Demo—working software that can be demonstrated to the customer.
4
Product Backlog
Features and other deliverables designers intend for the product based on user stories
The list of user stories is reorganized so that the most important user stories appear on the top
Figure 6.5 A Product Backlog Registry
Sprint Cycle
Stories are deliverables the team accomplishes
Tasks are parts of the story or units of work that each team members does
The sprint cycle can vary in length, but the usual is two weeks
At the end of the cycle, determine whether the product should be released
Two-Week Release Advantages
Team spirit remains high
Completing the product is more real to the team
Continual feedback from customers
Figure 6.6 Teams Work Together to Accomplish a Sprint Cycle
Lessons Learned from Agile Modeling (1 of 2)
Short releases allow the system to evolve
Pair programming enhances the overall quality
Onsite customers are mutually beneficial to the business and the agile development team
Short releases allow the system to evolve—through the use of short releases, the development team compresses the time between releases of their product, improving the product later as the dynamic situation demands.
Pair programming enhances overall quality—fosters good communication, identifying with the customer, focusing on the most valuable aspects of the project first, testing all code as it is developed, and integrating the new code after it successfully passes its tests.
Onsite customers are mutually beneficial to the business and the agile development team—customers serve as a ready reference and reality check, and the focus of the system design will always be maintained via their presence.
10
Other Unique Scrum Features
Scrum planning meeting
Planning poker
Daily meetings
Sprint burndown chart
Sprint review
Scrum Planning Meeting
Two parts to a Scrum planning meeting:
Product owner presents the list of features on the wish list of user stories
Estimate the resources needed to complete all of the features
Common way to do this is to play planning poker
Sprint Burndown Chart
Way to keep track of performance
Horizontal axis tracks the time that has elapsed
Vertical axis may track the number of tasks remaining or the number of hours to complete the remaining tasks
Red line shows hours of work remaining, and the yellow bars show the number of tasks remaining
Figure 6.8 A Burndown Chart
Sprint Review
Team gets together in a meeting to review the work done
Note any tasks that were not completed
User stories completed are prominently documented
User stories the team committed to that were not finished are noted
Kanban
Key elements of the Kanban system as applied to software development are:
Visualize the workflow
Keep work-in-process (W I P) as small as possible
Reevaluate the workflow, reassigning priorities if need be
Strive for continual improvement
Figure 6.9 A Kanban Board
Scrum Advantages (1 of 2)
Advantages:
Quick product development
Exercises a user-oriented approach
Encourages teamwork
Less confusing than more formal approaches
Flexibility
Scrum Advantages (2 of 2)
Advantages:
Satisfying to team members
Rewards smaller but meaningful accomplishments
Provides feedback
Adaptability
Scrum Disadvantages
Disadvantages:
Documenting features improperly
Releasing products with errors
Releasing products too soon for the user
Completing the sprint backlog under pressure
Working as a geographically dispersed team may be difficult
Working as a team when special skills are required may be challenging
Replacing team members who leave the team is difficult
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
Microservices Architecture
Chapter 6
First Edition
Engineering Software Products
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
A software service is a software component that can be accessed from remote computers over the Internet. Given an input, a service produces a corresponding output, without side effects.
The service is accessed through its published interface and all details of the service implementation are hidden.
Services do not maintain any internal state. State information is either stored in a database or is maintained by the service requestor.
Software services (1 of 2)
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
When a service request is made, the state information may be included as part of the request and the updated state information is returned as part of the service result.
As there is no local state, services can be dynamically reallocated from one virtual server to another and replicated across several servers.
Software services (2 of 2)
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
After various experiments in the 1990s with service-oriented computing, the idea of ‘big’ Web Services emerged in the early 2000s.
These were based on XML-based protocols and standards such as SOAP for service interaction and WSDL for interface description.
Most software services don’t need the generality that’s inherent in the design of web service protocols.
Consequently, modern service-oriented systems, use simpler, ‘lighter weight’ service-interaction protocols that have lower overheads and, consequently, faster execution.
Modern web services
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
Microservices are small-scale, stateless, services that have a single responsibility. They are combined to create applications.
They are completely independent with their own database and UI management code.
Software products that use micro services have a microservices architecture.
If you need to create cloud-based software products that are adaptable, scaleable and resilient then I recommend that design them around a microservices architecture.
Microservices
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
System authentication
User registration, where users provide information about their identity, security information, mobile (cell) phone number and email address.
Authentication using UID/password.
Two-factor authentication using code sent to mobile phone.
User information management e.g. change password or mobile phone number.
Reset forgotten password.
A microservice example (1 of 2)
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
Each of these features could be implemented as a separate service that uses a central shared database to hold authentication information.
However, these features are too large to be microservices. To identify the microservices that might be used in the authentication system, you need to break down the coarse-grain features into more detailed functions.
A microservice example (2 of 2)
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
Functional breakdown of authentication features
Figure 6.1
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
Authentication microservices
Figure 6.2
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
Characteristic Explanation
Self-contained Microservices do not have external dependencies. They manage their own data and implement their own user interface.
Lightweight Microservices communicate using lightweight protocols, so that service communication overheads are low.
Implementation
independent Microservices may be implemented using different
programming languages and may use different
technologies (e.g., different types of database) in their
implementation.
Independently
Deployable Each microservice runs in its own process and is
independently deployable, using automated systems.
Business-oriented Microservices should implement business capabilities and needs, rather than simply provide a technical service.
Table 6.1 Characteristics of microservices
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
Microservices communicate by exchanging messages.
A message that is sent between services includes some administrative information, a service request and the data required to deliver the requested service.
Microservice communication (1 of 2)
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
Services return a response to service request messages.
An authentication service may send a message to a login service that includes the name input by the user.
The response may be a token associated with a valid user name or might be an error saying that there is no registered user.
Microservice communication (2 of 2)
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
A well-designed microservice should have high cohesion and low coupling.
Cohesion is a measure of the number of relationships that parts of a component have with each other. High cohesion means that all of the parts that are needed to deliver the component’s functionality are included in the component.
Coupling is a measure of the number of relationships that one component has with other components in the system. Low coupling means that components do not have many relationships with other components.
Microservice characteristics (1 of 2)
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
Each microservice should have a single responsibility i.e. it should do one thing only and it should do it well.
However, ‘one thing only’ is difficult to define in a way that’s applicable to all services.
Responsibility does not always mean a single, functional activity.
Microservice characteristics (2 of 2)
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
Password management functionality
Figure 6.3
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
Microservice support code
Figure 6.4
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
A microservices architecture is an architectural style – a tried and tested way of implementing a logical software architecture.
This architectural style addresses two problems with monolithic applications
The whole system has to be rebuilt, re-tested and re-deployed when any change is made. This can be a slow process as changes to one part of the system can adversely affect other components.
As the demand on the system increases, the whole system has to be scaled, even if the demand is localized to a small number of system components that implement the most popular system functions.
Microservices architecture
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
Microservices are self-contained and run in separate processes.
In cloud-based systems, each microservice may be deployed in its own container. This means a microservice can be stopped and restarted without affecting other parts of the system.
If the demand on a service increases, service replicas can be quickly created and deployed. These do not require a more powerful server so ‘scaling-out’ is, typically, much cheaper than ‘scaling up’.
Benefits of microservices architecture
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
Imagine that you are developing a photo-printing service for mobile devices. Users can upload photos to your server from their phone or specify photos from their Instagram account that they would like to be printed. Prints can be made at different sizes and on different media.
Users can choose print size and print medium. For example, they may decide to print a picture onto a mug or a T-shirt. The prints or other media are prepared and then posted to their home. They pay for prints either using a payment service such as Android or Apple Pay or by registering a credit card with the printing service provider.
Table 6.2 A photo-printing system for mobile devices
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
A microservices architecture for a photo-printing system
Figure 6.5
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
Key design questions for microservices architecture
Figure 6.6
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
Balance fine-grain functionality and system performance
Single-function services mean that changes are limited to fewer services but require service communications to implement user functionality. This slows down a system because of the need for each service to bundle and unbundle messages sent from other services.
Follow the ‘common closure principle’
Elements of a system that are likely to be changed at the same time should be located within the same service. Most new and changed requirements should therefore only affect a single service.
Decomposition guidelines (1 of 2)
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
Associate services with business capabilities
A business capability is a discrete area of business functionality that is the responsibility of an individual or a group. You should identify the services that are required to support each business capability.
Design services so that they only have access to the data that they need
If there is an overlap between the data used by different services, you need a mechanism to propagate data changes to all services using the same data.
Decomposition guidelines (2 of 2)
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
Services communicate by exchanging messages that include information about the originator of the message, as well as the data that is the input to or output from the request.
Service communications (1 of 2)
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
When you are designing a microservices architecture, you have to establish a standard for communications that all microservices should follow. Some of the key decisions that you have to make are
should service interaction be synchronous or asynchronous?
should services communicate directly or via message broker middleware?
what protocol should be used for messages exchanged between services?
Service communications (2 of 2)
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
Synchronous and asynchronous microservice interaction
Figure 6.7
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
In a synchronous interaction, service A issues a request to service B. Service A then suspends processing while B is processing the request.
It waits until service B has returned the required information before continuing execution.
In an asynchronous interaction, service A issues the request that is queued for processing by service B. A then continues processing without waiting for B to finish its computations.
Synchronous and asynchronous interaction (1 of 2)
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
Sometime later, service B completes the earlier request from service A and queues the result to be retrieved by A.
Service A, therefore, has to check its queue periodically to see if a result is available.
Synchronous and asynchronous interaction (2 of 2)
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
Direct and indirect service communication
Figure 6.8
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
Direct service communication requires that interacting services know each other’s address.
The services interact by sending requests directly to these addresses.
Indirect communication involves naming the service that is required and sending that request to a message broker (sometimes called a message bus).
The message broker is then responsible for finding the service that can fulfil the service request.
Direct and indirect service communication
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
You should isolate data within each system service with as little data sharing as possible.
If data sharing is unavoidable, you should design microservices so that most sharing is ‘read-only’, with a minimal number of services responsible for data updates.
If services are replicated in your system, you must include a mechanism that can keep the database copies used by replica services consistent.
Microservice data design
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
An ACID transaction bundles a set of data updates into a single unit so that either all updates are completed or none of them are. ACID transactions are impractical in a microservices architecture.
The databases used by different microservices or microservice replicas need not be completely consistent all of the time.
Inconsistency management (1 of 2)
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
Dependent data inconsistency
The actions or failures of one service can cause the data managed by another service to become inconsistent.
Replica inconsistency
There are several replicas of the same service that are executing concurrently. These all have their own database copy and each updates its own copy of the service data. You need a way of making these databases ‘eventually consistent’ so that all replicas are working on the same data.
Inconsistency management (2 of 2)
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
Eventual consistency is a situation where the system guarantees that the databases will eventually become consistent.
You can implement eventual consistency by maintaining a transaction log.
When a database change is made, this is recorded on a ‘pending updates’ log.
Other service instances look at this log, update their own database and indicate that they have made the change.
Eventual consistency
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
Using a pending transaction log
Figure 6.9
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
Most user sessions involve a series of interactions in which operations have to be carried out in a specific order.
This is called a workflow.
An authentication workflow for UID/password authentication shows the steps involved in authenticating a user.
In this example, the user is allowed 3 login attempts before the system indicates that the login has failed.
Service coordination
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
Authentication workflow
Figure 6.10
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
Orchestration and choreography
Figure 6.11
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
Failure type Explanation
Internal service failure These are conditions that are detected by the service
and can be reported to the service requestor in an error
message. An example of this type of failure is a service
that takes a URL as an input and discovers that this is
an invalid link.
External service failure These failures have an external cause that affects the
availability of a service. Failure may cause the service to become unresponsive and actions have to be taken to restart the service.
Service performance failure The performance of the service degrades to an
unacceptable level. This may be due to a heavy load or
an internal problem with the service. External service
monitoring can be used to detect performance failures
and unresponsive services.
Table 6.3 Failure types in a microservices system
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
A timeout is a counter that this associated with the service requests and starts running when the request is made.
Once the counter reaches some predefined value, such as 10 seconds, the calling service assumes that the service request has failed and acts accordingly.
Timeouts and circuit breakers (1 of 2)
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
The problem with the timeout approach is that every service call to a ‘failed service’ is delayed by the timeout value so the whole system slows down.
Instead of using timeouts explicitly when a service call is made, he suggests using a circuit breaker. Like an electrical circuit breaker, this immediately denies access to a failed service without the delays associated with timeouts.
Timeouts and circuit breakers (2 of 2)
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
Using a circuit breaker to cope with service failure
Figure 6.12
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
The REST (REpresentational State Transfer) architectural style is based on the idea of transferring representations of digital resources from a server to a client.
You can think of a resource as any chunk of data such as credit card details, an individual’s medical record, a magazine or newspaper, a library catalogue, and so on.
Resources are accessed via their unique URI and RESTful services operate on these resources.
RESTful services (1 of 2)
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
This is the fundamental approach used in the web where the resource is a page to be displayed in the user’s browser.
An HTML representation is generated by the server in response to an HTTP GET request and is transferred to the client for display by a browser or a special-purpose app.
RESTful services (2 of 2)
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
Principle Explanation
Use HTTP verbs The basic methods defined in the HTTP protocol (GET, PUT, POST, DELETE) must be used to access the operations made available by the service.
Stateless services Services must never maintain internal state. As I have already explained, microservices are stateless, so fit with this principle.
URI addressable All resources must have a URI, with a hierarchical structure, that is used to access subresources.
Use XML or JSON Resources should normally be represented in JSON or XML or both. Other representations, such as audio and video representations, may be used if appropriate.
Table 6.4 RESTful service principles
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
Action Implementation
Create Implemented using HTTP POST, which creates the resource with the given URI. If the resource has already been created, an error is returned.
Read Implemented using HTTP GET, which reads the resource and returns its value. GET operations should never update a resource so that successive GET operations with no intervening PUT operations always return the same value.
Update Implemented using HTTP PUT, which modifies an existing resource. PUT should not be used for resource creation.
Delete Implemented using HTTP DELETE, which makes the resource inaccessible using the specified URI. The resource may or may not be physically deleted.
Table 6.5 RESTful service operations
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
Imagine a system that maintains information about incidents, such as traffic delays, roadworks and accidents on a national road network. This system can be accessed via a browser using the URL:
https://trafficinfo.net/incidents/
Users can query the system to discover incidents on the roads on which they are planning to travel.
Road information system (1 of 2)
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
When implemented as a RESTful web service, you need to design the resource structure so that incidents are organized hierarchically.
For example, incidents may be recorded according to the road identifier (e.g. A90), the location (e.g. stonehaven), the carriageway direction (e.g. north) and an incident number (e.g. 1). Therefore, each incident can be accessed using its URI:
https://trafficinfo.net/incidents/A90/stonehaven/north/1
Road information system (2 of 2)
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
Incident ID: A90N17061714391
Date: 17 June 2017
Time reported: 1439
Severity: Significant
Description: Broken-down bus on north carriageway. One lane closed. Expect delays of up to 30 minutes.
Table 6.6 Incident description
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
Retrieve
Returns information about a reported incident or incidents. Accessed using the GET verb.
Add
Adds information about a new incident. Accessed using the POST verb.
Update
Updates the information about a reported incident. Accessed using the PUT verb.
Delete
Deletes an incident. The DELETE verb is used when an incident has been cleared.
Service operations
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
HTTP request and response processing
Figure 6.13
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
HTTP request and response message organization
Figure 6.14
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
XML JSON
A90N17061714391
20170617
. . .
Broken-down bus on north carriageway.One lane closed. Expect delays of up to
30 minutes.
id: “A90N17061714391”,
“date”: “20170617”,
“time”: “1437”,
“road_id”: “A90”,
“place”: “Stonehaven”,
“direction”: “north”,
“severity”: “significant”,
“description”: “Broken-down bus on north carriageway. One lane closed. Expect
delays of up to 30 minutes.”
}
Table 6.7 XML and JSON descriptions
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
A GET request and the associated response
Figure 6.15
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
After a system has been developed and delivered, it has to be deployed on servers, monitored for problems and updated as new versions become available.
When a system is composed of tens or even hundreds of microservices, deployment of the system is more complex than for monolithic systems.
The service development teams decide which programming language, database, libraries and other support software should be used to implement their service. Consequently, there is no ‘standard’ deployment configuration for all services.
Service deployment (1 of 2)
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
It is now normal practice for microservice development teams to be responsible for deployment and service management as well as software development and to use continuous deployment.
Continuous deployment means that as soon as a change to a service has been made and validated, the modified service is redeployed.
Service deployment (2 of 2)
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
Continuous deployment depends on automation so that as soon as a change is committed, a series of automated activities is triggered to test the software.
If the software ‘passes’ these tests, it then enters another automation pipeline that packages and deploys the software.
The deployment of a new service version starts with the programmer committing the code changes to a code management system such as Git.
Deployment automation (1 of 2)
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
This triggers a set of automated tests that run using the modified service. If all service tests run successfully, a new version of the system that incorporates the changed service is created.
Another set of automated system tests are then executed. If these run successfully, the service is ready for deployment.
Deployment automation (2 of 2)
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
A continuous deployment pipeline
Figure 6.16
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
Versioned services
Figure 6.17
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
A microservice is an independent and self-contained software component that runs in its own process and communicates with other microservices using lightweight protocols.
Microservices in a system can be implemented using different programming languages and database technologies.
Microservices have a single responsibility and should be designed so that they can be easily changed without having to change other microservices in the system.
Key points 1 (1 of 2)
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
Microservices architecture is an architectural style in which the system is constructed from communicating microservices. It is well-suited to cloud based systems where each microservice can run in its own container.
The two most important responsibilities of architects of a microservices system are to decide how to structure the system into microservices and to decide how microservices should communicate and be coordinated.
Key points 1 (2 of 2)
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
Communication and coordination decisions include deciding on microservice communication protocols, data sharing, whether services should be centrally coordinated, and failure management.
The RESTful architectural style is widely used in microservice-based systems. Services are designed so that the HTTP verbs, GET, POST, PUT and DELETE, map onto the service operations.
The RESTful style is based on digital resources that, in a microservices architecture, may be represented using XML or, more commonly, JSON.
Key points 2 (1 of 2)
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
Continuous deployment is a process where new versions of a service are put into production as soon as a service change has been made. It is a completely automated process that relies on automated testing to check that the new version is of ‘production quality’.
If continuous deployment is used, you may need to maintain multiple versions of deployed services so that you can switch to an older version if problems are discovered in a newly-deployed service.
Key points 2 (2 of 2)
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
This work is protected by United States copyright laws and is provided solely for the use of instructors in teaching their courses and assessing student learning. Dissemination or sale of any part of this work (including on the World Wide Web) will destroy the integrity of the work and is not permitted. The work and materials from it should never be made available to students except by instructors using the accompanying text in their classes. All recipients of this work are expected to abide by these restrictions and to honor the intended pedagogical purposes and the needs of other instructors who rely on these materials.
Copyright
6 – ‹#›
Copyright © 2020, Pearson Education, Inc. All Rights Reserved
65
User registration
Setup new login id
Setup new password
Setup password recovery information
Setup two-factor authentication
Confirm registration
Authenticate using UID/password
Get login id
Get password
Check credentials
Confirm authentication
Figure 6.1 Functional breakdown of authentication features
UID
management
Password
management
User info
management
UID data
Password data
User data
Authentication
Figure 6.2 Authentication microservices
Figure 6.3 Password management functionality
User functions
Create password
Change password
Check password
Recover password
Supporting functions
Check password validity
Delete password
Backup password database
Recover password database
Check database integrity
Repair password DB
Microservice X
Service functionality
Message
management
UI
implementation
Failure
management
Data consistency
management
Figure 6.4 Microservice support code
Mobile
app API gateway
Authentication
Figure 6.5 A microservices architecture for a photo printing system
SERVICES
Registration
Upload
Payment
Printing
Despatch
What are the microservices that
make up the system?
How should microservices
communicate with each other?
How should the microservices
in the system be coordinated?
How should service failure be
detected, reported and managed?
How should data be
distributed and shared?
Microservices
architecture
design
Figure 6.6 Microservices architecture – key design questions
Service A
Figure 6.7 Synchronous and asynchronous microservice interaction
Calls
Returns
Requests (B)
Synchronous – A waits for B
Asynchronous – A and B execute concurrently
Queue B Queue A
Requests (A)
Service B
Service A
Processing Waiting Processing
Processing Processing
Processing Processing
ProcessingProcessing
Service B
Figure 6.8 Direct and indirect service communication
Direct communication – A and B send messages to each other
Indirect communication – A and B communicate through a message broker
Message broker
Service A Service B
Service A Service B
Pending transactions log
A1/DB update 1
A1/DB update 2
A2/DB update 1
Figure 6.9 Using a pending transactions log
Service A1
Database A
Service A2
Database A
End
Retry
login
Get login
Start
End
Check
login
Get
password
Check
password
Indicate
failure
login OK
login invalid
password OK
password
invalid
attempts > 3
attempts = 1
authfail = F
authfail=T
Figure 6.10 Authentication workflow
authfail = F
Increment
attempts
attempts <= 3 authfail = T authfail=F Authentication controller Service orchestration Service choreography Figure 6.11 Orchestration and choreography Authentication eventsLogin service Password service Login service Password service Circuit breaker Check S2 availability retries>3
retries<=3 timeout ok timeout fail S2 available S2 unavailable Figure 6.12 Using a circuit breaker to cope with service failure Service S1 Service S2 Set timeout Route service request Respond S2 unavailable Set S2 unavailable Route service response Increment retries Check timeout HTTP request HTTP response Service actions Microservice Figure 6.13 HTTP request and response processing Request processing Response generation [Request header] [Request body] REQUEST [HTTP verb] [URI] [HTTP version] Figure 6.14 HTTP request and response message organisation [Response header] [Response body] RESPONSE [Response code][HTTP version] REQUEST GET HTTP/1.1 ... Content-Length: 461 Content-Type: text/json RESPONSE HTTP/1.1 Figure 6.15 A GET request and the associated response 200incidents/A90/stonehaven/ Host: trafficinfo.net ... Accept: text/json, text/xml, text/plain Content-Length: 0 { “number”: “A90N17061714391”, “date”: “20170617”, “time”: “1437”, “road_id”: “A90”, “place”: “Stonehaven”, “direction”: “north”, “severity”: “significant”, “description”: “Broken-down bus on north carriageway. One lane closed. Expect delays of up to 30 minutes.” } { “number”: “A90S17061713001”, “date”: “20170617”, “time”: “1300”, “road_id”: “A90”, “place”: “Stonehaven”, “direction”: “south”, “severity”: “minor”, “description”: “Grass cutting on verge. Minor delays” } Commit change to version manage- ment Triggers pass Reject change Reject change Reject change Reject change pass pass fail fail fail Figure 6.16 A continuous deployment pipeline Run unit tests Containerize service Run integration tests Build test system Replace current service Deploy service container Run acceptance tests fail pass API gateway cameras service request for cameras service Figure 6.17 Versioned services current version link service response cameras service response monitor response Service monitor cameras 001 cameras 002 .MsftOfcThm_Text1_Fill { fill:#000000; } .MsftOfcThm_MainDark1_Stroke { stroke:#000000; }
We provide professional writing services to help you score straight A’s by submitting custom written assignments that mirror your guidelines.
Get result-oriented writing and never worry about grades anymore. We follow the highest quality standards to make sure that you get perfect assignments.
Our writers have experience in dealing with papers of every educational level. You can surely rely on the expertise of our qualified professionals.
Your deadline is our threshold for success and we take it very seriously. We make sure you receive your papers before your predefined time.
Someone from our customer support team is always here to respond to your questions. So, hit us up if you have got any ambiguity or concern.
Sit back and relax while we help you out with writing your papers. We have an ultimate policy for keeping your personal and order-related details a secret.
We assure you that your document will be thoroughly checked for plagiarism and grammatical errors as we use highly authentic and licit sources.
Still reluctant about placing an order? Our 100% Moneyback Guarantee backs you up on rare occasions where you aren’t satisfied with the writing.
You don’t have to wait for an update for hours; you can track the progress of your order any time you want. We share the status after each step.
Although you can leverage our expertise for any writing task, we have a knack for creating flawless papers for the following document types.
Although you can leverage our expertise for any writing task, we have a knack for creating flawless papers for the following document types.
From brainstorming your paper's outline to perfecting its grammar, we perform every step carefully to make your paper worthy of A grade.
Hire your preferred writer anytime. Simply specify if you want your preferred expert to write your paper and we’ll make that happen.
Get an elaborate and authentic grammar check report with your work to have the grammar goodness sealed in your document.
You can purchase this feature if you want our writers to sum up your paper in the form of a concise and well-articulated summary.
You don’t have to worry about plagiarism anymore. Get a plagiarism report to certify the uniqueness of your work.
Join us for the best experience while seeking writing assistance in your college life. A good grade is all you need to boost up your academic excellence and we are all about it.
We create perfect papers according to the guidelines.
We seamlessly edit out errors from your papers.
We thoroughly read your final draft to identify errors.
Work with ultimate peace of mind because we ensure that your academic work is our responsibility and your grades are a top concern for us!
Dedication. Quality. Commitment. Punctuality
Here is what we have achieved so far. These numbers are evidence that we go the extra mile to make your college journey successful.
We have the most intuitive and minimalistic process so that you can easily place an order. Just follow a few steps to unlock success.
We understand your guidelines first before delivering any writing service. You can discuss your writing needs and we will have them evaluated by our dedicated team.
We write your papers in a standardized way. We complete your work in such a way that it turns out to be a perfect description of your guidelines.
We promise you excellent grades and academic excellence that you always longed for. Our writers stay in touch with you via email.