{"id":12,"date":"2007-12-19T10:33:12","date_gmt":"2007-12-19T16:33:12","guid":{"rendered":"http:\/\/todesco-technologies.com\/unboxed\/?p=5"},"modified":"2007-12-19T10:33:12","modified_gmt":"2007-12-19T16:33:12","slug":"extreme-advice-1-make-all-methods-virtual","status":"publish","type":"post","link":"https:\/\/todescotechnologies.com\/unboxed\/index.php\/2007\/12\/19\/extreme-advice-1-make-all-methods-virtual\/","title":{"rendered":"Extreme Advice 1: Make all Methods virtual!"},"content":{"rendered":"<p>&#8220;Make all Methods virtual!&#8221; This was actually a sign on the door of the Head of Engineering in a company i used to work. I thought at the time this was a pretty extreme advice. It was actually targeted at the C++ programmers in our group but can be applied to C# as well. The background was that this guy used to be a Java programmer. In Java you have the opposite situation: Every method is virtual by default! You have to say explicitly that a method shall be final (non-virtual).<\/p>\n<p>Now I came to the conclusion that this is a very good advice, especially if you are working on a framework. I had recently various situations where we had to change our framework simply because we needed to override a method. This is a big thing because you have to redistribute the framework, do tests etc.<\/p>\n<p>The only downside of making everything virtual is a slight diminished performance (as the compiler needs to put hooks into your code to provide a possibility to override things). There is an excellent discussion about this on artima (<a href=\"http:\/\/www.artima.com\/intv\/nonvirtual.html\">http:\/\/www.artima.com\/intv\/nonvirtual.html<\/a>) with Anders Hejlsberg. I definitely would argue, that it is worth following this &#8220;extreme advice&#8221;.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#8220;Make all Methods virtual!&#8221; This was actually a sign on the door of the Head of Engineering in a company i used to work. I thought at the time this was a pretty extreme advice. It was actually targeted at the C++ programmers in our group but can be applied to C# as well. The &hellip; <a href=\"https:\/\/todescotechnologies.com\/unboxed\/index.php\/2007\/12\/19\/extreme-advice-1-make-all-methods-virtual\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Extreme Advice 1: Make all Methods virtual!<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-12","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/todescotechnologies.com\/unboxed\/index.php\/wp-json\/wp\/v2\/posts\/12","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/todescotechnologies.com\/unboxed\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/todescotechnologies.com\/unboxed\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/todescotechnologies.com\/unboxed\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/todescotechnologies.com\/unboxed\/index.php\/wp-json\/wp\/v2\/comments?post=12"}],"version-history":[{"count":0,"href":"https:\/\/todescotechnologies.com\/unboxed\/index.php\/wp-json\/wp\/v2\/posts\/12\/revisions"}],"wp:attachment":[{"href":"https:\/\/todescotechnologies.com\/unboxed\/index.php\/wp-json\/wp\/v2\/media?parent=12"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/todescotechnologies.com\/unboxed\/index.php\/wp-json\/wp\/v2\/categories?post=12"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/todescotechnologies.com\/unboxed\/index.php\/wp-json\/wp\/v2\/tags?post=12"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}