Continuous Integration:  Improving Software Quality and Reducing Risk Preetam Palwe Aftek Limited
One more title   Do you love bugs ? Or  Are you in love with QC members?   …  [Courtesy: Smita N]
Agenda Motivation Practices Advantages The road ahead Q&A
Motivation “ Enter laptops, enter boards and put together with code, all teams have come together in one abode. Integration in progress.”   …  taken from an article published in AForce March 2008 Admin Utility User now can be associated with the profile and action like send sms, call to a specific person or play welcome message on entering in the home. The UI part for above feature is implemented by XYZ. And backend part is implemented by PQR.  Integration of the same is pending and will integrate on next week. …  taken from an weekly status report sent in 1 st  week of March 2008 So ???
Motivation Integration  is an EVENT !!! Can we have something like following? Image Courtesy: Book on CI by PMD
What is CI? Continuous Integration is a software development practice where members of a team integrate their work frequently, usually each person integrates at least daily - leading to multiple integrations per day. Each integration is verified by an automated build (including test) to detect integration errors as quickly as possible. Many teams find that this approach leads to significantly reduced integration problems and allows a team to develop cohesive software more rapidly.  …  taken from Martin Fowlers article on CI
Agile manifesto Individuals and interactions  <OVER>   processes and tools Working software  <OVER>   comprehensive documentation Customer collaboration  <OVER>   contract negotiation Responding to change  <OVER>   following a plan That is, while there is value in the items on the right, we value the items on the left more.
Agile principles Our highest priority is to satisfy the customer through early and continuous delivery of valuable software. Welcome changing requirements, even late in development. Agile processes harness change for the customer's competitive advantage. Deliver working software frequently, from a couple of weeks to a couple of months, with a preference to the shorter time scale. Business people and developers must work together daily throughout the project. Build projects around motivated individuals. Give them the environment and support they need, and trust them to get the job done.
Agile principles (contd) The most efficient and effective method of conveying information to and within a development team is face-to-face conversation. Working software is the primary measure of progress. Agile  processes promote sustainable development. The sponsors, developers, and users should be able to maintain a constant pace indefinitely. Continuous attention to technical excellence and good design enhances agility. Simplicity—the art of maximizing the amount of work not done—is essential. The best architectures, requirements, and designs emerge from self-organizing teams. At regular intervals, the team reflects on how to become more effective, then tunes and adjusts its behavior accordingly.
Adaptive (agile) vs  Predictive (plan-driven) Agile home ground Low criticality Senior developers Requirements change very often Small number of developers Culture that thrives on chaos Plan-driven home ground High criticality Junior developers Requirements don't change too often Large number of developers Culture that demands order
Extreme programming Form of agile software development Traditional software engineering practices taken to so-called &quot;extreme&quot; levels—leads to a development process that is more responsive to customer needs (&quot;agile&quot;) than traditional methods, while creating software of better quality. Values and/or principles Communication Simplicity Feedback Courage Respect Activities Coding Testing Listening Designing
XP practices Fine scale feedback Pair programming Planning Game Test driven development Whole team Continuous process Continuous Integration Refactoring or Design Improvement Small Releases Shared understanding Coding Standards Collective Code Ownership Simple Design System Metaphor Programmer welfare Sustainable pace
Coming back to CI Continuous Integration is a software development practice where members of a team integrate their work frequently, usually each person integrates at least daily - leading to multiple integrations per day. Each integration is verified by an automated build (including test) to detect integration errors as quickly as possible. Many teams find that this approach leads to significantly reduced integration problems and allows a team to develop cohesive software more rapidly.  …  taken from Martin Fowlers article on CI
Practices Maintain a single source repository Keep everything needed for build in CVS E.g. code, database schema, IDE configuration, test scripts etc but not application server and jdk. Even no build artifacts! Keep branches to minimum (in size and in lifetime)
Practices Automate the build From compilation to deployment Configure the build: Master build on server  Developers build from IDE Build with test, without test or different set of tests!
Processes Make your build self-testing High degrees of automated tests suits to check larger code base Though TDD not mandatory but its helpful Test case failed: build failed! XUnit tools like JUnit and/or end-to-end testing tools like selenium  Imperfect tests, run frequently, are much better than perfect tests that are never written at all.
Processes Everyone commits every day Every commit shall succeed the build Frequent commits: small work packets for developer Mentoring and practice is the key  
Processes Every commit should build the mainline on an integration machine You shouldn’t go home until the mainline build has passed with any commits you’ve added late in the day! Don’t check in untested / broken code Don’t check in when build is broken The whole point of CI is to detect integration errors as soon as possible Peers pressure within team ensures policies are followed  
Processes Keep the build fast XP guideline: 10 mins build! Staged build (build pipeline) Commit build Secondary build  Performance build If secondary build fails move the test case to commit build Parallel builds
Processes Test in a clone of production environment Every environmental difference results in a risk: what happens under test wont happen in production E.g. Same IP, port, machine, hardware, os etc Virtualization can help
Processes Make it easy for anyone to get the latest executable Its very hard to specify what you want in advance and be correct; people find it much easier to see something that’s not quite right and say how it needs to be changed Many executables in a day so not in CVS
Processes Everyone can see what's happening  CI is all about communication Build status indicators: lava lamps, colored labels, hooters, mails  Build history and build status reports indicates the project “health”  Matrices are helpful to guide project management
Processes Automate deployment Use deployment pipeline  Automated rollback
Advantages Reduces risk Integration is predictable now We know where we are, what works, what doesn't work, how many outstanding bugs are there Makes dramatically easier to find and remove bugs Bugs - these are the nasty things that destroy confidence and mess up schedules and reputations. Bugs in deployed software make users angry with you. Bugs in work in progress get in your way, making it harder to get the rest of the software working correctly.  Broken windows syndrome Break Barriers between customer and development Add more features rapidly, give rapid feedback
The road ahead Just give it a try Start with commit build Add some automated test Use deployment pipeline Speed up the build Integrate with anything and everything available like project management tools, bug trackers, code analysis tools etc
Deployment pipeline Image Courtesy: Paper on Deployment Pipeline by Dave Farley
Cruise control Open source CI toolkit from ThoughtWorks Support for different plugins like email, source control, builder, ant etc Support of web ui for build status Integrate with many code analysis tools, scm tools, build tools, reporting tools etc
Cruise control Image Courtesy: CC documentation on cc website
References http://martinfowler.com/articles/continuousIntegration.html http://en.wikipedia.org/wiki/Agile_software_development http://en.wikipedia.org/wiki/Extreme_Programming http:// cruisecontrol.sourceforge.net /
Q&A Thanks!

