>I wonder what the best practice would be when it comes to declare classes (and more importantly methods) static. I have found that in most cases pundits declare non static classes and methods where it would be perfectly workable to have them static.
>
>The way I see it is that static is easier to test no?
In addition to the rest of the replies
Static means not related or specific to an instance
eg: a Person class
Instance properties/methods would be Name, BirthDate, address, etc since that are 'things' that belong to a specific Person ( or instance)
We do not have the same name, do we ?
A method like CalculateAge() or GetAge() would not be static since it would use the (instance) property DateOfBirth
CalculateAge() could be static when it would accept dateOfBirth as a parameter
Static means applicable to any instance, ie not needing instance properties
Static does not necessarily mean that it is easier to test - the only difference is that you don't have to instantiate the class before using it
Gregory