STDIO Ghana
CABP
Object-Oriented Programming
&
Test-Driven Development
STDIO Ghana
CABP
Preview: why talk about these together?
OOP is about self-contained "widgets"
TDD is about writing tests then code.
How do you think they fit together?
STDIO Ghana
CABP
Syntax for objects in various languages
Java / Scala, C, C++, R, Perl, Javascript
What do these common features tell us?
STDIO Ghana
CABP
Notable similarities?
Types
Scope
Inheritance
What are their benefits?
STDIO Ghana
CABP
Interlude: Object Exercises
STDIO Ghana
CABP
Test Driven Development
initially, all tests fail, so...
code until each passes
testMethod1(testInput1) == desiredOutput1
testMethod2(testInput2) == desiredOutput2
...
testMethodN(testInputN) == desiredOutputN
STDIO Ghana
CABP
Test Driven Development
More details
- testing language features, OSS libraries?
- work incrementally
- what's worth testing?
- trade off test development vs. product development
STDIO Ghana
CABP
STDIO Ghana
CABP
What else would we want to "test" that hasn't been discussed so far?
What are hurdles to doing testing?
STDIO Ghana
CABP
Review:
How might OOP & TDD work together?
What needs to be tested in your projects?