Continuous Integration

  • 1.
    Continuous Integration: Improving Software Quality and Reducing Risk Preetam Palwe Aftek Limited
  • 2.
    One more title  Do you love bugs ? Or Are you in love with QC members? … [Courtesy: Smita N]
  • 3.
    Agenda Motivation PracticesAdvantages The road ahead Q&A
  • 4.
    Motivation “ Enterlaptops, enter boards and put together with code, all teams have come together in one abode. Integration in progress.” … taken from an article published in AForce March 2008 Admin Utility User now can be associated with the profile and action like send sms, call to a specific person or play welcome message on entering in the home. The UI part for above feature is implemented by XYZ. And backend part is implemented by PQR. Integration of the same is pending and will integrate on next week. … taken from an weekly status report sent in 1 st week of March 2008 So ???
  • 5.
    Motivation Integration is an EVENT !!! Can we have something like following? Image Courtesy: Book on CI by PMD
  • 6.
    What is CI?Continuous Integration is a software development practice where members of a team integrate their work frequently, usually each person integrates at least daily - leading to multiple integrations per day. Each integration is verified by an automated build (including test) to detect integration errors as quickly as possible. Many teams find that this approach leads to significantly reduced integration problems and allows a team to develop cohesive software more rapidly. … taken from Martin Fowlers article on CI
  • 7.
    Agile manifesto Individualsand interactions <OVER> processes and tools Working software <OVER> comprehensive documentation Customer collaboration <OVER> contract negotiation Responding to change <OVER> following a plan That is, while there is value in the items on the right, we value the items on the left more.
  • 8.
    Agile principles Ourhighest priority is to satisfy the customer through early and continuous delivery of valuable software. Welcome changing requirements, even late in development. Agile processes harness change for the customer's competitive advantage. Deliver working software frequently, from a couple of weeks to a couple of months, with a preference to the shorter time scale. Business people and developers must work together daily throughout the project. Build projects around motivated individuals. Give them the environment and support they need, and trust them to get the job done.
  • 9.
    Agile principles (contd)The most efficient and effective method of conveying information to and within a development team is face-to-face conversation. Working software is the primary measure of progress. Agile processes promote sustainable development. The sponsors, developers, and users should be able to maintain a constant pace indefinitely. Continuous attention to technical excellence and good design enhances agility. Simplicity—the art of maximizing the amount of work not done—is essential. The best architectures, requirements, and designs emerge from self-organizing teams. At regular intervals, the team reflects on how to become more effective, then tunes and adjusts its behavior accordingly.
  • 10.
    Adaptive (agile) vs Predictive (plan-driven) Agile home ground Low criticality Senior developers Requirements change very often Small number of developers Culture that thrives on chaos Plan-driven home ground High criticality Junior developers Requirements don't change too often Large number of developers Culture that demands order
  • 11.
    Extreme programming Formof agile software development Traditional software engineering practices taken to so-called &quot;extreme&quot; levels—leads to a development process that is more responsive to customer needs (&quot;agile&quot;) than traditional methods, while creating software of better quality. Values and/or principles Communication Simplicity Feedback Courage Respect Activities Coding Testing Listening Designing
  • 12.
    XP practices Finescale feedback Pair programming Planning Game Test driven development Whole team Continuous process Continuous Integration Refactoring or Design Improvement Small Releases Shared understanding Coding Standards Collective Code Ownership Simple Design System Metaphor Programmer welfare Sustainable pace
  • 13.
    Coming back toCI Continuous Integration is a software development practice where members of a team integrate their work frequently, usually each person integrates at least daily - leading to multiple integrations per day. Each integration is verified by an automated build (including test) to detect integration errors as quickly as possible. Many teams find that this approach leads to significantly reduced integration problems and allows a team to develop cohesive software more rapidly. … taken from Martin Fowlers article on CI
  • 14.
    Practices Maintain asingle source repository Keep everything needed for build in CVS E.g. code, database schema, IDE configuration, test scripts etc but not application server and jdk. Even no build artifacts! Keep branches to minimum (in size and in lifetime)
  • 15.
    Practices Automate thebuild From compilation to deployment Configure the build: Master build on server Developers build from IDE Build with test, without test or different set of tests!
  • 16.
    Processes Make yourbuild self-testing High degrees of automated tests suits to check larger code base Though TDD not mandatory but its helpful Test case failed: build failed! XUnit tools like JUnit and/or end-to-end testing tools like selenium Imperfect tests, run frequently, are much better than perfect tests that are never written at all.
  • 17.
    Processes Everyone commitsevery day Every commit shall succeed the build Frequent commits: small work packets for developer Mentoring and practice is the key 
  • 18.
    Processes Every commitshould build the mainline on an integration machine You shouldn’t go home until the mainline build has passed with any commits you’ve added late in the day! Don’t check in untested / broken code Don’t check in when build is broken The whole point of CI is to detect integration errors as soon as possible Peers pressure within team ensures policies are followed 
  • 19.
    Processes Keep thebuild fast XP guideline: 10 mins build! Staged build (build pipeline) Commit build Secondary build Performance build If secondary build fails move the test case to commit build Parallel builds
  • 20.
    Processes Test ina clone of production environment Every environmental difference results in a risk: what happens under test wont happen in production E.g. Same IP, port, machine, hardware, os etc Virtualization can help
  • 21.
    Processes Make iteasy for anyone to get the latest executable Its very hard to specify what you want in advance and be correct; people find it much easier to see something that’s not quite right and say how it needs to be changed Many executables in a day so not in CVS
  • 22.
    Processes Everyone cansee what's happening CI is all about communication Build status indicators: lava lamps, colored labels, hooters, mails Build history and build status reports indicates the project “health” Matrices are helpful to guide project management
  • 23.
    Processes Automate deploymentUse deployment pipeline Automated rollback
  • 24.
    Advantages Reduces riskIntegration is predictable now We know where we are, what works, what doesn't work, how many outstanding bugs are there Makes dramatically easier to find and remove bugs Bugs - these are the nasty things that destroy confidence and mess up schedules and reputations. Bugs in deployed software make users angry with you. Bugs in work in progress get in your way, making it harder to get the rest of the software working correctly. Broken windows syndrome Break Barriers between customer and development Add more features rapidly, give rapid feedback
  • 25.
    The road aheadJust give it a try Start with commit build Add some automated test Use deployment pipeline Speed up the build Integrate with anything and everything available like project management tools, bug trackers, code analysis tools etc
  • 26.
    Deployment pipeline ImageCourtesy: Paper on Deployment Pipeline by Dave Farley
  • 27.
    Cruise control Opensource CI toolkit from ThoughtWorks Support for different plugins like email, source control, builder, ant etc Support of web ui for build status Integrate with many code analysis tools, scm tools, build tools, reporting tools etc
  • 28.
    Cruise control ImageCourtesy: CC documentation on cc website
  • 29.
  • 30.