问题
I know this is "technically" a duplicate of this question. Should I recommend sealing classes by default?
But I'm asking it again because apparently the recommendation has changed1 with the times though I can't find anything in the last few years about it or about the fact that more and more people are recommending AGAINST sealing classes now thanks to the improvements in testing (which was one of the main reasons), processor speed (speed difference now is negligible), etc.
I'm trying to find out what the latest guideline is for weather or not to mark classes
as sealed
.
1 Essential C# 6.0 (5th Edition), Mark Michaelis (co author Eric Lippert):
"In general, marking a class as sealed is rarely done and should be reserved only for those situations in which there are strong reasons favoring such a restriction. In fact, leaving types unsealed is increasingly desirable, as unit testing has become prominent because of the need to support mock (test double) object creation in place of real implementations."
This is hardcopy proof as the others are all word of mouth.
来源:https://stackoverflow.com/questions/34827443/should-classes-still-be-sealed-as-a-recommendation