Continuous Feature
  Development
What is feature ?
“A set of client's expected
  functional behaviors”
Feature development ?
“Incrementally building
 expected functional
      behaviors”
Why it is continuous ?
•   Client’s expectation changed
•   Business changed
•   User’s perception changed
•   Competitive advantages
•   Rebranding
Yes! That’s why we call
Continues Feature Development
Continuous Feature Development
              Challenges ?
•   Integrating new feature
•   Maintaining existing stability
•   Maintaining new development
•   Making sure of seamless integration
•   Managing trust
How we are managing them ?
we leave the broken
system  alone and let the
    client shout on us.
Really!
YES!, due to client’s fault since
they pushed and wanted faster
           release
How about you guys ?

  May be ? Not always!
How it should be (buzz words) ?
•   Acceptance test driven development
•   Test Driven Development
•   Behavior Driven Development
•   Continuous Integration
How we are practicing instead!
#1 Collecting acceptance criteria
•   Know what exactly client wants
•   Ask lotta questions to get full picture
•   Ask for mockup
•   Split story into several acceptance criteria
• For example –
  User wants to login
   – Which user ? – any user
   – Requires what ? – user id and password
   – How many attempts ? – probably 3
Available tools
•   Pivotal tracker – http://pivotaltracker.com/
•   You can use any issue tracker
•   Trello Board - http://trello.com
•   Trac (or any wiki)
•   Or notepad
#2 Test first development
        ’Login'
with valid email and password
 it should say 'Login successful'
 it should create user session

with wrong email address
 it should say ‘unsuccessful login'
 it should not create user session

with wrong password
 it should say ’unsuccessful login'
 it should not create user session
Available PHP solutions
• BDD framework
  – Cuke4php http://rubygems.org/gems/cuke4php
  – Behat http://behat.org/
  – PHPUnit http://bit.ly/9McVAs
• Unit testing framework
  – PHPUnit http://www.phpunit.de/
  – SimpleTest http://simpletest.org/
