(Test Driven) Software Development - PowerPoint PPT Presentation

About This Presentation
Title:

(Test Driven) Software Development

Description:

What information will you keep? Do data modelling, using ER diagrams. Business logic ... Does the entire system work? vs. 12/26/09. Gyozo Gidofalvi. 14. Tests ... – PowerPoint PPT presentation

Number of Views:37
Avg rating:3.0/5.0
Slides: 15
Provided by: itUu
Category:

less

Transcript and Presenter's Notes

Title: (Test Driven) Software Development


1
(Test Driven) Software Development
  • Gyozo Gidofalvi

2
Three-tier architecture
  • User Interface
  • What should the user see?
  • Make drawings
  • Database
  • What information will you keep?
  • Do data modelling, using ER diagrams
  • Business logic
  • How will you present the data to the users?
  • For any non-trivial function, do test driven
    development

3
Data modelling
  • Keep persistent data in a database
  • Customer information
  • Banking information
  • Inventory
  • What do you carry, and how much do you have right
    now?
  • Past activity
  • What has the customer bought?
  • What has the customer looked at?
  • What information do you want to store? Why?
  • Make an Entity Relationship diagram
  • Translate the ER diagram into SQL tables

4
Example of an ER diagram
5
Software development is all about Getting Things
Done
  • Priorities in software development
  • Make it work
  • Make it beautiful
  • Make it fast

6
How?
  • How to make it work?
  • First write tests,
  • then write code.
  • This is called Test Driven Development.
  • How to make it beautiful?
  • Re-factor
  • How to make it fast?
  • Dont worry about performance until performance
    is a problem.

7
Why?
  • Because
  • Debugging sucks
  • Testing rocks
  • Because does it
  • A test is a specification
  • The capabilities of a program is defined by its
    tests
  • If the tests pass
  • we know that the program works for the test
    cases.
  • A test is a piece of documentation

8
The rules of TDD are simple
  • You can't write production code unless there is a
    broken test.
  • First write a test, then write the code
  • When there is a broken test, you change your code
    to make it pass.
  • When your code is working, you refactor to
    eliminate any code smells

9
What is code smell?
  • Something is fishy about the code
  • http//en.wikipedia.org/wiki/Code_smell
  • Examples
  • Large method
  • A function that is gt 1 page
  • Duplicated method
  • A method, function, or procedure that is very
    similar to another.
  • Contrived Complexity
  • Forced usage of overly complicated design
    patterns where simpler design would suffice

10
A good set of tests
  1. covers all code
  2. performs tests of different scales
  3. tests for all cases, including edge cases and
    errors

11
Different sized tests
Large (regression)
Medium (integration)
Small (unit)
isolation,speed
confidence in whole system
12
Where is the bug?
vs.
Test failed
Test failed
13
Does the entire system work?

vs.



14
Tests for edge cases and errors
  • No data, null pointers, garbage data
  • Very important!
  • Make sure that no component crashes
  • Then, the entire system is more likely to stay
    alive.
  • Write tests for invalid input data, like
  • empty strings
  • null pointers
  • broken input data
  • Generate exceptions in the production code,
  • catch these exceptions in the test code
Write a Comment
User Comments (0)
About PowerShow.com