Should classes be sealed as a recommendation?

I know this is a “technically” duplicate of this question. Should I recommend default compaction classes?

But I ask about it again, because the recommendation seems to have changed 1 over time, although I can’t find anything in the last few years about this or that more and more people are now recommending AGAINST compaction classes thanks to testing improvements (which was one of the main reasons), processor speed (the difference in speed is currently negligible), etc.

I am trying to figure out what is the final guideline for the weather or not mark classes as sealed .

1 Essential C # 6.0 (5th Edition) , Mark Michaelis (author Eric Lippert):

“In general, marking a class as sealed is rarely performed and should only be reserved in situations where there are good reasons to favor such a restriction. In fact, leaving open types is becoming increasingly desirable as unit testing has become noticeable due to the need to maintain the layout (test double) object creation instead of real implementations. "

This is solid proof, since all other words are from the mouth.

+7
c # class sealed
source share

No one has answered this question yet.

See similar questions:

49
Should I recommend default compaction classes?
2
Providing an interface implementation for using Moq

or similar:

1890
Should using directives be inside or outside the namespace?
1731
Are static class variables possible in Python?
1253
What does it mean "Could not find or load the main class"?
1066
Python class inherits object
941
What is the difference between old style and new style classes in Python?
638
When should you use the vs struct class in C ++?
633
What methods can be used to define a class in JavaScript and what are their tradeoffs?
530
When to use static classes in C #
308
What is a sealed trait?
90
Static and sealed class differences

All Articles