<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Eliminating Final</title>
	<atom:link href="http://cafe.elharo.com/blogroll/eliminating-final/feed/" rel="self" type="application/rss+xml" />
	<link>http://cafe.elharo.com/blogroll/eliminating-final/</link>
	<description>Longer than a blog; shorter than a book</description>
	<lastBuildDate>Tue, 09 Mar 2010 18:31:23 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Daniel Cadenas</title>
		<link>http://cafe.elharo.com/blogroll/eliminating-final/comment-page-1/#comment-103545</link>
		<dc:creator>Daniel Cadenas</dc:creator>
		<pubDate>Wed, 20 Jun 2007 21:34:12 +0000</pubDate>
		<guid isPermaLink="false">http://cafe.elharo.com/java/eliminating-final/#comment-103545</guid>
		<description>All this problems arise because nowadays interfaces don&#039;t define complete contracts.
I&#039;m waiting for the day in which we can define post and pre-conditions inside interfaces.</description>
		<content:encoded><![CDATA[<p>All this problems arise because nowadays interfaces don&#8217;t define complete contracts.<br />
I&#8217;m waiting for the day in which we can define post and pre-conditions inside interfaces.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pete Miller</title>
		<link>http://cafe.elharo.com/blogroll/eliminating-final/comment-page-1/#comment-5334</link>
		<dc:creator>Pete Miller</dc:creator>
		<pubDate>Thu, 13 Jul 2006 00:22:37 +0000</pubDate>
		<guid isPermaLink="false">http://cafe.elharo.com/java/eliminating-final/#comment-5334</guid>
		<description>Many of the objections in my previous post would be overcome it the contract formed the basis for unit testing the classes. If there were a tool in the style of Agitator that used heuristics for testing based on the Contract then that would elevate the importance of the contract, make it more complete and kill two birds with one stone.

Then it would remain to achieve the same flexibility of using interfaces with Contracts. Is it not possible to place contracts on interface definitions? Do Contracts, in practice, reply on implementation details for their operation? I suspect they must and this would be a problem.</description>
		<content:encoded><![CDATA[<p>Many of the objections in my previous post would be overcome it the contract formed the basis for unit testing the classes. If there were a tool in the style of Agitator that used heuristics for testing based on the Contract then that would elevate the importance of the contract, make it more complete and kill two birds with one stone.</p>
<p>Then it would remain to achieve the same flexibility of using interfaces with Contracts. Is it not possible to place contracts on interface definitions? Do Contracts, in practice, reply on implementation details for their operation? I suspect they must and this would be a problem.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Erich Schubert</title>
		<link>http://cafe.elharo.com/blogroll/eliminating-final/comment-page-1/#comment-5333</link>
		<dc:creator>Erich Schubert</dc:creator>
		<pubDate>Wed, 12 Jul 2006 23:38:45 +0000</pubDate>
		<guid isPermaLink="false">http://cafe.elharo.com/java/eliminating-final/#comment-5333</guid>
		<description>C++ requires you to specify a method as &quot;virtual&quot; if you want to allow subclasses to be able to override them.
Isn&#039;t that pretty close to what you want?
Basically the &quot;virtual&quot; keyword means in the contract &quot;be careful, derived classes might change this behaviour&quot;.
(apart from that, the compiler can optimize better when he knows he doesn&#039;t need to look up the actual method to be called. In fact, it can eventually inline the method.)

C++ is still a powerful language, not really obsoleted by Java or C#.

The only big drawback of C++ is it&#039;s syntax (which in turn is inherited from C), especially the use of preprocessor macros make it a PITA to process, which makes refactoring and other source code processing &quot;potentially impossible&quot; (read: no tool will be totally reliable).

Oh, and of course that many people never bothered to actually learn proper C++... or where to find C++ libraries (e.g. boost) that can somewhat compete with the huge class libraries of Java and C#. It&#039;s all there, just not in one big help file as with java and C#.

In fact, Java has been hitting some of the &quot;library problems&quot; that have been scaring away people from C/C++. Todays java apps often come with a collection of .jar files. Replace one, and you&#039;re likely to break something. Many people end up having a dozen copies (or different versions) of xerces on their computer, what a waste... My system has over 100 java &quot;library&quot; jars installed (including xerces, xalan, lucene, junit, ant, openoffice and commons) - fortunately my linux distribution handles this dependency hell just as it does for all the other languages.
All this was just &quot;delayed&quot; by java having a larger standard library than C++ has. And C# in turn seems to have an even larger lib. But - if you&#039;ve ever come to develop Java for a mobile device, you&#039;ll be aware that not all of these libraries are available on every system...</description>
		<content:encoded><![CDATA[<p>C++ requires you to specify a method as &#8220;virtual&#8221; if you want to allow subclasses to be able to override them.<br />
Isn&#8217;t that pretty close to what you want?<br />
Basically the &#8220;virtual&#8221; keyword means in the contract &#8220;be careful, derived classes might change this behaviour&#8221;.<br />
(apart from that, the compiler can optimize better when he knows he doesn&#8217;t need to look up the actual method to be called. In fact, it can eventually inline the method.)</p>
<p>C++ is still a powerful language, not really obsoleted by Java or C#.</p>
<p>The only big drawback of C++ is it&#8217;s syntax (which in turn is inherited from C), especially the use of preprocessor macros make it a PITA to process, which makes refactoring and other source code processing &#8220;potentially impossible&#8221; (read: no tool will be totally reliable).</p>
<p>Oh, and of course that many people never bothered to actually learn proper C++&#8230; or where to find C++ libraries (e.g. boost) that can somewhat compete with the huge class libraries of Java and C#. It&#8217;s all there, just not in one big help file as with java and C#.</p>
<p>In fact, Java has been hitting some of the &#8220;library problems&#8221; that have been scaring away people from C/C++. Todays java apps often come with a collection of .jar files. Replace one, and you&#8217;re likely to break something. Many people end up having a dozen copies (or different versions) of xerces on their computer, what a waste&#8230; My system has over 100 java &#8220;library&#8221; jars installed (including xerces, xalan, lucene, junit, ant, openoffice and commons) &#8211; fortunately my linux distribution handles this dependency hell just as it does for all the other languages.<br />
All this was just &#8220;delayed&#8221; by java having a larger standard library than C++ has. And C# in turn seems to have an even larger lib. But &#8211; if you&#8217;ve ever come to develop Java for a mobile device, you&#8217;ll be aware that not all of these libraries are available on every system&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pete Miller</title>
		<link>http://cafe.elharo.com/blogroll/eliminating-final/comment-page-1/#comment-5265</link>
		<dc:creator>Pete Miller</dc:creator>
		<pubDate>Mon, 10 Jul 2006 12:36:40 +0000</pubDate>
		<guid isPermaLink="false">http://cafe.elharo.com/java/eliminating-final/#comment-5265</guid>
		<description>Design by Contract, like provably correct programs, is a good concept.

However, besides the fact that perhaps half the Java developers out there aren&#039;t interested and capable of using it correctly, DbC has a fatal flaw. That flaw is that pre-conditions, post-conditions and invariants do not have to be correct and *complete* for the program to work correctly. So, human nature being what it is, they invariably aren&#039;t correct. I would like to see some real DbC code and see if I couldn&#039;t find a heap of missing conditions. These holes imply that the benefits of the approach are less than perfect. 

I have seen it attempted in requirements Use Cases, by good BAs, and the results aren&#039;t encouraging. Because it&#039;s not the primary driver, the proper attention is not given to it being correct and complete.

So, give me the flexibility of non-final methods, and as a developer I&#039;ll take the consequences. That is, unless you can give me a water-tight DbC scheme. If you are going to suggest unit tests as a solution, then I will use the same reason for not making methods final.

I know it&#039;s not quite the same thing, but I&#039;ve had to create an effective subclass of java.util.Date, for practical reasons,  using delegation, and it was not pretty. A non-final Date class would have been valuable there. I suspect non-final methods would provide similar benefits.

The library working as advertised is an internal concept and entirely within the capability of the library provider to guarantee with the use of DbC. There are thousands of libraries out there that â€œwork as advertisedâ€ without using it.

I believe that the practical benefits of being able to inject, at runtime if desired, concrete classes that satisfy an interface brings far greater benefits than anything you are suggesting.</description>
		<content:encoded><![CDATA[<p>Design by Contract, like provably correct programs, is a good concept.</p>
<p>However, besides the fact that perhaps half the Java developers out there aren&#8217;t interested and capable of using it correctly, DbC has a fatal flaw. That flaw is that pre-conditions, post-conditions and invariants do not have to be correct and *complete* for the program to work correctly. So, human nature being what it is, they invariably aren&#8217;t correct. I would like to see some real DbC code and see if I couldn&#8217;t find a heap of missing conditions. These holes imply that the benefits of the approach are less than perfect. </p>
<p>I have seen it attempted in requirements Use Cases, by good BAs, and the results aren&#8217;t encouraging. Because it&#8217;s not the primary driver, the proper attention is not given to it being correct and complete.</p>
<p>So, give me the flexibility of non-final methods, and as a developer I&#8217;ll take the consequences. That is, unless you can give me a water-tight DbC scheme. If you are going to suggest unit tests as a solution, then I will use the same reason for not making methods final.</p>
<p>I know it&#8217;s not quite the same thing, but I&#8217;ve had to create an effective subclass of java.util.Date, for practical reasons,  using delegation, and it was not pretty. A non-final Date class would have been valuable there. I suspect non-final methods would provide similar benefits.</p>
<p>The library working as advertised is an internal concept and entirely within the capability of the library provider to guarantee with the use of DbC. There are thousands of libraries out there that â€œwork as advertisedâ€ without using it.</p>
<p>I believe that the practical benefits of being able to inject, at runtime if desired, concrete classes that satisfy an interface brings far greater benefits than anything you are suggesting.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Reg Braithwaite</title>
		<link>http://cafe.elharo.com/blogroll/eliminating-final/comment-page-1/#comment-1320</link>
		<dc:creator>Reg Braithwaite</dc:creator>
		<pubDate>Thu, 01 Jun 2006 18:52:13 +0000</pubDate>
		<guid isPermaLink="false">http://cafe.elharo.com/java/eliminating-final/#comment-1320</guid>
		<description>Off Topic... sort of...

&quot;By being able to override anything without changing the ActiveRectord source code, you avoid this beneficial communication with the original developers.&quot;

I think there&#039;s a slightly different culture around this. The process at the moment (Rails is still very young) is to write a plugin that &quot;monkey patches&quot; Rails to do what you want if it is something you want to reuse. You can share the plugin with the world. This is how &quot;acts_as_versioned&quot;, &quot;acts_as_paranoid,&quot; and &quot;acts_as_threaded&quot; work at the moment.

The Rails team can incorporate the ideas into Rails or leave them as plugins if it makes more sense to let developers pick and choose. DHH says that every 37signals project uses 5-6 plugins, so he clearly likes the plugin philosophy.

I think plugin is to framework as mixin is to class. With all of the same connotations and implications raised by this interesting debate about flexibility, power, safety, ease of use, &amp;tc.</description>
		<content:encoded><![CDATA[<p>Off Topic&#8230; sort of&#8230;</p>
<p>&#8220;By being able to override anything without changing the ActiveRectord source code, you avoid this beneficial communication with the original developers.&#8221;</p>
<p>I think there&#8217;s a slightly different culture around this. The process at the moment (Rails is still very young) is to write a plugin that &#8220;monkey patches&#8221; Rails to do what you want if it is something you want to reuse. You can share the plugin with the world. This is how &#8220;acts_as_versioned&#8221;, &#8220;acts_as_paranoid,&#8221; and &#8220;acts_as_threaded&#8221; work at the moment.</p>
<p>The Rails team can incorporate the ideas into Rails or leave them as plugins if it makes more sense to let developers pick and choose. DHH says that every 37signals project uses 5-6 plugins, so he clearly likes the plugin philosophy.</p>
<p>I think plugin is to framework as mixin is to class. With all of the same connotations and implications raised by this interesting debate about flexibility, power, safety, ease of use, &amp;tc.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian Slesinsky</title>
		<link>http://cafe.elharo.com/blogroll/eliminating-final/comment-page-1/#comment-1304</link>
		<dc:creator>Brian Slesinsky</dc:creator>
		<pubDate>Thu, 01 Jun 2006 17:22:33 +0000</pubDate>
		<guid isPermaLink="false">http://cafe.elharo.com/java/eliminating-final/#comment-1304</guid>
		<description>Actually, if the ActiveRecord framework were locked down, you wouldn&#039;t be stuck, but you&#039;d have to copy the source code and patch it to do what you want.  Then it would be a very good idea to send your patches upstream, so they&#039;re in the next release.  By being able to override anything without changing the ActiveRectord source code, you avoid this beneficial communication with the original developers.  They have no idea what you&#039;re doing and won&#039;t be able to avoid breaking your code in their next release.</description>
		<content:encoded><![CDATA[<p>Actually, if the ActiveRecord framework were locked down, you wouldn&#8217;t be stuck, but you&#8217;d have to copy the source code and patch it to do what you want.  Then it would be a very good idea to send your patches upstream, so they&#8217;re in the next release.  By being able to override anything without changing the ActiveRectord source code, you avoid this beneficial communication with the original developers.  They have no idea what you&#8217;re doing and won&#8217;t be able to avoid breaking your code in their next release.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael Buckley</title>
		<link>http://cafe.elharo.com/blogroll/eliminating-final/comment-page-1/#comment-1288</link>
		<dc:creator>Michael Buckley</dc:creator>
		<pubDate>Thu, 01 Jun 2006 14:47:13 +0000</pubDate>
		<guid isPermaLink="false">http://cafe.elharo.com/java/eliminating-final/#comment-1288</guid>
		<description>A minor disagreement:

&quot;Bad practices you can get away with on small teams and simple projects cause problems for large teams and complex projects. &quot;

I would restate this as: Practices that are appropriate and cost effective on smaller teams may be inappropriate or even disastrous in larger, disconnected projects.</description>
		<content:encoded><![CDATA[<p>A minor disagreement:</p>
<p>&#8220;Bad practices you can get away with on small teams and simple projects cause problems for large teams and complex projects. &#8221;</p>
<p>I would restate this as: Practices that are appropriate and cost effective on smaller teams may be inappropriate or even disastrous in larger, disconnected projects.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Reg Braithwaite</title>
		<link>http://cafe.elharo.com/blogroll/eliminating-final/comment-page-1/#comment-1275</link>
		<dc:creator>Reg Braithwaite</dc:creator>
		<pubDate>Thu, 01 Jun 2006 12:33:16 +0000</pubDate>
		<guid isPermaLink="false">http://cafe.elharo.com/java/eliminating-final/#comment-1275</guid>
		<description>&quot;It seems to me that the real issue here is fault isolation for a libraryâ€™s public API. &quot;

It seems that the real issue here is trust. It sounds like what you want is a library that will work properly no matter what a fellow programmer does. And if she &#039;misuse&#039;s the public API, or makes a mistake, you want to take 100% control of error reporting. You do not trust her to do things well. You do not trust her to debug her own problems.

If she writes her own callbacks, by passing in objects conforming to an interface or by overriding something in the library, you don&#039;t even trust her to write her own unit tests to make sure that her own application is working properly. You want unit tests for the library that will anticipate her every move! Of course this can only be done by restricting her freedom, deprecating her from a programmer into a user.

Here&#039;s a practical example: I am working on a Ruby project. You get truly private variables, no negotiation. But you do not get final methods. It&#039;s better than that: you can change methods at runtime, and in fact that&#039;s how a lot of programming works: classes from the Rails framework are actually patched in the application.

That&#039;s what makes it possible to add version tracking to model data with a one-liner. And in my own case, I need to go one further: when one model has a reference to another model, I need to track when the reference gets out of date. I need to patch the way references work so that I can refer to a model&#039;s ID and also its version number.

Needless to say, if the author of ActiveRecord locked his framework down, there wouldn&#039;t be an acts_as_versioned plugin until he felt that his framework should include it. And if the author of acts_as_versioned locked his plugin down, I wouldn&#039;t be able to created versioned_references.</description>
		<content:encoded><![CDATA[<p>&#8220;It seems to me that the real issue here is fault isolation for a libraryâ€™s public API. &#8221;</p>
<p>It seems that the real issue here is trust. It sounds like what you want is a library that will work properly no matter what a fellow programmer does. And if she &#8216;misuse&#8217;s the public API, or makes a mistake, you want to take 100% control of error reporting. You do not trust her to do things well. You do not trust her to debug her own problems.</p>
<p>If she writes her own callbacks, by passing in objects conforming to an interface or by overriding something in the library, you don&#8217;t even trust her to write her own unit tests to make sure that her own application is working properly. You want unit tests for the library that will anticipate her every move! Of course this can only be done by restricting her freedom, deprecating her from a programmer into a user.</p>
<p>Here&#8217;s a practical example: I am working on a Ruby project. You get truly private variables, no negotiation. But you do not get final methods. It&#8217;s better than that: you can change methods at runtime, and in fact that&#8217;s how a lot of programming works: classes from the Rails framework are actually patched in the application.</p>
<p>That&#8217;s what makes it possible to add version tracking to model data with a one-liner. And in my own case, I need to go one further: when one model has a reference to another model, I need to track when the reference gets out of date. I need to patch the way references work so that I can refer to a model&#8217;s ID and also its version number.</p>
<p>Needless to say, if the author of ActiveRecord locked his framework down, there wouldn&#8217;t be an acts_as_versioned plugin until he felt that his framework should include it. And if the author of acts_as_versioned locked his plugin down, I wouldn&#8217;t be able to created versioned_references.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian Slesinsky</title>
		<link>http://cafe.elharo.com/blogroll/eliminating-final/comment-page-1/#comment-1262</link>
		<dc:creator>Brian Slesinsky</dc:creator>
		<pubDate>Thu, 01 Jun 2006 07:17:04 +0000</pubDate>
		<guid isPermaLink="false">http://cafe.elharo.com/java/eliminating-final/#comment-1262</guid>
		<description>It seems to me that the real issue here is fault isolation for a library&#039;s public API.  It&#039;s well-known that a public API should always check its arguments (throwing IllegalArgumentException).  On the other hand, a public API&#039;s postconditions are usually not tested in the production code.  Typically they&#039;re checked by asserts in unit tests, and we assume that the library conforms to its postconditions if it passes its test suite.

However, whenever a library allows the client code to install a callback method, it&#039;s the opposite.  Then we can use a unit test to verify that the library calls the hook with the correct arguments, but for proper fault isolation, the library needs to check the hook&#039;s postconditions when it returns.  Returning from a callback method is an entry point into the library, just like a method call.

Any overridable method is potentially a callback, so this implies that the library should always check the return values of overridable methods for reasonableness.  That&#039;s enough of a burden that overridable methods probably shouldn&#039;t be the default in a public API.  Typically, the public methods should be final and the overridable methods should be protected and have default implementations that are either empty or entirely optional.

But I&#039;m still not sure how important this is.  It seems to me that there are all sorts of ways you can misuse a library that aren&#039;t checked, such as calling a non-threadsafe class from multiple threads, or synchronizing on the wrong thing, or just hanging in the middle of a callback.  Typically libraries try to check for the most common programming errors, but they don&#039;t check for every possible programming error.</description>
		<content:encoded><![CDATA[<p>It seems to me that the real issue here is fault isolation for a library&#8217;s public API.  It&#8217;s well-known that a public API should always check its arguments (throwing IllegalArgumentException).  On the other hand, a public API&#8217;s postconditions are usually not tested in the production code.  Typically they&#8217;re checked by asserts in unit tests, and we assume that the library conforms to its postconditions if it passes its test suite.</p>
<p>However, whenever a library allows the client code to install a callback method, it&#8217;s the opposite.  Then we can use a unit test to verify that the library calls the hook with the correct arguments, but for proper fault isolation, the library needs to check the hook&#8217;s postconditions when it returns.  Returning from a callback method is an entry point into the library, just like a method call.</p>
<p>Any overridable method is potentially a callback, so this implies that the library should always check the return values of overridable methods for reasonableness.  That&#8217;s enough of a burden that overridable methods probably shouldn&#8217;t be the default in a public API.  Typically, the public methods should be final and the overridable methods should be protected and have default implementations that are either empty or entirely optional.</p>
<p>But I&#8217;m still not sure how important this is.  It seems to me that there are all sorts of ways you can misuse a library that aren&#8217;t checked, such as calling a non-threadsafe class from multiple threads, or synchronizing on the wrong thing, or just hanging in the middle of a callback.  Typically libraries try to check for the most common programming errors, but they don&#8217;t check for every possible programming error.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gp</title>
		<link>http://cafe.elharo.com/blogroll/eliminating-final/comment-page-1/#comment-1245</link>
		<dc:creator>Gp</dc:creator>
		<pubDate>Wed, 31 May 2006 18:13:48 +0000</pubDate>
		<guid isPermaLink="false">http://cafe.elharo.com/java/eliminating-final/#comment-1245</guid>
		<description>&quot;It has everything to do with making sure the library works as advertised. That is my business.&quot;

Nothing works as advertised... except in books.

&quot;Sometimes one method in the library depends on another. If that method A is changed, method B may no longer function. Sometimes thereâ€™s more than two people involved. Developer B can change a methodâ€™s behavior in a subclass and thus break the code for developer C.&quot;

Good automated tests (i.e. Unit Tests) should prevent this. Tests are designed from the &quot;User of the interface&quot; perspective. So changes in the interface should be caught very early.

&quot;Bad practices you can get away with on small teams and simple projects cause problems for large teams and complex projects.&quot;

Rigid code is a bad practice. Everything should be changeable in the fast-moving world of software.</description>
		<content:encoded><![CDATA[<p>&#8220;It has everything to do with making sure the library works as advertised. That is my business.&#8221;</p>
<p>Nothing works as advertised&#8230; except in books.</p>
<p>&#8220;Sometimes one method in the library depends on another. If that method A is changed, method B may no longer function. Sometimes thereâ€™s more than two people involved. Developer B can change a methodâ€™s behavior in a subclass and thus break the code for developer C.&#8221;</p>
<p>Good automated tests (i.e. Unit Tests) should prevent this. Tests are designed from the &#8220;User of the interface&#8221; perspective. So changes in the interface should be caught very early.</p>
<p>&#8220;Bad practices you can get away with on small teams and simple projects cause problems for large teams and complex projects.&#8221;</p>
<p>Rigid code is a bad practice. Everything should be changeable in the fast-moving world of software.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
