<?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: Variable Declarations</title> <atom:link href="http://www.symphonious.net/2008/06/20/variable-declarations/feed/" rel="self" type="application/rss+xml" /><link>http://www.symphonious.net/2008/06/20/variable-declarations/</link> <description>Living in a state of accord.</description> <lastBuildDate>Tue, 07 Feb 2012 01:07:58 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>By: Adrian Sutton</title><link>http://www.symphonious.net/2008/06/20/variable-declarations/comment-page-1/#comment-165592</link> <dc:creator>Adrian Sutton</dc:creator> <pubDate>Mon, 23 Jun 2008 20:02:50 +0000</pubDate> <guid
isPermaLink="false">http://www.symphonious.net/?p=875#comment-165592</guid> <description>If you&#039;re going to program to an interface to an implementation you effectively need static typing and a declared type - otherwise you&#039;re just getting lucky. You can keep it in mind and do your best etc, but it&#039;s easy to slip up and get it wrong and then you can have a fair bit of work to back out that slip up depending on exactly what it lead to. For example if you think you have an ArrayList instead of Collection and thus use algorithms that require random access instead of iterating you&#039;ve got large chunks of code to rewrite. You can only guarantee that won&#039;t happen if you have strict, explicitly declared type checking.
That&#039;s not to say strictly typed languages are better, just that if you&#039;re dealing with strict typing you may as well get the benefits, saving a few characters and giving up that kind of guarantee is kind of silly.
As for language vs library, certainly the language has an impact on the library, but not to the extend necessarily expect. You can generally find ways to make an API highly productive in any language, Java&#039;s big problem is that it typically doesn&#039;t try to make things concise. It&#039;s simple to have all the power of the Java IO APIs but still provide a simple method that reads from standard in or a file. Similarly even though Java doesn&#039;t have regex built into the language, it&#039;s trivial to provide simple utility methods like String.replaceAll() which is just as good as the // syntax used by many languages that have native support.</description> <content:encoded><![CDATA[<p>If you&#8217;re going to program to an interface to an implementation you effectively need static typing and a declared type &#8211; otherwise you&#8217;re just getting lucky. You can keep it in mind and do your best etc, but it&#8217;s easy to slip up and get it wrong and then you can have a fair bit of work to back out that slip up depending on exactly what it lead to. For example if you think you have an ArrayList instead of Collection and thus use algorithms that require random access instead of iterating you&#8217;ve got large chunks of code to rewrite. You can only guarantee that won&#8217;t happen if you have strict, explicitly declared type checking.</p><p>That&#8217;s not to say strictly typed languages are better, just that if you&#8217;re dealing with strict typing you may as well get the benefits, saving a few characters and giving up that kind of guarantee is kind of silly.</p><p>As for language vs library, certainly the language has an impact on the library, but not to the extend necessarily expect. You can generally find ways to make an API highly productive in any language, Java&#8217;s big problem is that it typically doesn&#8217;t try to make things concise. It&#8217;s simple to have all the power of the Java IO APIs but still provide a simple method that reads from standard in or a file. Similarly even though Java doesn&#8217;t have regex built into the language, it&#8217;s trivial to provide simple utility methods like String.replaceAll() which is just as good as the // syntax used by many languages that have native support.</p> ]]></content:encoded> </item> <item><title>By: ddoctor</title><link>http://www.symphonious.net/2008/06/20/variable-declarations/comment-page-1/#comment-165444</link> <dc:creator>ddoctor</dc:creator> <pubDate>Sun, 22 Jun 2008 23:22:34 +0000</pubDate> <guid
isPermaLink="false">http://www.symphonious.net/?p=875#comment-165444</guid> <description>It comes down to:
&quot;programming to an interface, not an implementation&quot;
I&#039;ll agree that the Java IO library is a bit cumbersome - basic file IO shouldn&#039;t have so many ways to do it wrong. For such simple operations, the syntax (language and library) should be elegant. I mean - cumbersome file IO code is one reason why people prefer databases to filesystems.
The flipside is that Java IO gives you lots of flexibility and extensibility.
To many it doesn&#039;t make sense to instantiate and wrap and wrap. However, once you learn the Decorator pattern, it makes a bit more sense. Serial access to a file may be used if I want to write a replacement for BufferedReader.
Without the declared type, programming to an interface, or Decorator become less elegant.
&gt; Why not just call it a Map? Well let’s say you later want the map to be sorted, then it simply becomes....
Yep. A key benefit of programming to an interface, in a strongly-typed language. Let&#039;s look at how this works in other language types:
In a typeless or dynamically-typed language, you can still change the implementation without changing the declared type, so long as the code still meets the new interface - this is more dangerous, though, as the errors aren&#039;t found compile-time.
In a statically-typed language which supports implicit types in variable declaration (eg F#), you can change the implementation type without changing the declared type... however, issues will be picked up by the compiler, as types are still static. This might be a candidate for a &quot;best of both worlds&quot;.
My preference is definitely with statically-typed language, for this type of issue.
I&#039;ll agree that the libraries have a bigger impact on the ease of use of a language... but the impact of the language itself shouldn&#039;t be underestimated. Same goes for ide/tool support. To me, they would have to be the 3 big factors in a language&#039;s ease-of-use.
Another thing to consider is that the distinction between language and library is blurred. For a given feature, one language may implement it in library and another may make it native syntax. Also, for a given task, you use a mix of language and library. The syntax of the language impacts how elegant the library usage is. The language&#039;s syntactic strengths drive library development, and, as such, the combination of both impacts the usability, as does each separately.</description> <content:encoded><![CDATA[<p>It comes down to:<br
/> &#8220;programming to an interface, not an implementation&#8221;</p><p>I&#8217;ll agree that the Java IO library is a bit cumbersome &#8211; basic file IO shouldn&#8217;t have so many ways to do it wrong. For such simple operations, the syntax (language and library) should be elegant. I mean &#8211; cumbersome file IO code is one reason why people prefer databases to filesystems.</p><p>The flipside is that Java IO gives you lots of flexibility and extensibility.</p><p>To many it doesn&#8217;t make sense to instantiate and wrap and wrap. However, once you learn the Decorator pattern, it makes a bit more sense. Serial access to a file may be used if I want to write a replacement for BufferedReader.</p><p>Without the declared type, programming to an interface, or Decorator become less elegant.</p><p>&gt; Why not just call it a Map? Well let’s say you later want the map to be sorted, then it simply becomes&#8230;.</p><p>Yep. A key benefit of programming to an interface, in a strongly-typed language. Let&#8217;s look at how this works in other language types:</p><p>In a typeless or dynamically-typed language, you can still change the implementation without changing the declared type, so long as the code still meets the new interface &#8211; this is more dangerous, though, as the errors aren&#8217;t found compile-time.</p><p>In a statically-typed language which supports implicit types in variable declaration (eg F#), you can change the implementation type without changing the declared type&#8230; however, issues will be picked up by the compiler, as types are still static. This might be a candidate for a &#8220;best of both worlds&#8221;.</p><p>My preference is definitely with statically-typed language, for this type of issue.</p><p>I&#8217;ll agree that the libraries have a bigger impact on the ease of use of a language&#8230; but the impact of the language itself shouldn&#8217;t be underestimated. Same goes for ide/tool support. To me, they would have to be the 3 big factors in a language&#8217;s ease-of-use.</p><p>Another thing to consider is that the distinction between language and library is blurred. For a given feature, one language may implement it in library and another may make it native syntax. Also, for a given task, you use a mix of language and library. The syntax of the language impacts how elegant the library usage is. The language&#8217;s syntactic strengths drive library development, and, as such, the combination of both impacts the usability, as does each separately.</p> ]]></content:encoded> </item> </channel> </rss>
