Your SlideShare is downloading. ×
0
Test Driven Design by Jonas Auken
Test Driven Design by Jonas Auken
Test Driven Design by Jonas Auken
Test Driven Design by Jonas Auken
Test Driven Design by Jonas Auken
Test Driven Design by Jonas Auken
Test Driven Design by Jonas Auken
Test Driven Design by Jonas Auken
Test Driven Design by Jonas Auken
Test Driven Design by Jonas Auken
Test Driven Design by Jonas Auken
Test Driven Design by Jonas Auken
Test Driven Design by Jonas Auken
Test Driven Design by Jonas Auken
Test Driven Design by Jonas Auken
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Test Driven Design by Jonas Auken

717

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
717
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
15
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. TEST DRIVEN DESIGN AGILE NCR - APRIL 25, 2011 Jonas Auken 1
  • 2. Introduction• Name: Jonas Auken• Role: Agile Evangelist• Primary goal: Excellent quality software• Secondary goal: Happy developers• Means: Agile practices everywhere 2
  • 3. Important questions• How do you know if youre code is working? When you have tested it!• When do you want feedback from your code? Now!• When would you like to refactor? Anytime! 3
  • 4. Agenda• Test driven development• The “Find my Ride” example• Immediate feedback• Comfortable refactoring• Towards a better design• Discussion: How do we get started? 4
  • 5. @Test public void canInspirePeopleToDoTDD() { agileNCR.arrangeConference(2011); People people = agileNCR.invitePeople(); Presenter presenter = new Presenter(“Jonas Auken”); presenter.prepareSlides(); presenter.createExampleCode(); while (!done) { try { done = presenter.performPresentation(people); } catch (QuestionRaisedException e) { presenter.answerQuestion(); } } assertEquals(0.75, people.getRateInspiredToDoTDD);} 5
  • 6. Test driven development• Why? • Feedback loop • Change alarm • Help in bug finding • A better design • Adding functionality by the slice• How and when? • Write the test first • Mock all external objects • Only test worker objects, not value objects 6
  • 7. Good design• “Pretty much what you’d have expected”• No superfluous code• Easy to understand - easy to maintain• Small classes, small methods• Separation of concern - do one thing only• Single layer of abstraction 7
  • 8. Test driven design• The natural next step• Avoid big design up front (BDUF)• Design by refactoring • Design what you need • Mock the rest • Small steps or large steps 8
  • 9. “Find my Ride”• A larger example• Web application• A few complex issues• Java6, JSF 2, Tomcat server, mock database 9
  • 10. This is not real• No users telling us what they want• No component and backend design• No planning• So, this is not really agile - it’s just an example of TDD 10
  • 11. Immediate feedback• The red-green cycle• Test, code and refactor• Feedback in every cycle• Short cycle or long cycle 11
  • 12. Comfortable refactoring• Refactoring in every cycle• Avoid the “big refactoring in the sky”• Refactor when the test is green 12
  • 13. Towards a better design• Walking skeleton• One slice of functionality• Hardest thing first• Knowledge is gathered• Choices can be deferred• Better estimates and better design 13
  • 14. How do we get started?• Inspiration?• Discussion?• Questions?• Remarks?• Personal experiences? 14
  • 15. Books & Links• Growing Object-Oriented Software Guided by Tests - Steve Freeman & Nat Pryce• Test Driven Development: By Example - Kent Beck• Extreme Programming Explained: Embrace Change - Kent Beck• Clean Code - Robert C Martin• Refactoring: Improving the Design of Existing Code - Martin Fowler• 10 Ways to Improve Your Code - http://www.slideshare.net/guestebde/10-ways-to-improve- your-code-neal-ford - Neal Ford• SLAP - http://www.markhneedham.com/blog/2009/06/12/coding-single-level-of- abstraction-principle - Mark Needham• Do One Thing - http://blog.objectmentor.com/articles/2009/09/11/one-thing-extract-till- you-drop - Robert C Martin• Test Driven Development - http://en.wikipedia.org/wiki/Test-driven_development - Wikipedia• Tech & Talk - www.auken.net - Jonas Auken 15

×