Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Mark Leighton Fisher (4252)

Mark Leighton Fisher
  (email not shown publicly)
http://mark-fisher.home.mindspring.com/

I am a Systems Engineer at Regenstrief Institute [regenstrief.org]. I also own Fisher's Creek Consulting [comcast.net].
Friday September 14, 2007
11:39 AM

You Must Test Hand-Written Accessors

[ #34452 ]

If your accessors contain any code that you wrote by hand (i.e. not IDE-generated), you must test them. There's been a debate about this subject for which I've found the counter-example to the "don't test accessors" side.

Recently, I was working on a class that had several, similarly-named accessors, which needed to be similarly-named because they were similar concepts (possibly dates but I don't remember). Sure enough, one of the accessors was modifying the underlying data for a different accessor (probably a case of cut'n'paste coding). The result was a defect in the accessor code, which would have been caught by simple tests of the accessor in question.

So: if you wrote any of the code in your accessor by hand, you must test that accessor. (This also applies to automatically-generated accessors that you modified.)

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.