Stubs/doubles vs mocks
Stub is simple fake object. It just makes sure test runs smoothly.
Good stack exchange link on this
Tip 26: "select" isn't broken (debugging strategies)
- tracing
- rubber ducking
JP: "what does your program think is going on": DON'T BLAME EXTERNAL FACTORS FIRST. It's probably your code haha!
John: why, when faced with a "surprising" failure, you must realize that one or more of your assumptions is wrong.
Tip 27: Don't assume it - prove it
JP: "routine" code isn't infallible! did you test all of the edge cases?
I really like the debugging checklist so here it is:
- Is the problem being reported a direct result of the underlying bug, or merely a symptom?
- Is the bug really in the compiler? Is it in the OS? Is it in your code?
- If you explained this problem in detail to a coworker, what would you say?
- If the suspect code passes its unit tests, are the tests complete enough?
- Do the conditions that caused this bug exist anywhere else in the system?
John: Duplicate the problem in tests.
Tip 28: learn a text manipulation language
examples of text manipulation:
- generating web docs
- test data generation
- book writing
- etc
JP: Funny enough, Hunt and Thomas like using Ruby (and Perl) to quickly hack short scripts
John: I want to push more into this - Just barely experimenting with self-creating API docs. Even just things like in ruby: writing a rake task to pull out all your custom objects and methods to start docs and get a clear picture has been helpful for me.
Tip 29: Write code that writes code
passive vs active code generators
passive = run once to produce a result
JP: meta programming? code gen doesnt have to be meta
John: Refactoring methods to "Find common resources" based on "Model" name - Reducess code significantly.
Picks
- JP: Sergei Rachmaninoff: Piano Concertos Nos. 2 & 3. Good classic music
- John: iOS Keyboard push down trick



