Initialize smell
If you haven't read how to make your classes Good Citizens, i recommend that you do. The first item states "Keep a consistent state at all times - init() or populate() is a code smell.".
On my screen I have a stack trace that says:
[ManagementException: bla bla bla]
System.Management.ManagementException.ThrowWithExtendedInfo(...)
System.Management.ManagementScope.InitializeGuts(...)
System.Management.ManagementScope.Initialize(...)
System.Management.ManagementObject.Initialize(...)
I'm too lazy (and not bothered enough) to ildasm the whole enchilada but all the initialize methods are private so the code smell doesn't really apply. Despite this I certainly do think it's quite a funny stack trace and to me it signals that if a class (ManagementScope) needs two, different, chained Initialize methods it's a signal that the constructor does a lot of work. Impossible for me to say whether it's good or bad in this case but it does seem a bit smelly to me.








0 Comments:
Post a Comment
<< Home