Even at a consulting rate of $1000/hr, this function takes all
of 2 minutes to write and 30 seconds to test, for a maximum value of $1000,
if you bill at a minimum an hour.
I basically agree, especially
about your maximum, but...30 seconds to test? There's enough things
I'd want to test--reversed range, boundaries, how it handles values that may
have special properties, like 0, maximum-signed-integer,
maximum-unsigned-integer and the like--that I think it would take longer for me
to write the tests than the code. Not a lot longer, mind you.
:)
Of course, I do tend to think that a little extra testing up front is
worth it to save all the effort and pain of turning up hard-to-isolate problems
in the field. But even if I were to go against my instincts and write sloppy,
not-very-thorough tests, I still think they would take nearly as long to write
as the oh-so-very-trivial function itself.
(On the other hand,
I think you may have overestimated how long it would actually take to write the
code.) :)
--- Do not meddle in the affairs of Wizards, for it makes
them soggy and hard to light. [ Reply to This | Parent | # ]
|