TDD & Effective Software Development

  • 105 views
Uploaded on

This presentation explains WHY Test Driven Development matters and what are some of the infinite advantages of this great technique for programming a cleaner and higher quality code.

This presentation explains WHY Test Driven Development matters and what are some of the infinite advantages of this great technique for programming a cleaner and higher quality code.

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
105
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
1
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. Sam Serpoosh @masihjesus http://masihjesus .wordpress.com https://github.com/Sam-Serpoosh http://linkedin.com /in/samserpoosh
  • 2. “programmers have more in common with chefs than with desk jockeys like accountants or attorneys.” ~Greg Baugues
  • 3.  Nobody wants to wash the dishes!
  • 4.  Test-First programming.  Kent Beck used it in Chrysler C3 project in 1996.  TDD in XP(eXtreme Programming) practices.  the most important and useful approach
  • 5. Enumerable Select method in Ruby! • Invokes the block passing in successive elements from self, returning an array containing those elements for which the block returns a true value (equivalent to Enumerable#select).
  • 6. it “fetches green squares” do green_square = squares.select {|square| square.color == green} green_square.color.should == green end
  • 7.  Tests tell the code how to look like from its user’s perspective  It is more a design technique and tests are great side-effects!  You feel the pain first when it’s hard to use!
  • 8.  You are not allowed to write any production code unless you have a failing unit test and that production code is about to make it pass.  You are not allowed to write any more of a unit test than is sufficient to fail; and compilation failures are failures.  You are not allowed to write any more production code than is sufficient to pass the one failing unit test.
  • 9. Kent Beck defines:  Never write a single line of code unless you have a failing automated test.  Eliminate Duplication(DRY, Don’t Repeat Yourself)
  • 10.      Red (Automated test fails) Green (Automated test pass) Refactor (eliminate duplication, eliminate the mess, clean the code) Sushi Chef Metaphor Red Dirty Dishes of dinner Green Refactor
  • 11. Start Write a test See it fails because there’s no dev code Run the Test Write (just enough) Dev Code to compile See it fails because no logic is implemented Run the Test Write (just enough) Dev Code to compile See the Test pass Run the Test Refactoring
  • 12. • Knowing about execution of system all the times. • Short cycles (even 10 minutes is too long). • A minute ago all their code worked. (Pick a Random Person)
  • 13. • Thousands of unit tests will be produced. • Can run them anytime we want. • Whenever we make any kind of change. • Executable and live documentation of system instead of pile of papers.
  • 14. • There’s a test as an example to show you what you want! • They CANNOT be out of date • Make the FEAR disappear (Refactoring)
  • 15.  Oh My God this code is a mess I need to clean this up!  But I’m not gonna touch it!
  • 16. TDD  Testable Decoupled Decoupling most important factor TDD  managing dependency better  DIP
  • 17. • so much flexible and easy to change. Software is Soft again! Go ahead and change! • NOT  Fragile, Rigid, Immobile •
  • 18. TESTS MORE SPECIFIC  CODE MORE GENERAL
  • 19. • 2005 study  TDD  more productive & increase their confidence. • software  much more flexible, reliable, testable & with great live documentation. • NOT PROFESSIONAL if you don’t do TDD (~ Uncle Bob, Ron Jeffries, Kent Beck, etc.)
  • 20. had been a programmer for 3 decades before I was introduced to TDD. I did not think anyone could teach me a low level programming practice that would make a difference. But when I started TDD, I was dumbfounded at the effectiveness of the technique. ~ Robert C. Martin I
  • 21. Blog posts and articles:  Grand Design by Stephen Hawking & Leonard Mlodinow • http://objectmentor.com/articles • http://cleancoder.com/articles • http://codebetter.com/articles • Code like a chef series!
  • 22. • Robert C. Martin craftsmanship article series • Uncle Bob on Rules and Benefits of TDD • Michael Feathers Synergy between Design and Testability • Jeremy D. Miller Writing Maintainable Programs series • Sarah Gray on Visualizing Enumerable
  • 23. Books: • TDD by Example (Kent Beck) • Clean Code (Robert C. Martin) • Agile Software Development Principles, Patterns, Practices (Robert C. Martin) • Working Effectively With Legacy Code (Michael Feathers) • Growing Object-Oriented Software Guided by Tests (Steve Freeman & Nat Pryce) • Refactoring (Martin Fowler)
  • 24. Lectures And Conferences: • • • • • • • Clean Code I, II (Robert C. Martin) Are you a Professional? (Robert C. Martin) Synergy between Design and Testability (Michael Feathers) Effective Software Development (Alistair Cockburn) Clean, Testable Code (Misko Hevery) Clean Coders Videos (Clean Code Matters) Destroy All Software (Gary Bernhardt)