Proprietary Material Provided for Training Purposes Only © 2012 Excella Consulting, Inc.

30
(Agile) Engineering Best Practices What everybody needs to know @RichardKCheng Proprietary Material Provided for Training Purposes Only © 2012 Excella Consulting, Inc.

Transcript of Proprietary Material Provided for Training Purposes Only © 2012 Excella Consulting, Inc.

Page 1: Proprietary Material Provided for Training Purposes Only © 2012 Excella Consulting, Inc.

(Agile) Engineering Best PracticesWhat everybody needs to know - @RichardKCheng

Proprietary Material Provided for Training Purposes Only© 2012 Excella Consulting, Inc.

Page 2: Proprietary Material Provided for Training Purposes Only © 2012 Excella Consulting, Inc.

Richard Cheng - @RichardKCheng

◊ Agile trainer & coach

◊ Member of PMI, Scrum Alliance, Agile Alliance, Agile Leadership Network

◊ CST, PMP, CSM, CSPO, CSP, PMI-ACP

◊ Founder & executive committee member of Agile Defense Adoption Proponents Team (ADAPT), the Agile DoD Task Force

◊ Deep expertise in Federal and commercial Agile transformations

[email protected]

Page 3: Proprietary Material Provided for Training Purposes Only © 2012 Excella Consulting, Inc.

◊ Building Quality into the process– Real time identification of quality issues

• Automation– Using the right tools and techniques

21st Century Quality Practices

Page 4: Proprietary Material Provided for Training Purposes Only © 2012 Excella Consulting, Inc.

Benefits*

Assuming 100 defects in 10,000 lines of code

1. Traditional testing finds a defect in about 10 hours

2. Manual code inspections find a defect in 1 hour

3. Automated testing finds a defect every 6 minutes

þ 36% reduction in defect ratewhen integration/regression testing at each code check-in

þ 90% reduction in bugs reaching QAMajor municipal gas utility

þ

þ

þ

þ

þ

95% cut in cost of bugsLarge retail web site

90% cut in defect remediation costGlobal supplier of healthcare equipment

Faster time-to-marketMore features and higher quality

Agility in the marketplaceAdded new functionality 2 weeks before ship

Confidence in the process“Oozing Confidence”

*Sources:• Grant, T. (2005). Continuous integration using cruise control. Northern Virginia Java Users Group (Novajug), Reston, Virginia,

USA.• Fredrick, J. (2008). Accelerate software delivery with continuous integration and testing. Japanese Symposium on Software

Testing, Tokyo, Japan. • Rico, D. F. (2012). The Cost of Quality (CoQ) for Agile vs. Traditional Project Management. Fairfax, VA: Gantthead.Com.

Page 5: Proprietary Material Provided for Training Purposes Only © 2012 Excella Consulting, Inc.

Technology Stacks

◊ .Net◊ Java◊ Python◊ Ruby◊ JavaScript◊ Others….

Page 6: Proprietary Material Provided for Training Purposes Only © 2012 Excella Consulting, Inc.

Don’t Do It All At Once

Do This First1. Version

Control2. Build

Automation 3. Automated

Unit Testing

4. Continuous Integration

Next Do This5. Static Code

Analysis6. Dependency

Management

Then Do This7. Automated

Integration Testing

8. Automated Acceptance Testing

9. Deployment Automation

Page 7: Proprietary Material Provided for Training Purposes Only © 2012 Excella Consulting, Inc.

First Do This

1. Version Control– What: Repository to persist and track version of

code and artifacts – Effort: Low– Sample Tools:

• Traditional – TFS (MS), Subversion• Distributed Version Control (branching and merging) - Git,

Mercurial

Page 8: Proprietary Material Provided for Training Purposes Only © 2012 Excella Consulting, Inc.

First Do This

2. Build Automation– What: One click or one command launch of build

process– Effort: Low– Sample Tools:

• Microsoft – MSBuild, Powershell• Java/Others – Ant, Gradle, Maven

Page 9: Proprietary Material Provided for Training Purposes Only © 2012 Excella Consulting, Inc.

