{"id":348,"date":"2019-10-17T13:59:58","date_gmt":"2019-10-17T19:59:58","guid":{"rendered":"https:\/\/www.great-white-software.com\/blog\/?p=348"},"modified":"2019-11-19T09:54:53","modified_gmt":"2019-11-19T16:54:53","slug":"finally","status":"publish","type":"post","link":"https:\/\/www.great-white-software.com\/blog\/2019\/10\/17\/finally\/","title":{"rendered":"Final(ly)"},"content":{"rendered":"\n<p>Some languages have to notion of FINAL for methods, events, properties and many other aspects of the language.<\/p>\n\n\n\n<p>But what exactly does FINAL do or mean ?<\/p>\n\n\n\n<p>In other languages, like Java, FINAL has other uses like creating &#8220;constants&#8221; which there is no need for in Xojo. In those languages a FINAL property is a constant.<\/p>\n\n\n\n<p>In some cases though you might create a class and implement a method that you do NOT want subclasses to override. This could be needed for some algorithm where a subclass overriding the method could negatively affect the operation of the algorithm.<\/p>\n\n\n\n<p>A good example might be something like a StringBuilder class that has an internal buffer that it uses to create a fast string building mechanism. The method that manipulates this internal buffer should be an implementation detail that subclasses should probably not be able to override. <\/p>\n\n\n\n<p>Currently in Xojo the only way to make a method NOT overridable is to make it private. But as soon as you do that subclasses cannot call it.<\/p>\n\n\n\n<p>In Xojo if you want this class to be subclassable you have to make its methods either public or protected. And as soon as you do that a subclass CAN override those methods.<\/p>\n\n\n\n<p>Being able to mark a method as FINAL would prevent the ability of a subclass to subvert and take over certain critical function and still make the method usable by the subclass.<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Some languages have to notion of FINAL for methods, events, properties and many other aspects of the language. But what exactly does FINAL do or mean ? In other languages, like Java, FINAL has other uses like creating &#8220;constants&#8221; which there is no need for in Xojo. In those languages a FINAL property is a &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.great-white-software.com\/blog\/2019\/10\/17\/finally\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Final(ly)&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1],"tags":[3],"class_list":["post-348","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-xojo"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.great-white-software.com\/blog\/wp-json\/wp\/v2\/posts\/348","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.great-white-software.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.great-white-software.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.great-white-software.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.great-white-software.com\/blog\/wp-json\/wp\/v2\/comments?post=348"}],"version-history":[{"count":1,"href":"https:\/\/www.great-white-software.com\/blog\/wp-json\/wp\/v2\/posts\/348\/revisions"}],"predecessor-version":[{"id":349,"href":"https:\/\/www.great-white-software.com\/blog\/wp-json\/wp\/v2\/posts\/348\/revisions\/349"}],"wp:attachment":[{"href":"https:\/\/www.great-white-software.com\/blog\/wp-json\/wp\/v2\/media?parent=348"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.great-white-software.com\/blog\/wp-json\/wp\/v2\/categories?post=348"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.great-white-software.com\/blog\/wp-json\/wp\/v2\/tags?post=348"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}