SlideShare a Scribd company logo
1 of 24
Download to read offline
BDD for RIAs with JavaScript


    2013 Workshop Tour
          Carlos Ble
         carlosble.com
          @carlosble
Warning
This workshop is very demanding so please:

●
  Ask anything you need.
●
  Give me feedback.
●
  Take notes.
●
  Pay attention.
●
  Be responsible.
●
  Get ready to share code with
others.
Effective communication
 Your only goal when communicating should be

    to …   Communicate!
                    Don't talk or write to...
                ●
                  Demonstrate how smart you are
                ●
                  Convince others
                ●
                  Fight others
                ●
                  Avoid the uncomfortable silence
                ●
                  Think out loud

 No one is more important than you, and you are not more
important than anyone else. What others think about you, is
                   not your business.
The seven rules of Angel Lafuente
   1ª. Nunca la palabra antes que el pensamiento.
   2ª. No interrumpir la frase o idea.
   3ª. Frase breve.
   4ª. Mirada interpelante.
   5ª. Gesto libre.
   6ª. Silencios.
   7ª. Velocidad posible y adecuada

   Those who master silence,
              master spoken word.

               http://www.ulpgc.es/hege/almacen/download/48/48279/manual_del_curso.pdf
Listen to yourself:
 use your common sense
Be honest to yourself because your intuition
and feelings are telling you all the time what is
   more appropriate in every situation.

 Pay attention to your gut feelings because
           they don't cheat you.

Listen carefully to others to be empathetic to
                      them.

     Do what you know you ought to do.
Where are you standing?
Is everything OK with you and your environment?
                        ●
                             Breath
                        ●
                           Sleep well
                          ●
                            Eat well
                         ●
                           Work out
  ●
    Workplace environment must have good conditions
              ●
                Try to learn about yourself

There are several techniques to help you practice
     self-control and self-discover y :
                    ●
                         Meditation
                          ●
                            Yoga
                      ●
                        Martial arts
                     ●
                        Team sports
                   ●
                     Extreme sports
                  ●
                    And much more!
Where are you standing?
Is everything OK with you and your environment?
                        ●
                             Breath
                        ●
                           Sleep well
                          ●
                            Eat well
                         ●
                           Work out
  ●
    Workplace environment must have good conditions
              ●
                Try to learn about yourself

There are several techniques to help you practice
     self-control and self-discover y :
                    ●
                         Meditation
                          ●
                            Yoga
                      ●
                        Martial arts
                     ●
                        Team sports
                   ●
                     Extreme sports
                  ●
                    And much more!
Be a good team player

       Don't make assumptions

        Don't take it personally

             Do your best

Be precise and specific with your words

      See also the Core Protocols
BDD is a set of values and practices
            Build the thing right
            dannorth.net/introducing-bdd/

            dannorth.net/whats-in-a-story/

      chrismdp.com/2013/01/bdd-is-not-cucumber/



                 [Over]simplification:
      specification by example + outside-in TDD
Lean development and
     Impact Mapping
  Build the right thing, avoid waste




en.wikipedia.org/wiki/Lean_software_development

        impactmapping.org/drawing.php
What, not how: the amazing happens
when you just write the minimum code

               Case Study: LiveTeamApp.com
    ●
      No password or registration required.
    ●
      Group chat and individual chat rooms.
    ●
      GUI tailored to users according to their feedback.
    ●
      Pomodoro integrated with team monitor and and chat.
    ●
      New features are delivered in a matter of hours.
    ●
      Everything is covered by tests.

        Remember: Just make your acceptance tests
        pass deferring any other decision as much as
                          possible.
LiveTeamApp
The specifications workshop
  50-70% of the defects are in the requirements...

  ●
    Focus on what, not how
  ●
    Avoid GUI details in the examples
  ●
    All the roles together in the workshop:
      ●
        Facilitator
      ●
        Stakeholders
      ●
        Business Analysts
      ●
        Product Owners
      ●
        Testers
      ●
        Developers
  ●
    Face to face conversation
  ●
    Time, an important investment:
      ●
          2 hours for a week sprint seems reasonable
Good books out there



●
    Bridging the communication gap
       ●
         Specification by Example
             ●
               Impact Mapping
            ●
              ATDD by Example
          ●
            The cucumber book
Starting with the user story
      Title (one line describing the story)

                  Narrative:
                  As a [role]
               I want [feature]
               So that [benefit]

 Acceptance Criteria: (presented as Scenarios)

               Scenario 1: Title
               Given [context]
          And [some more context]...
                When [event]
              Then [outcome]
           And [another outcome]...
Exercise




The specification workshop
Wait a moment:
Three types of JavaScript



       ➢
         With TDD
      ➢
        Without TDD
    ➢
      For Frameworks
BDD for RIAs: the process




A Rich Internet Application is very different from a Website!
App core: Passive View pattern




                       Outside-in:
 Blue: test-driven with unit tests, using test doubles.
Green: test-driven with unit tests, using test doubles.
        Pink: test-driven with integration tests.
