Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<blockquote> <p>There is a reason virtual is not the default for methods in C# [link to interview with Anders Hejlsberg].</p> </blockquote> <p>Hejlsberg is actually talking about framework API design. He doesn't say anything about Line of Business applications. Therefore, his rules apply less in LOB applications. Since you're using an O/RM, you're probably writing a LOB appliation.</p> <blockquote> <p>often it is expressive to annotate my classes with sealed for all the usual reasons [link to Eric Lippert's blog].</p> </blockquote> <p>You are referencing one of Eric Lippert's articles, who wrote that article in the context of his work at the C# compiler team. The general <a href="http://rads.stackoverflow.com/amzn/click/0321545613" rel="nofollow">Framework Design Guidelines</a> actually contain an opposite guideline:</p> <blockquote> <p><strong>DO NOT</strong> seal classes without having a good reason to do so. [paragraph 6.3]</p> </blockquote> <p>In other words, what Eric Lippert is saying is <em>not</em> the common rule.</p> <p>Personally, when I am writing LOB applications, I actually seal my classes and write non-virtual methods whenever possible. However, this has nothing to do with the change of introducing breaking changes in a later release, because this is almost solely a framework design problem.</p> <p>No, I do this because it makes it easier for me to make assumptions about my code. In other words: it makes my code more maintainable.</p> <p>However, I have absolutely no problem what so ever unsealing a class or virtualizing a method when I need to do this. The main reason for me to do so is to allow my code to be testable.</p> <p>Apparently you need this flexibility too and since you are writing a LOB application, just be practical and remember that:</p> <blockquote> <p>They're More Like Guidelines Anyway</p> </blockquote>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload