Re: Is 'Final' for classes and methods a good feature or something that should be eliminated?
- From: Michael Feathers <mfeathers@xxxxxxxxxxxxxxxx>
- Date: Mon, 26 Feb 2007 17:55:41 GMT
rmoldskr+usenet@xxxxxxxxx wrote:
Michael Feathers <mfeathers@xxxxxxxxxxxxxxxx> wrote:
Final gets in the way of both of those. Really, there are very few alternatives at the unit level.
I hardly ever use either of those methods when I write unit tests, so
I don't see how that can be true. After all, you're testing the code
that uses the final-ed object, and not the final-ed code itself.
Sure, it's sometimes _convenient_ to be able to proxy an library object by inheritance and overloading, but I can't really see any
situration where it's _necessary_ for writing an Unit test.
What about the cases that I mentioned.. when there is a side effect that you wouldn't want to have occur when your testing the code that uses the final-ed object?
Could be anything from hitting the database, to sending mail or launching cruise missiles.
----
Michael Feathers
http://www.objectmentor.com
http://michaelfeathers.typepad.com
author of: Working Effectively with Legacy Code (Prentice Hall 2005)
.
- References:
- Is 'Final' for classes and methods a good feature or something that should be eliminated?
- From: Michael Feathers
- Re: Is 'Final' for classes and methods a good feature or something that should be eliminated?
- From: rmoldskr+usenet
- Re: Is 'Final' for classes and methods a good feature or something that should be eliminated?
- From: Michael Feathers
- Re: Is 'Final' for classes and methods a good feature or something that should be eliminated?
- From: rmoldskr+usenet
- Re: Is 'Final' for classes and methods a good feature or something that should be eliminated?
- From: Michael Feathers
- Re: Is 'Final' for classes and methods a good feature or something that should be eliminated?
- From: rmoldskr+usenet
- Re: Is 'Final' for classes and methods a good feature or something that should be eliminated?
- From: Michael Feathers
- Re: Is 'Final' for classes and methods a good feature or something that should be eliminated?
- From: rmoldskr+usenet
- Is 'Final' for classes and methods a good feature or something that should be eliminated?
- Prev by Date: Re: Booch's book feels too philosophical rather than practical?
- Next by Date: Re: It's the Psychology, Stupid (Was: The reality of Topmind)
- Previous by thread: Re: Is 'Final' for classes and methods a good feature or something that should be eliminated?
- Next by thread: Re: Is 'Final' for classes and methods a good feature or something that should be eliminated?
- Index(es):
Relevant Pages
|