BDD using Behat 1
Feature: ls
 In order to see the directory structure
 As a UNIX user
 I need to be able to list the current directory's contents

 Scenario: List 2 files in a directory
  Given I am in a directory "test"
  And I have a file named ”file1.txt"
  And I have a file named ”file2.txt"
  When I run "ls"
  Then I should get:
   """
   file1.txt
   file2.txt
BDD using Behat 2
class FeatureContext extends BehatContext
{
  /**
   * @Given /^I am in a directory "([^"]*)"$/
   */
  public function iAmInADirectory($dir)
  {
     if (!file_exists($dir)) {
        mkdir($dir);
     }
     chdir($dir);
  }
}                              Source - http://docs.behat.org/quick_intro.html
Unit test using PHPUnit
class ArrayTest extends PHPUnit_Framework_TestCase {
   public function testNewArrayIsEmpty() {
     $fixture = array();
     $this->assertEquals(0, sizeof($fixture));
   }

    public function testArrayContainsAnElement() {
      $fixture = array();
      $fixture[] = 'Element';
      $this->assertEquals(1, sizeof($fixture));
    }
}
                   Source - http://www.phpunit.de/manual/3.2/en/writing-tests-
                   for-phpunit.html
#3 Don’t say “Hello it’s done” without
           running all tests
Available PHP solutions
• Almost all standard IDEs
  – PhpStorm
  – NetBeans
  – Eclipse
#4 Code in feature branch NOT in
                    master!




• Master (Main code stream)
  – Branches
     • Fix_bug_with_validation
     • Add_xyz_module
     • Migrate_to_php_5_3
Example using GIT
• Create new branch
  – $ git branch < branch name >

• Checkout specific branch
  – $ git checkout < branch name >

• Update branch from master
  – $ git rebase master
#5 Code review
Available solutions
• Github provides pull request based code
  review – http://github.com
• Retrospectiva -
  https://github.com/dim/retrospectiva
• Trac code review module
• Crucible -
  http://www.atlassian.com/software/crucible/
  overview
• http://code.google.com/p/gerrit/
#6 Maintain production branch

         Features


Master


Features
                     Production
                     Branch
#7 Use staging server
• Deploy in staging server first
• Run test suites
• If not passes test go through
  – Fix again – write supporting test – deploy in
    staging server - Retest – Human test
#8 Continuous Integration
                                         CI ser ver

                   Code repositor y


Dev




Build failed

Build successful

                                      Staging/ test/ qa ser ver
Available PHP solutions
• Jenkins - http://jenkins-ci.org/
• phpUnderControl -
  http://phpundercontrol.org/
• Xinc - http://code.google.com/p/xinc/
#9 Ensure revertible deployment
Let’s summarize our talk
• #1 Collecting acceptance criteria
• #2 Test first development
• #3 Don’t say “Hello it’s done”
  without running all tests
• #4 Code in feature branch NOT in master
• #5 Code review
• #6 Maintain production branch
• #7 Use staging server
• #8 Continuous Integration
• #9 Ensure revertible deployment
I guess that’s all for today !

      Thanks for joining us.
Who are we ?
nafi ul karim                    nhm tanveer hossain
senior software engineer,        khan (hasan)
somewhere in…                    head of technology,
nafi@somewherein.net             somewhere in…
                                 founder, www.khadok.com
                                 hasan@somewherein.net
passion – new stuffs,
diversity on work,
challenges, learning new         work for fun!
things, open to all languages.   Code on rails, java, node.js,
                                 php

Continuous feature-development

  • 1.
  • 2.
  • 3.
    “A set ofclient's expected functional behaviors”
  • 4.
  • 5.
    “Incrementally building expectedfunctional behaviors”
  • 6.
    Why it iscontinuous ? • Client’s expectation changed • Business changed • User’s perception changed • Competitive advantages • Rebranding
  • 7.
    Yes! That’s whywe call Continues Feature Development
  • 8.
    Continuous Feature Development Challenges ? • Integrating new feature • Maintaining existing stability • Maintaining new development • Making sure of seamless integration • Managing trust
  • 9.
    How we aremanaging them ?
  • 10.
    we leave thebroken system  alone and let the client shout on us.
  • 11.
    Really! YES!, due toclient’s fault since they pushed and wanted faster release
  • 12.
    How about youguys ? May be ? Not always!
  • 13.
    How it shouldbe (buzz words) ? • Acceptance test driven development • Test Driven Development • Behavior Driven Development • Continuous Integration
  • 14.
    How we arepracticing instead!
  • 15.
    #1 Collecting acceptancecriteria • Know what exactly client wants • Ask lotta questions to get full picture • Ask for mockup • Split story into several acceptance criteria • For example – User wants to login – Which user ? – any user – Requires what ? – user id and password – How many attempts ? – probably 3
  • 16.
    Available tools • Pivotal tracker – http://pivotaltracker.com/ • You can use any issue tracker • Trello Board - http://trello.com • Trac (or any wiki) • Or notepad
  • 17.
    #2 Test firstdevelopment ’Login' with valid email and password it should say 'Login successful' it should create user session with wrong email address it should say ‘unsuccessful login' it should not create user session with wrong password it should say ’unsuccessful login' it should not create user session
  • 18.
    Available PHP solutions •BDD framework – Cuke4php http://rubygems.org/gems/cuke4php – Behat http://behat.org/ – PHPUnit http://bit.ly/9McVAs • Unit testing framework – PHPUnit http://www.phpunit.de/ – SimpleTest http://simpletest.org/
  • 19.
    BDD using Behat1 Feature: ls In order to see the directory structure As a UNIX user I need to be able to list the current directory's contents Scenario: List 2 files in a directory Given I am in a directory "test" And I have a file named ”file1.txt" And I have a file named ”file2.txt" When I run "ls" Then I should get: """ file1.txt file2.txt
  • 20.
    BDD using Behat2 class FeatureContext extends BehatContext { /** * @Given /^I am in a directory "([^"]*)"$/ */ public function iAmInADirectory($dir) { if (!file_exists($dir)) { mkdir($dir); } chdir($dir); } } Source - http://docs.behat.org/quick_intro.html
  • 21.
    Unit test usingPHPUnit class ArrayTest extends PHPUnit_Framework_TestCase { public function testNewArrayIsEmpty() { $fixture = array(); $this->assertEquals(0, sizeof($fixture)); } public function testArrayContainsAnElement() { $fixture = array(); $fixture[] = 'Element'; $this->assertEquals(1, sizeof($fixture)); } } Source - http://www.phpunit.de/manual/3.2/en/writing-tests- for-phpunit.html
  • 22.
    #3 Don’t say“Hello it’s done” without running all tests
  • 23.
    Available PHP solutions •Almost all standard IDEs – PhpStorm – NetBeans – Eclipse
  • 24.
    #4 Code infeature branch NOT in master! • Master (Main code stream) – Branches • Fix_bug_with_validation • Add_xyz_module • Migrate_to_php_5_3
  • 25.
    Example using GIT •Create new branch – $ git branch < branch name > • Checkout specific branch – $ git checkout < branch name > • Update branch from master – $ git rebase master
  • 26.
  • 27.
    Available solutions • Githubprovides pull request based code review – http://github.com • Retrospectiva - https://github.com/dim/retrospectiva • Trac code review module • Crucible - http://www.atlassian.com/software/crucible/ overview • http://code.google.com/p/gerrit/
  • 28.
    #6 Maintain productionbranch Features Master Features Production Branch
  • 29.
    #7 Use stagingserver • Deploy in staging server first • Run test suites • If not passes test go through – Fix again – write supporting test – deploy in staging server - Retest – Human test
  • 30.
    #8 Continuous Integration CI ser ver Code repositor y Dev Build failed Build successful Staging/ test/ qa ser ver
  • 31.
    Available PHP solutions •Jenkins - http://jenkins-ci.org/ • phpUnderControl - http://phpundercontrol.org/ • Xinc - http://code.google.com/p/xinc/
  • 32.
  • 33.
    Let’s summarize ourtalk • #1 Collecting acceptance criteria • #2 Test first development • #3 Don’t say “Hello it’s done” without running all tests • #4 Code in feature branch NOT in master • #5 Code review • #6 Maintain production branch • #7 Use staging server • #8 Continuous Integration • #9 Ensure revertible deployment
  • 34.
    I guess that’sall for today ! Thanks for joining us.
  • 35.
    Who are we? nafi ul karim nhm tanveer hossain senior software engineer, khan (hasan) somewhere in… head of technology, [email protected] somewhere in… founder, www.khadok.com [email protected] passion – new stuffs, diversity on work, challenges, learning new work for fun! things, open to all languages. Code on rails, java, node.js, php

Editor's Notes

  • #4 Explain about client
  • #7 Offline businessOnline businessBranded clothingAll these occurs development