Dave Burke - Freelance .NET Developer specializing in Online Communities

A freelance .NET Developer

Considering the sealed class

A lot of the code I'm studying of guys I admire (like ScottW's .text source, for instance) makes liberal use of Sealed classes and static modifiers.  This is also true of most Microsoft App Block code I've looked at.  I like it.  Using my standard practice inheritable class approach I'd use a

WhateverClassName whateverclassname = new WhateverClassName();

and then whateverclassname.whatever().

There is much more to the subject of sealed classes and static modifiers than personal declaration preferences, but I'd rather use of

using SomeNameSpace.WhateverSubNameSpace;

and a WhateverClassName.whatever() than have 5 to 10 instantiation statements. 

 

Posted: Mar 14 2004, 03:59 PM by daveburke | with 2 comment(s)
Filed under:

Comments

Jim Arnold said:

Hey, why don't we get rid of objects altogether :-)

I *strongly* disagree with you. Verbosity should not be used as an excuse for nasty code, especially with a predictive and helpful IDE. Static members lead you down a dark alley before smashing you round the head with a brick and stealing your wallet *and* your girlfriend. Proceed with caution.

Jim
# March 14, 2004 4:51 PM

Dave Burke said:

Jim, thanks for your thoughts. I particularly enjoyed the way you expressed your disagreement. I'll proceed with caution. Thanks!
# March 14, 2004 5:11 PM
Leave a Comment

(required) 

(required) 

(optional)

(required)