Outside-in development

  Good understanding of test doubles:
   ●
     Stubs: programmed to return answers.
   ●
     Spies: will remember calls.
   ●
     Mocks: will fail on unexpected calls.
   ●
     Fakes: almost like the real system, just faster or repeatable.

How to write scenarios where some objects don't exists
           already? Remember the UML :-)

                        Key rules:
   ●
     Do not mock artifacts you don't own.
   ●
     Use stubs for queries and mocks/spies for
   actions.
Exercise: the flow


1. Connecting the Business API with
the service.
2.Connecting the UI with the service.
3.Implementing the service.
4.Implementing the interactor.
5.Implementing the databinder.

      All of them are UNIT TESTS
Advice: let the team follow code
             changes
  ●
   Initialize a code repository for the exercises
  (Git, Mercurial, or whatever you prefer).

  ●
    Make commits small enough that just by
  looking at the “diff” anyone can understand
  what the change is.

  ●
   This usually means, no more than 10 lines of
  code.

  ●
   Try to commit on red, on green, and eventually
  on refactor.

  ●
      This is a great way to document code changes.
Exercise: the integration



        ●
         TextBox Widget
        Implementation

 ●
     Storage implementation
Architecture review
               Patterns:
           ●
               Passive View
                 ●
                   Factory
               ●
                  Wrapper
               ●
                 Observer
                ●
                   Pub/sub
               ●
                 Singleton

    Non-emergent architecture:
   I18n, fault tolerance, security,
scalability, SEO, routing, contents...

More Related Content

Similar to BDD workshop for JavaScript developers

Ron Guttman Speaker Profile
Ron Guttman Speaker ProfileRon Guttman Speaker Profile
Ron Guttman Speaker Profile
ronguttman
 
How to get your app or site built
How to get your app or site builtHow to get your app or site built
How to get your app or site built
Joe Chin
 

Similar to BDD workshop for JavaScript developers (20)

Developing Better Software
Developing Better SoftwareDeveloping Better Software
Developing Better Software
 
Ron Guttman Speaker Profile
Ron Guttman Speaker ProfileRon Guttman Speaker Profile
Ron Guttman Speaker Profile
 
How to be a 10x Engineer
How to be a 10x EngineerHow to be a 10x Engineer
How to be a 10x Engineer
 
The One Woman Web Team
The One Woman Web TeamThe One Woman Web Team
The One Woman Web Team
 
Activate Agile 2014 : roles, activities, behaviours in Agile Projects
Activate Agile 2014 : roles, activities, behaviours in Agile ProjectsActivate Agile 2014 : roles, activities, behaviours in Agile Projects
Activate Agile 2014 : roles, activities, behaviours in Agile Projects
 
LET'S TALK ANDROID Dev
LET'S TALK ANDROID DevLET'S TALK ANDROID Dev
LET'S TALK ANDROID Dev
 
Basic software engineering principles with code examples - Session 2
Basic software engineering principles with code examples - Session 2Basic software engineering principles with code examples - Session 2
Basic software engineering principles with code examples - Session 2
 
Simple vs Easy
Simple vs EasySimple vs Easy
Simple vs Easy
 
Thinking visually for Software Testing Webinar Slides
Thinking visually for Software Testing Webinar SlidesThinking visually for Software Testing Webinar Slides
Thinking visually for Software Testing Webinar Slides
 
How to get your app or site built
How to get your app or site builtHow to get your app or site built
How to get your app or site built
 
Software Testing Overview
Software Testing OverviewSoftware Testing Overview
Software Testing Overview
 
Clean code
Clean codeClean code
Clean code
 
A Salesman's Guide to Social Engineering B-Sides London Edition
A Salesman's Guide to Social Engineering   B-Sides London EditionA Salesman's Guide to Social Engineering   B-Sides London Edition
A Salesman's Guide to Social Engineering B-Sides London Edition
 
Agile work practices and tools
Agile work practices and toolsAgile work practices and tools
Agile work practices and tools
 
Codesters
CodestersCodesters
Codesters
 
Becoming a better developer
Becoming a better developerBecoming a better developer
Becoming a better developer
 
Usability testing - have fun and improve your work
Usability testing - have fun and improve your workUsability testing - have fun and improve your work
Usability testing - have fun and improve your work
 
How to deliver the right software (Specification by example)
How to deliver the right software (Specification by example)How to deliver the right software (Specification by example)
How to deliver the right software (Specification by example)
 
Pair programming
Pair programmingPair programming
Pair programming
 
En Route To Industry: Tips on Transferring from College into Industry
En Route To Industry: Tips on Transferring from College into IndustryEn Route To Industry: Tips on Transferring from College into Industry
En Route To Industry: Tips on Transferring from College into Industry
 