First Do This

3. Automated Unit Testing– What: An automated stand alone test that test a

single unit of the code.– Effort: Medium– Sample Tools:

• Unit test tools: JUnit (Java), NUnit (MS), MS Test (MS)• Advanced tools: Moq, Fluent Assertions

Page 10: Proprietary Material Provided for Training Purposes Only © 2012 Excella Consulting, Inc.

First Do This

4. Continuous Integration– What: Provides frequent verification and

notification of changes to the code and application– Effort: Medium– Sample Tools: Jenkins, Hudson, TFS (MS), TeamCity

Page 11: Proprietary Material Provided for Training Purposes Only © 2012 Excella Consulting, Inc.

Continuous Integration

Build #1compile

unit test

integration test

package

deploy/run

acceptance test

analyze code

Build Report

Version Control

change#1

change#2

BuildServer

Build #2compile

unit test

integration test

package

deploy/run

acceptance test

analyze code

Build Report Email

Failed Build

Page 12: Proprietary Material Provided for Training Purposes Only © 2012 Excella Consulting, Inc.

Continuous Integration

◊ CI involves:– Frequent code check-ins– Regularly scheduled, automated builds– Automated tests– Immediate feedback to developers detailing any

build errors or failed tests

◊ Benefit: – Developers know immediately upon check-in if

their code works and if any other application features were broken as a result

Page 13: Proprietary Material Provided for Training Purposes Only © 2012 Excella Consulting, Inc.

CI Effect on Schedule

Code Phase QA Phase Code Phase QA Phase

Code Phase Code Phase

Code + Test PhaseCode + Test

Phase

Schedule

Release 1 Release 2

Original Plan

Reality

With CI

Page 14: Proprietary Material Provided for Training Purposes Only © 2012 Excella Consulting, Inc.

Benefits of Continuous Integration

◊ Avoids last-minute chaos at release dates◊ Early warnings of broken code ◊ Early warning of conflicting changes ◊ Immediate testing of all changes ◊ High availability of a "current" build for

testing, demo, or release purposes

Page 15: Proprietary Material Provided for Training Purposes Only © 2012 Excella Consulting, Inc.

Don’t Do It All At Once

Do This First1. Version

Control2. Build

Automation 3. Automated

Unit Testing 4. Continuous

Integration

Next Do This5. Static Code

Analysis6. Dependenc

y Management

Then Do This7. Automated

Integration Testing

8. Automated Acceptance Testing

9. Deployment Automation

Page 16: Proprietary Material Provided for Training Purposes Only © 2012 Excella Consulting, Inc.

Next Do This

5) Static Code Analysis– What: Checks for coding standards and code

quality– Effort: Low– Sample Tools: Visual Studio Code Analysis,

FindBugs (Java), PMD, Cobertura, Sonar, CheckStyle

Page 17: Proprietary Material Provided for Training Purposes Only © 2012 Excella Consulting, Inc.

Code Quality

Page 18: Proprietary Material Provided for Training Purposes Only © 2012 Excella Consulting, Inc.

Next Do This

6) Dependency Management– What: Manages 3rd party components and ensure

we have the latest / correct version these components

– Effort: Low– Sample Tools: Gradle, NuGet

Page 19: Proprietary Material Provided for Training Purposes Only © 2012 Excella Consulting, Inc.

Don’t Do It All At Once

Do This First1. Version

Control2. Build

Automation 3. Automated

Unit Testing 4. Continuous

Integration

Next Do This5. Static Code

Analysis6. Dependency

Management

Then Do This7. Automated

Integration Testing

8. Automated Acceptance Testing

9. Deployment Automation

Page 20: Proprietary Material Provided for Training Purposes Only © 2012 Excella Consulting, Inc.

Then Do This

7. Automated Integration Testing– What: Testing interaction between multiple

components to ensure our component dependencies don’t break

– Effort: Medium to High– Sample Tools: DBUnit (Java), NDBUnit (MS)

Page 21: Proprietary Material Provided for Training Purposes Only © 2012 Excella Consulting, Inc.

