Re: The Sort Excercise
From: Phlip (phlip_cpp_at_yahoo.com)
Date: 12/26/03
- Next message: Harry Erwin: "Re: TDD and Refactoring"
- Previous message: Daniel T.: "Re: The Sort Excercise"
- In reply to: Val: "Re: The Sort Excercise"
- Next in thread: Daniel T.: "Re: Daniel T."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 25 Dec 2003 22:34:18 -0800
Val wrote:
> To me there is an excellent role for Phlip (for example):
> Phlip, any thoughts on how to "test for correct" deletion of dynamically
> allocated memory? Mind that our "context class" holds merely a
> pointer-to-a-dymanically-allocated-concreteStrategy-class". I feel insecure
> on testing what is deleted and what not...
Thanks - I think. You reduced the entire TDD movement to "Phlip".
Apply these checks in order, and clean your code until it...
0. follows the team's Sane Subset
1. passes all tests
2. shows clear and expressive code
3. duplicates no behavior definitions
4. minimizes methods & classes
Apply the rules in order. Memory management is a Sane Subset issue;
you can't test it in (without getting absurdly close to the metal).
The testing "we" (I) talk about is a design technique that happens to
flatten the bug rate as a side-effect.
So, the fixes, in ascending order of effectiveness:
- set pointers to NULL after freeing them
- use www.boost.org's shared_ptr
- switch to a language, like Ruby, where any
given statement has higher odds of
membership in the Sane Subset
-- Phlip
- Next message: Harry Erwin: "Re: TDD and Refactoring"
- Previous message: Daniel T.: "Re: The Sort Excercise"
- In reply to: Val: "Re: The Sort Excercise"
- Next in thread: Daniel T.: "Re: Daniel T."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]