BDD workshop for JavaScript developers

  • 1. BDD for RIAs with JavaScript 2013 Workshop Tour Carlos Ble carlosble.com @carlosble
  • 2. Warning This workshop is very demanding so please: ● Ask anything you need. ● Give me feedback. ● Take notes. ● Pay attention. ● Be responsible. ● Get ready to share code with others.
  • 3. Effective communication Your only goal when communicating should be to … Communicate! Don't talk or write to... ● Demonstrate how smart you are ● Convince others ● Fight others ● Avoid the uncomfortable silence ● Think out loud No one is more important than you, and you are not more important than anyone else. What others think about you, is not your business.
  • 4. The seven rules of Angel Lafuente 1ª. Nunca la palabra antes que el pensamiento. 2ª. No interrumpir la frase o idea. 3ª. Frase breve. 4ª. Mirada interpelante. 5ª. Gesto libre. 6ª. Silencios. 7ª. Velocidad posible y adecuada Those who master silence, master spoken word. http://www.ulpgc.es/hege/almacen/download/48/48279/manual_del_curso.pdf
  • 5. Listen to yourself: use your common sense Be honest to yourself because your intuition and feelings are telling you all the time what is more appropriate in every situation. Pay attention to your gut feelings because they don't cheat you. Listen carefully to others to be empathetic to them. Do what you know you ought to do.
  • 6. Where are you standing? Is everything OK with you and your environment? ● Breath ● Sleep well ● Eat well ● Work out ● Workplace environment must have good conditions ● Try to learn about yourself There are several techniques to help you practice self-control and self-discover y : ● Meditation ● Yoga ● Martial arts ● Team sports ● Extreme sports ● And much more!
  • 7. Where are you standing? Is everything OK with you and your environment? ● Breath ● Sleep well ● Eat well ● Work out ● Workplace environment must have good conditions ● Try to learn about yourself There are several techniques to help you practice self-control and self-discover y : ● Meditation ● Yoga ● Martial arts ● Team sports ● Extreme sports ● And much more!
  • 8. Be a good team player Don't make assumptions Don't take it personally Do your best Be precise and specific with your words See also the Core Protocols
  • 9. BDD is a set of values and practices Build the thing right dannorth.net/introducing-bdd/ dannorth.net/whats-in-a-story/ chrismdp.com/2013/01/bdd-is-not-cucumber/ [Over]simplification: specification by example + outside-in TDD
  • 10. Lean development and Impact Mapping Build the right thing, avoid waste en.wikipedia.org/wiki/Lean_software_development impactmapping.org/drawing.php
  • 11. What, not how: the amazing happens when you just write the minimum code Case Study: LiveTeamApp.com ● No password or registration required. ● Group chat and individual chat rooms. ● GUI tailored to users according to their feedback. ● Pomodoro integrated with team monitor and and chat. ● New features are delivered in a matter of hours. ● Everything is covered by tests. Remember: Just make your acceptance tests pass deferring any other decision as much as possible.
  • 13. The specifications workshop 50-70% of the defects are in the requirements... ● Focus on what, not how ● Avoid GUI details in the examples ● All the roles together in the workshop: ● Facilitator ● Stakeholders ● Business Analysts ● Product Owners ● Testers ● Developers ● Face to face conversation ● Time, an important investment: ● 2 hours for a week sprint seems reasonable
  • 14. Good books out there ● Bridging the communication gap ● Specification by Example ● Impact Mapping ● ATDD by Example ● The cucumber book
  • 15. Starting with the user story Title (one line describing the story) Narrative: As a [role] I want [feature] So that [benefit] Acceptance Criteria: (presented as Scenarios) Scenario 1: Title Given [context] And [some more context]... When [event] Then [outcome] And [another outcome]...
  • 17. Wait a moment: Three types of JavaScript ➢ With TDD ➢ Without TDD ➢ For Frameworks
  • 18. BDD for RIAs: the process A Rich Internet Application is very different from a Website!
  • 19. App core: Passive View pattern Outside-in: Blue: test-driven with unit tests, using test doubles. Green: test-driven with unit tests, using test doubles. Pink: test-driven with integration tests.
  • 20. Outside-in development Good understanding of test doubles: ● Stubs: programmed to return answers. ● Spies: will remember calls. ● Mocks: will fail on unexpected calls. ● Fakes: almost like the real system, just faster or repeatable. How to write scenarios where some objects don't exists already? Remember the UML :-) Key rules: ● Do not mock artifacts you don't own. ● Use stubs for queries and mocks/spies for actions.
  • 21. Exercise: the flow 1. Connecting the Business API with the service. 2.Connecting the UI with the service. 3.Implementing the service. 4.Implementing the interactor. 5.Implementing the databinder. All of them are UNIT TESTS
  • 22. Advice: let the team follow code changes ● Initialize a code repository for the exercises (Git, Mercurial, or whatever you prefer). ● Make commits small enough that just by looking at the “diff” anyone can understand what the change is. ● This usually means, no more than 10 lines of code. ● Try to commit on red, on green, and eventually on refactor. ● This is a great way to document code changes.
  • 23. Exercise: the integration ● TextBox Widget Implementation ● Storage implementation
  • 24. Architecture review Patterns: ● Passive View ● Factory ● Wrapper ● Observer ● Pub/sub ● Singleton Non-emergent architecture: I18n, fault tolerance, security, scalability, SEO, routing, contents...