Then Do This

8. Automated Acceptance Testing– What: Automated testing to ensure the systems

meets business needs– Effort: High– Sample Tools: SpecFlow, Cucumber, FitNess– For Browser Testing: Selenium, WatiN

Page 22: Proprietary Material Provided for Training Purposes Only © 2012 Excella Consulting, Inc.

Automated Tests

◊ Automated tests involves:– Unit tests: Testing of smallest possible piece of code that can

operate in isolation– Integration tests: Testing interaction between multiple

components– Acceptance tests: Testing complete segments of a system to

ensure it meets the business needs

◊ Benefits– Enables rapid discovery of root cause– Reduces defect rate– Saves time in system test– Ensures testing starts early in cycle– Provides for a free regression testing suite

Page 23: Proprietary Material Provided for Training Purposes Only © 2012 Excella Consulting, Inc.

Testing Quadrant

Functional TestsAcceptance Tests

Unit TestsComponent TestsSystem Tests

ShowcasesExploratory TestsUsability Tests

Performance TestsSecurity Tests

Th

e T

eam

Th

e P

rod

uct

Functionality

The Systemfrom Brian Marick

Page 24: Proprietary Material Provided for Training Purposes Only © 2012 Excella Consulting, Inc.

Then Do This

8. Automated Deployment– What: Push button deployment capabilities– Effort: High– Sample Tools: FluentMigrator, Puppet, Octopus

Page 25: Proprietary Material Provided for Training Purposes Only © 2012 Excella Consulting, Inc.

Automated Deployments

Sandbox

ProductionVersion Control

CIServer

DB

Web Server

Web Server

DB

TestDB

Web Server

Web Server

DB

DB

Web Server

Automated NightlyDeployments

Push Button Deployments

Managed Deployments

Page 26: Proprietary Material Provided for Training Purposes Only © 2012 Excella Consulting, Inc.

Benefits of Automated Deployments

◊ Reduces complexity by using standardized script

◊ Reduces risk by re-running same script◊ Reduces cost by speeding up deployment◊ Frees up resources to focus on new features

Page 27: Proprietary Material Provided for Training Purposes Only © 2012 Excella Consulting, Inc.

Team Member’s Bill of Rights

1.Every {team member} shall have two monitors 2.Every {team member} shall have a fast PC 3.Every {team member} shall have their choice of

mouse and keyboard 4.Every {team member} shall have a comfortable

chair 5.Every {team member} shall have a fast internet

connection 6.Every {team member} shall have {effective}

working conditions

Modified from Jeff Atwood’s http://www.codinghorror.com/blog/2006/08/the-programmers-bill-of-rights.html

Page 28: Proprietary Material Provided for Training Purposes Only © 2012 Excella Consulting, Inc.

Useful References

◊ Stephen Ritchie, Pro .NET Best Practices, Apress, 2011.

◊ Paul Duvall, Steve Matyas, and Andrew Glover, Continuous Integration: Improving Software Quality and Reducing Risk, Addison-Wesley, 2007.

◊ Jez Humble, Continuous Delivery: Reliable Software Releases through Build, Test, and Deployment Automation, Addison-Wesley, 2010

Page 29: Proprietary Material Provided for Training Purposes Only © 2012 Excella Consulting, Inc.

Excella ConsultingExperience and Expertise in Agile Solutions

– Coaching– Training– Assessments

– Agile Adoption– Agile Development Teams– Agile PMO

Training Courses– Certified ScrumMaster (CSM)– Certified Scrum Product Owner (CSPO): The Agile Business Analyst– Advanced Certified Scrum Product Owner (CSPO)– Certified Scrum Developer (CSD)– Agile Testing– Agile Business Intelligence and Data Warehousing

See http://www.excella.com/services/agile-training-services.aspx for more information

Page 30: Proprietary Material Provided for Training Purposes Only © 2012 Excella Consulting, Inc.

Contact Information

Richard K [email protected]

m703-967-8620http://www.excella.comTwitter: @RichardKCheng