BDD workshop for JavaScript developers

1,162 views

Published on

0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,162
On SlideShare
0
From Embeds
0
Number of Embeds
20
Actions
Shares
0
Downloads
11
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

BDD workshop for JavaScript developers

  1. 1. BDD for RIAs with JavaScript 2013 Workshop Tour Carlos Ble carlosble.com @carlosble
  2. 2. WarningThis workshop is very demanding so please:● Ask anything you need.● Give me feedback.● Take notes.● Pay attention.● Be responsible.● Get ready to share code withothers.
  3. 3. Effective communication Your only goal when communicating should be to … Communicate! Dont 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 moreimportant than anyone else. What others think about you, is not your business.
  4. 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. 5. Listen to yourself: use your common senseBe honest to yourself because your intuitionand feelings are telling you all the time what is more appropriate in every situation. Pay attention to your gut feelings because they dont cheat you.Listen carefully to others to be empathetic to them. Do what you know you ought to do.
  6. 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 yourselfThere 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. 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 yourselfThere 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. 8. Be a good team player Dont make assumptions Dont take it personally Do your bestBe precise and specific with your words See also the Core Protocols
  9. 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. 10. Lean development and Impact Mapping Build the right thing, avoid wasteen.wikipedia.org/wiki/Lean_software_development impactmapping.org/drawing.php
  11. 11. What, not how: the amazing happenswhen 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.
  12. 12. LiveTeamApp
  13. 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. 14. Good books out there● Bridging the communication gap ● Specification by Example ● Impact Mapping ● ATDD by Example ● The cucumber book
  15. 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]...
  16. 16. ExerciseThe specification workshop
  17. 17. Wait a moment:Three types of JavaScript ➢ With TDD ➢ Without TDD ➢ For Frameworks
  18. 18. BDD for RIAs: the processA Rich Internet Application is very different from a Website!
  19. 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. 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 dont exists already? Remember the UML :-) Key rules: ● Do not mock artifacts you dont own. ● Use stubs for queries and mocks/spies for actions.
  21. 21. Exercise: the flow1. Connecting the Business API withthe 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. 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. 23. Exercise: the integration ● TextBox Widget Implementation ● Storage implementation
  24. 24. Architecture review Patterns: ● Passive View ● Factory ● Wrapper ● Observer ● Pub/sub ● Singleton Non-emergent architecture: I18n, fault tolerance, security,scalability, SEO, routing, contents...

×