<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>

<channel>
	<title>Pain and Glory from the Trenches of the IT World</title>
	<atom:link href="http://pinderkent.blogsavy.com/feed" rel="self" type="application/rss+xml" />
	<link>http://pinderkent.blogsavy.com</link>
	<description>Just another Blogsavy.com weblog</description>
	<pubDate>Thu, 24 Apr 2008 20:14:59 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5</generator>
	<language>en</language>
			<item>
		<title>Why should we have to tune the JVM&#8217;s memory parameters to run NetBeans acceptably?</title>
		<link>http://pinderkent.blogsavy.com/archives/146</link>
		<comments>http://pinderkent.blogsavy.com/archives/146#comments</comments>
		<pubDate>Sat, 08 Mar 2008 23:29:17 +0000</pubDate>
		<dc:creator>pinderkent</dc:creator>
		
		<category><![CDATA[Development]]></category>

		<category><![CDATA[Java]]></category>

		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://pinderkent.blogsavy.com/archives/159</guid>
		<description><![CDATA[Many Java developers have at least some experience with the NetBeans IDE. Although I prefer Eclipse for Java development, I do try to use NetBeans occasionally to keep up to date with their developments. The last time I tried it, the results were rather terrible. I found NetBeans 6.0 Beta 1 to be extremely slow, [...]]]></description>
			<content:encoded><![CDATA[<p>Many <a href="//www.java.net">Java</a> developers have at least some experience with the <a href="http://www.netbeans.org">NetBeans</a> IDE. Although I prefer <a href="http://www.eclipse.org">Eclipse</a> for Java development, I do try to use NetBeans occasionally to keep up to date with their developments. The last time I tried it, the results were rather terrible. I found <a href="http://pinderkent.blogsavy.com/archives/132">NetBeans 6.0 Beta 1 to be extremely slow</a>, even on a modern system with a multicore CPU and gigabytes of RAM. It wasn&#8217;t just a matter of it not running well for certain intensive operations. It was sluggish and barely usable for even just editing text.</p>
<p>In response to my earlier article, a number of people suggested various JVM parameters that could be altered to improve the performance of NetBeans. And just today I noticed another blog post about <a href="http://blogs.sun.com/kto/entry/why_is_netbeans_so_slow">setting such JVM parameters</a> to improve the runtime performance of NetBeans. Now, I haven&#8217;t tried such tuning myself, to see if it would improve NetBeans for me. At this point, I don&#8217;t care. I have no reason to use NetBeans, as Eclipse works far better.</p>
<p>However, I think it&#8217;s pathetic that we have to resort to tuning JVM memory usage parameters just to run NetBeans in a somewhat-usable manner. We&#8217;re not talking about some multi-protocol, high-scalability application server software that handles thousands of simultaneous users, where such tuning is understandable. We&#8217;re talking about NetBeans, which is basically a glorified text editor. Given the immense processing power offered even by PCs from five years ago, there&#8217;s absolutely no justifiable reason why we should have to be manually setting such JVM parameters.</p>
<p>I&#8217;ve never had to manually set such parameters when running Microsoft&#8217;s various <a href="http://msdn2.microsoft.com/en-us/vstudio/default.aspx">Visual Studio</a> incarnations. I&#8217;ve never had to set them when running Eclipse, or <a href="http://www.oracle.com/technology/products/jdev/index.html">JDeveloper</a>, or <a href="http://www.codegear.com/products/jbuilder">JBuilder</a>. Other modern IDEs, offering a comparable feature set and some even developed using essentially the same technology as NetBeans, manage to run fine without manual tuning.</p>
<p>The NetBeans developers really must re-evaluate the performance of their software. At the very least, it should not be necessary to resort to tuning such a large number of Java virtual machine parameters to get even just acceptable, let alone good, performance out of NetBeans.</p>
]]></content:encoded>
			<wfw:commentRss>http://pinderkent.blogsavy.com/archives/146/feed</wfw:commentRss>
		</item>
		<item>
		<title>Groovy is clearly not a statically typed language.</title>
		<link>http://pinderkent.blogsavy.com/archives/145</link>
		<comments>http://pinderkent.blogsavy.com/archives/145#comments</comments>
		<pubDate>Mon, 18 Feb 2008 17:59:11 +0000</pubDate>
		<dc:creator>pinderkent</dc:creator>
		
		<category><![CDATA[Development]]></category>

		<category><![CDATA[Python]]></category>

		<category><![CDATA[Ruby]]></category>

		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://pinderkent.blogsavy.com/archives/158</guid>
		<description><![CDATA[I recently wrote about how undetected type errors when using languages like Ruby and Python can be quite dangerous. That article has gotten some notice, with one response considering Groovy.
The article about Groovy purports to have an example of a statically typed Groovy script that compiles fine, but results in a type error at runtime. [...]]]></description>
			<content:encoded><![CDATA[<p>I recently wrote about how <a href="http://pinderkent.blogsavy.com/archives/157">undetected type errors</a> when using languages like <a href="http://www.ruby-lang.org/">Ruby</a> and <a href="http://www.python.org/">Python</a> can be quite dangerous. That article has gotten some notice, with <a href="http://groovy.dzone.com/news/dynamic-typing-vs-dynamic-lang">one response considering Groovy</a>.</p>
<p>The article about Groovy purports to have an example of a statically typed Groovy script that compiles fine, but results in a type error at runtime. The script is:</p>
<pre>
int x = "test"</pre>
<p>The error received at runtime is:</p>
<pre>
Caught: org.codehaus.groovy.runtime.typehandling.GroovyCastException:
Cannot cast object 'test' with class 'java.lang.String' to class 'java.lang.Integer'
at typesafe.run(typesafe.groovy:1)
at typesafe.main(typesafe.groovy)</pre>
<p>If Groovy were truly a statically typed language, then the compiler would have raised a compile-time error. But since that did not happen, one or more of the following may be true:</p>
<ol>
<li>The Groovy compiler does not perform adequate compile-time typechecking.</li>
<li></li>
<li>The Groovy compiler performs compile-time typechecking, but a bug prevents it from catching this particular error.</li>
<li>The semantics of Groovy prevent it from being a statically typed language.</li>
</ol>
<p>The essence of static typing is that such an error would always be caught at compile time. We can&#8217;t say that a language is statically typed if such an error occurs at runtime. Just because the programmer can specify the type of a variable (eg. &#8216;int&#8217; in this case), it does not mean that the language is statically typed. This is especially true if the compiler or interpreter completely ignores such type specifiers at compile-time.</p>
<p>So in this case, I think the verdict is quite clear: Groovy cannot be considered a statically typed language, as it exhibited a runtime type-related error.</p>
]]></content:encoded>
			<wfw:commentRss>http://pinderkent.blogsavy.com/archives/145/feed</wfw:commentRss>
		</item>
		<item>
		<title>A small example of the hidden dangers of dynamically typed programming languages.</title>
		<link>http://pinderkent.blogsavy.com/archives/144</link>
		<comments>http://pinderkent.blogsavy.com/archives/144#comments</comments>
		<pubDate>Sun, 17 Feb 2008 16:32:20 +0000</pubDate>
		<dc:creator>pinderkent</dc:creator>
		
		<category><![CDATA[Development]]></category>

		<category><![CDATA[Haskell]]></category>

		<category><![CDATA[Python]]></category>

		<category><![CDATA[Ruby]]></category>

		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://pinderkent.blogsavy.com/archives/157</guid>
		<description><![CDATA[Several days back I wrote about how unit testing is not a substitute for static typing. A comment posted to that article by James asked for more clarification regarding what I was talking about. James wrote, &#8220;I can&#8217;t recall the last time I had Ruby code break because I tried to act on an object [...]]]></description>
			<content:encoded><![CDATA[<p>Several days back I wrote about how <a href="http://pinderkent.blogsavy.com/archives/154">unit testing is not a substitute for static typing</a>. A <a href="http://pinderkent.blogsavy.com/archives/154#comment-3867">comment posted to that article by James</a> asked for more clarification regarding what I was talking about. James wrote, &#8220;I can&#8217;t recall the last time I had Ruby code break because I tried to act on an object of the &#8220;wrong&#8221; type.&#8221; Well, I will give a simple example of how such problems arise, and how different languages deal with them. The languages in question will be Ruby, Python, OCaml and Haskell.</p>
<p>Our example program will be simple. It will consist of two functions. One will be called &#8216;test&#8217;, it will take two integers, and it will return the arithmetic sum of them. The other function will be called &#8216;main&#8217;, and it will invoke the &#8216;test&#8217; function in two different ways, depending on the size of the array or list containing the command line arguments passed to the program. If there are over three command line arguments, the result of the &#8216;test&#8217; function applied to the values 1 and the function &#8216;test&#8217; is returned. Otherwise, the value of &#8216;test&#8217; applied to values 1 and 2 is returned. Thus the program should have a return value of 3 up until the array or list storing the command line parameters has more than 3 elements.</p>
<p>Since James mentioned <a href="http://www.ruby-lang.org/">Ruby</a>, let&#8217;s start with the Ruby version of the code:</p>
<pre>
def test(a, b)
  a + b
end

def main()
  if ARGV.length &gt; 3
    test(1, test)
  else
    test(1, 2)
  end
end

Process.exit(main())</pre>
<p>And now we&#8217;ll run it, with warnings enabled and set at the most verbose setting:</p>
<pre>
$ ruby -w -W2 t.rb; echo $?
3
$ ruby -w -W2 t.rb 0; echo $?
3
$ ruby -w -W2 t.rb 0 1; echo $?
3
$ ruby -w -W2 t.rb 0 1 2; echo $?
3
$ ruby -w -W2 t.rb 0 1 2 3; echo $?
t.rb:7:in `test': wrong number of arguments (0 for 2) (ArgumentError)
        from t.rb:7:in `main'
        from t.rb:13
1
$</pre>
<p>As is expected from a dynamically typed language like Ruby, the error wasn&#8217;t detected until runtime. Not only that, but the program ran quite successfully before then, without giving any indication that a hidden problem might arise were too many command line arguments given. Even were unit tests to be used, it is quite possible that duplicating such a scenario would be missed, and a perplexed user would be faced with an error such as the one above.</p>
<p><a href="http://www.python.org/">Python</a> doesn&#8217;t fare much better. Here is the code we&#8217;ll use for it:</p>
<pre>
"""docstring"""
import sys

def test(first_arg, second_arg):
    """docstring"""
    return first_arg + second_arg

def main():
    """docstring"""
    if len(sys.argv) &gt; 3:
        return test(1, test)
    else:
        return test(1, 2)

sys.exit(main())</pre>
<p>Just to be safe, that code was run through the <a href="http://www.logilab.org/857">pylint</a> utility, which rates the above code as &#8220;10.00/10&#8243;. So an unsuspecting programmer may believe they have written high-quality Python code, when they surely have not, as we will soon see when we go to run the code:</p>
<pre>
$ python -W error t.py; echo $?
3
$ python -W error t.py 0; echo $?
3
$ python -W error t.py 0 1; echo $?
3
$ python -W error t.py 0 1 2; echo $?
Traceback (most recent call last):
  File "t.py", line 15, in ?
    sys.exit(main())
  File "t.py", line 11, in main
    return test(1, test)
  File "t.py", line 6, in test
    return first_arg + second_arg
TypeError: unsupported operand type(s) for +: 'int' and 'function'
1
$</pre>
<p>Python behaves similarly to Ruby. The error isn&#8217;t caught until runtime, and there&#8217;s a good chance that unit testing would not have caught it, as well.</p>
<p>Let us try <a href="http://www.ocaml.org/">OCaml</a>, a statically typed language. Compiling:</p>
<pre>
let test a b =
  a + b;;

let main _ =
  if (Array.length Sys.argv) &gt; 3 then
    test 1 test
  else
    test 1 2;;

exit (main ());;</pre>
<p>gives the following error:</p>
<pre>
$ ocamlopt -w A t.ml
File "t.ml", line 6, characters 11-15:
This expression has type int -&gt; int -&gt; int but is here used with type int
$</pre>
<p>The OCaml interpreter also catches the error, even without the code being executed:</p>
<pre>
$ ocaml -w A t.ml
File "t.ml", line 6, characters 11-15:
This expression has type int -&gt; int -&gt; int but is here used with type int
$</pre>
<p>Unlike when using Python or Ruby, the OCaml compiler and interpreter catch the error before the code begins to execute. And note that this is done without any source-level type annotations. This compile-time failure forces the programmer to deal with the error, rather than the user. Thus we end up with a more reliable program. Not only that, but the error was caught without the developer having to write even a single unit test. Now instead of writing unit tests to check if his or her code types correct, the developer can write unit tests to check the actual functionality of his or her software.</p>
<p>We can write a similar program using <a href="http://www.haskell.org/">Haskell</a>, another statically typed language, and it will also catch the error during compilation:</p>
<pre>
import System(getArgs)
import System.Exit

test :: Int -&gt; Int -&gt; Int
test a b = a + b

main :: IO ()
main = do
  args &lt;- getArgs
  if (length args) &gt; 3
    then exitWith (ExitFailure (test 1 test))
    else exitWith (ExitFailure (test 1 2))</pre>
<p>When we go to compile the above program using <a href="http://www.haskell.org/ghc/">GHC</a>, we get:</p>
<pre>
$ ghc -Wall t.hs

t.hs:11:39:
    Couldn't match expected type `Int'
           against inferred type `Int -&gt; Int -&gt; Int'
    In the second argument of `test', namely `test'
    In the first argument of `ExitFailure', namely `(test 1 test)'
    In the first argument of `exitWith', namely
        `(ExitFailure (test 1 test))'
$</pre>
<p>The same error is given by ghci, the interactive REPL of GHC. As with OCaml, the problem is caught at compile time, rather than runtime. Thus the developer must actively deal with it for his or her program to just compile, let alone execute. This helps increase the program&#8217;s reliability.</p>
<p>As we have clearly seen above, dynamically typed languages like Ruby and Python can allow for some flawed code to be written with ease. But more dangerously, it is possible for the code to run just fine, until a certain context arises upon which a runtime error occurs. Even when running the interpreter with warnings enabled, or after using a code-checking tool like pylint, such problems go completely undetected. This deception is dangerous. Some developers think that unit testing for such situations is appropriate, but there&#8217;s a very good chance that such typing errors won&#8217;t be detected by the unit tests, either.</p>
<p>It can be said that the code above is unrealistic. That&#8217;s true. But the scenario it simplifies is very real. Based on my own experience, I have seen far too many problems arise with dynamically typed languages, where rarely-executed code contains a type-related error, and the execution of this code causes a runtime error (usually at a most inopportune time).</p>
<p>Thankfully, statically typed languages provide a very natural way of avoiding such problems at runtime, instead having them be caught at compile-time. When using languages like Haskell and OCaml, that support type inference, it&#8217;s not even necessary for the developer to specify the types in the source code. So such developers get the convenience of languages like Python and Ruby, but without the inherent runtime danger of those languages, and without the inconvenience of having to write unit tests to handle checking that a proper compiler can do automatically, and more rigorously than a human could.</p>
<p>(UPDATE: Fixed mangled Haskell code.)</p>
]]></content:encoded>
			<wfw:commentRss>http://pinderkent.blogsavy.com/archives/144/feed</wfw:commentRss>
		</item>
		<item>
		<title>Others are leaving Ruby on Rails, as well. And it&#8217;s not going well.</title>
		<link>http://pinderkent.blogsavy.com/archives/143</link>
		<comments>http://pinderkent.blogsavy.com/archives/143#comments</comments>
		<pubDate>Sat, 16 Feb 2008 20:18:08 +0000</pubDate>
		<dc:creator>pinderkent</dc:creator>
		
		<category><![CDATA[Business]]></category>

		<category><![CDATA[Databases]]></category>

		<category><![CDATA[Development]]></category>

		<category><![CDATA[Java]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[Ruby]]></category>

		<category><![CDATA[Software]]></category>

		<category><![CDATA[Web Development]]></category>

		<category><![CDATA[Web Sites]]></category>

		<guid isPermaLink="false">http://pinderkent.blogsavy.com/archives/156</guid>
		<description><![CDATA[
Several months back, there was somewhat of an uproar in the Ruby and Ruby on Rails communities when it was revealed that after two years of effort, the CD Baby Web site was abandoning their Ruby on Rails rewrite. The CD Baby site was reimplemented in mere months after returning to the use of PHP. [...]]]></description>
			<content:encoded><![CDATA[<p>
Several months back, there was somewhat of an uproar in the <a href="http://www.ruby-lang.org/">Ruby</a> and <a href="http://www.rubyonrails.org/">Ruby on Rails</a> communities when it was <a href="http://www.oreillynet.com/ruby/blog/2007/09/7_reasons_i_switched_back_to_p_1.html">revealed that after two years of effort, the CD Baby Web site was abandoning their Ruby on Rails rewrite</a>. The CD Baby site was reimplemented in mere months after returning to the use of <a href="http://www.php.net/">PHP</a>. This past week, I have been working with another company that is in a very similar situation.
</p>
<p>
In this company&#8217;s case, they had a number of legacy, in-house systems developed in C and COBOL that were eventually moved to Web applications written in Java in the late 1990s. By early 2006, their Java-based software systems were starting to show their age, and it was decided that they would start rewriting many of them using Ruby on Rails. After an initial analysis and design period, the implementation began, with the greatest portion of the work being completed by August of 2007. The rollout was complete by the beginning of last September.
</p>
<p>
There has been an endless stream of complaints from the users of the software since that time. I&#8217;ve read through six 3&#8243; binders full of complaint reports. Now, the software itself isn&#8217;t poorly implemented. It&#8217;s actually among some of the better corporate Ruby on Rails code that I&#8217;ve seen over the past few years. Design-wise, it&#8217;s actually pretty decent, too. From the complaint reports I&#8217;ve read, most of the users are also happy with the performance of the system. It&#8217;s just that the applications themselves cannot be used well in a productive manner.
</p>
<p>
After talking to a number of the developers who were involved with that project, I heard repeatedly that Ruby on Rails was too restrictive in a variety of ways. The developers had to developer towards what Ruby on Rails would effectively let them develop, rather than developing the software to meet the needs of the users. The management had decided on a Ruby on Rails-or-nothing approach, so using alternative technologies in such situations was unfortunately not an option.
</p>
<p>
At this point, the company is trying to return to their Java-based systems, which worked better than their Ruby on Rails implementation. This will not be an easy task for us. Their data model changed in many ways, to name one major stumbling block. It&#8217;s not been decided yet whether they&#8217;ll update their Java code to handle the new model, or transition their new data back to the previous databases. Regardless, that aspect of the transition alone will be difficult. Updates to the Java code to handle the new capabilities introduced to the Ruby on Rails system since its deployment will also be required. There has been some consideration of a hybrid approach, with some of each system being used, but some of the stakeholders feel this will only cause more problems.
</p>
<p>
A lesson we can take from this, beyond the obvious ones, is that when performing a large-scale rollout of a new system, it&#8217;s important to be able to revert back to the existing system nearly immediately. Not only that, but it should be possible to do this several months after the new system is initially rolled out. Although it will incur an extra cost of doing business to maintain the old, albeit unused, software for some time, not having it available to roll back to could be tremendously more costly.</p>
]]></content:encoded>
			<wfw:commentRss>http://pinderkent.blogsavy.com/archives/143/feed</wfw:commentRss>
		</item>
		<item>
		<title>Web browser resource allocation and management improvements are sorely needed.</title>
		<link>http://pinderkent.blogsavy.com/archives/142</link>
		<comments>http://pinderkent.blogsavy.com/archives/142#comments</comments>
		<pubDate>Sat, 16 Feb 2008 19:45:11 +0000</pubDate>
		<dc:creator>pinderkent</dc:creator>
		
		<category><![CDATA[Development]]></category>

		<category><![CDATA[Firefox]]></category>

		<category><![CDATA[Internet Explorer]]></category>

		<category><![CDATA[JavaScript]]></category>

		<category><![CDATA[Konqueror]]></category>

		<category><![CDATA[Opera]]></category>

		<category><![CDATA[Software]]></category>

		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://pinderkent.blogsavy.com/archives/155</guid>
		<description><![CDATA[
If more and more software developers are going to be developing browser-based applications using technologies such as JavaScript, Flash, and AJAX, we will need to see the Web browser become a much more capable platform. In short, the browser will need to duplicate much of the work that has been done over the years in [...]]]></description>
			<content:encoded><![CDATA[<p>
If more and more software developers are going to be developing browser-based applications using technologies such as JavaScript, Flash, and AJAX, we will need to see the Web browser become a much more capable platform. In short, the browser will need to duplicate much of the work that has been done over the years in the operating systems field.
</p>
<p>
One of the main problems affecting browsers today is that of resource allocation and usage. These are the very same issues that operating system developers faced in the 1950s and 1960s, when their craft was first maturing. These days, we have the browser acting as a code execution environment, and allowing for multiple, concurrent executions (eg. in multiple browser windows or tabs).
</p>
<p>
It&#8217;s very easy for a malicious or poorly-written JavaScript to execute in such a manner that it locks up the entire Web browser. Some improvements have been made in this area, such as the use of watchdog timers that will prompt the user to kill the script if it has been running for a long time. But this is not the correct path to take. It only scratches at the symptoms, rather than curing the actual root cause.
</p>
<p>
Web browsers today need greater isolation between the different Web pages that are being displayed in multiple browser windows or in multiple tabs within a single window. <a href="http://www.konqueror.org/">Konqueror</a> does this to some extent. Unlike with browsers like <a href="http://www.mozilla.org/firefox/">Mozilla Firefox</a> or <a href="http://www.opera.com/">Opera</a>, it is by default possible to launch multiple Konqueror processes at once. That way, poor JavaScript or a browser crash will only affect one window. Unfortunately, such isolation is either not easy or not possible to do with Opera and Firefox.
</p>
<p>
Unfortunately, Konqueror doesn&#8217;t offer that degree of isolation when it comes to multiple tabs. A resource-consuming JavaScript in one tab has a lot of potential to lock up the entire browser window, rendering the other tabs inaccessible or essentially useless. Of course, the situation is far worse with Firefox and Opera, where other browser windows will be locked up, in addition to the tabs sharing the window with the problematic Web page.
</p>
<p>
A problem in one browser tab should never be responsible for a decrease in the availability or usability of another browser tab, let alone another browser window running in the same process. This is the most basic level of isolation, an it is a disappointment that after nearly two decades, even the most popular Web browsers cannot handle this task in a suitable manner.</p>
]]></content:encoded>
			<wfw:commentRss>http://pinderkent.blogsavy.com/archives/142/feed</wfw:commentRss>
		</item>
		<item>
		<title>Unit testing is not a substitute for static typing.</title>
		<link>http://pinderkent.blogsavy.com/archives/141</link>
		<comments>http://pinderkent.blogsavy.com/archives/141#comments</comments>
		<pubDate>Sat, 09 Feb 2008 23:56:24 +0000</pubDate>
		<dc:creator>pinderkent</dc:creator>
		
		<category><![CDATA[Business]]></category>

		<category><![CDATA[Development]]></category>

		<category><![CDATA[Haskell]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[Perl]]></category>

		<category><![CDATA[Python]]></category>

		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://pinderkent.blogsavy.com/archives/154</guid>
		<description><![CDATA[Users of of dynamic languages such as Python, Perl and PHP, are often faced with the additional task of ensuring that type-related errors do not occur in their programs at runtime. Some authors [1, 2] claim that this can be done effectively by the use of extensive automated unit tests. However, practice has shown this [...]]]></description>
			<content:encoded><![CDATA[<p>Users of of dynamic languages such as <a href="http://www.python.org/">Python</a>, <a href="http://www.perl.com/">Perl</a> and <a href="http://www.php.net/">PHP</a>, are often faced with the additional task of ensuring that type-related errors do not occur in their programs at runtime. Some authors [<a href="http://blog.jayfields.com/2008/02/static-typing-considered-harmful.html">1</a>, <a href="http://www.coderoshi.com/2007/09/5-reasons-static-typing-sucks.html">2</a>] claim that this can be done effectively by the use of extensive automated unit tests. However, practice has shown this to just not be the case.</p>
<p>Automated unit tests have their place. But they should not be used to check for typing errors. Software typechecking is a mechanical task, and thus is just the sort of thing that should be delegated to a computer. And this has been done for quite some time now, in the form of statically typed programming languages. Users of such languages, such as <a href="http://www.haskell.org/">Haskell</a>, <a href="http://www.ocaml.org">OCaml</a> and <a href="http://en.wikipedia.org/wiki/Standard_ML">Standard ML</a> are freed from having to worry about such menial and tedious tasks. The rigorous nature of the compilers for those languages often do a far better job at checking for type errors than a human typically could.</p>
<p>Proponents of dynamic languages often suggest that such languages bring an increase in developer productivity. But if the developer ends up spending so much time writing unit tests to perform a task that is readily done automatically, we really don&#8217;t see the supposed productivity boost. And if the developer doesn&#8217;t write such unit tests, the chances of a runtime type error crashing the application are far greater. So now the developer must choose between his or her software crashing and disrupting the users&#8217; work, or spending a lot of time to write unit tests. None of the choices are reasonable, let alone optimal.</p>
<p>Static typing is clearly the answer. Not only does the compiler take care of the tedious task of type checking, but any inconsistencies are detected at compile-time, rather than runtime. Thus it is the developer who deals with such errors, rather than the user. Furthermore, the developer is now freed up from writing automated unit tests to check for type errors, and can instead put more emphasis on unit testing the functionality and integration of his or her code. Clearly, static typing is the only sensible, and the most efficient, route to take.</p>
]]></content:encoded>
			<wfw:commentRss>http://pinderkent.blogsavy.com/archives/141/feed</wfw:commentRss>
		</item>
		<item>
		<title>Debunking some static typing myths.</title>
		<link>http://pinderkent.blogsavy.com/archives/140</link>
		<comments>http://pinderkent.blogsavy.com/archives/140#comments</comments>
		<pubDate>Sat, 09 Feb 2008 02:57:25 +0000</pubDate>
		<dc:creator>pinderkent</dc:creator>
		
		<category><![CDATA[Development]]></category>

		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://pinderkent.blogsavy.com/archives/153</guid>
		<description><![CDATA[
Today I read an article about static typing, written some months back. I believe it is a very short-sighted article, and factually incorrect in several respects. However, I do encourage you to read it, so that you&#8217;ll better understand the fallacies it portrays.


The first myth is that &#8220;static typing requires extra typing.&#8221; Anyone who has [...]]]></description>
			<content:encoded><![CDATA[<p>
Today I read <a href="http://www.coderoshi.com/2007/09/5-reasons-static-typing-sucks.html">an article about static typing</a>, written some months back. I believe it is a very short-sighted article, and factually incorrect in several respects. However, I do encourage you to read it, so that you&#8217;ll better understand the fallacies it portrays.
</p>
<p>
The first myth is that &#8220;static typing requires extra typing.&#8221; Anyone who has used a language like <a href="http://www.ocaml.org">OCaml</a> or <a href="http://en.wikipedia.org/wiki/Standard_ML">Standard ML</a> knows this to be a blatantly incorrect statement. Such languages offer static typing, yet also offer type inference. So it is very rare that one must manually specify the type of a function argument, for instance. A developer will do just as little typing as when using <a href="http://python.org">Python</a> or <a href="http://ruby-lang.org/">Ruby</a>, but will get the numerous benefits of compile-time type checking.
</p>
<p>
The second myth is that when it comes to static typing, &#8220;people will want to work around it.&#8221; Developers who strive to work around static typing clearly do not understand how to use it to their best advantage. Often, attempts to work around static typing are caused by a lack of preparation. Although one will never know everything about the problem domain in which he or she is developing a software solution for, even a small amount of research and preparation will allow one to use static typing to its full advantage.
</p>
<p>
That article discussed several other issues, but on further investigation it becomes clear that they have little to nothing to do with static typing, are convoluted micro-examples that have no real-world relevance, or actually are irrelevant when using languages like SML or Haskell.
</p>
<p>
There was one other paragraph that I wanted to discuss: <i>Have I ever written dynamically typed code that has run for two hours, only to return and find that it broke because of a typeo or a wrongly-used type? Yes. But in almost every case it could have been fixed by better unit tests. Besides, those few situations pale in comparison to the man-months saved in typing, digging through verbose code, and wrestling with the type system.</i>.
</p>
<p>
This is clearly the wrong attitude to take when developing software. There is no reason for a type-related error to ever occur at runtime, especially when such checking can be performed at compile-time (ie. static typing). Furthermore, the use of unit tests to detect typing errors is sloppy and senseless. You&#8217;re manually doing work that even a rudimentary compiler can do for you (and probably a lot better than you could, too). And it&#8217;s just laughable to think that writing verbose unit tests somehow requires less typing than using a statically-typed language that supports type inference.</p>
]]></content:encoded>
			<wfw:commentRss>http://pinderkent.blogsavy.com/archives/140/feed</wfw:commentRss>
		</item>
		<item>
		<title>PHP is a complete disgrace for serious Web application development.</title>
		<link>http://pinderkent.blogsavy.com/archives/139</link>
		<comments>http://pinderkent.blogsavy.com/archives/139#comments</comments>
		<pubDate>Fri, 08 Feb 2008 02:58:17 +0000</pubDate>
		<dc:creator>pinderkent</dc:creator>
		
		<category><![CDATA[Business]]></category>

		<category><![CDATA[Development]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[Software]]></category>

		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://pinderkent.blogsavy.com/archives/152</guid>
		<description><![CDATA[
A few days back a colleague forwarded me a link to an article entitled Attacking PHP. It goes through a list of the problems associated with PHP. And based on my past experiences dealing with PHP in corporate environments, the analysis in that article is spot on.


In short, PHP is just not a suitable language [...]]]></description>
			<content:encoded><![CDATA[<p>
A few days back a colleague forwarded me a link to an article entitled <a href="http://mindblind.net/2008/01/24/attacking-php/">Attacking PHP</a>. It goes through a list of the problems associated with <a href="http://www.php.net">PHP</a>. And based on my past experiences dealing with PHP in corporate environments, the analysis in that article is spot on.
</p>
<p>
In short, PHP is just not a suitable language for serious Web application development. I&#8217;ve seen it used for a wide variety of Web apps at numerous companies, but the results have always been negative.
</p>
<p>
As the article mentions, one of the main problems with PHP is that it&#8217;s sloppy. The standard library naming scheme is one particularly problematic area. This in turn promotes sloppinesss elsewhere, namely for those developers who use PHP to developer their own applications. Try as a developer might to keep his or her code clean, the use of standard PHP functions will begin to introduce inconsistencies.
</p>
<p>
The mixing of content and presentation is of course another very sore point when using PHP. Although it is possible to avoid this, we don&#8217;t always see this in reality. It becomes very convenient in the short term to mix those two distinct layers. But once an application starts to mature, nothing but problems arise. For instance, one team I worked with would continually break the logic of their PHP Web application when making cosmetic changes, since the business logic was so intertwined with the presentation code.
</p>
<p>
And when dealing with the Web, security is paramount. The Web is a very hostile place, and so we need to use programming languages that help enforce good software design. In this respect, PHP&#8217;s dynamic nature is unacceptable. While it allows programmers to rapidly create Web applications, these applications are often full of security glitches. Furthermore, type-related errors all too often cause problems when using a PHP application. Users are not impressed when an application crashes due to a failed type conversion because the PHP developer wrote sloppy code.
</p>
<p>
When you combine the factors above, you end up with a language that also promotes the development of near-unmaintainable code. Even if a PHP application is initially developed by somebody with patience and discipline, this level of care must be maintained throughout the entire lifetime of the PHP application. If the development standards drop for even the slightest of code, it is quite likely the PHP application will become a mess quite soon. Although languages like Java and C++ are not immune to such problems, they do tend to be far more resilient than PHP.
</p>
<p>
In short, PHP is just not a language that should be used for most large-scale applications. Although it may have its place for small Web sites, bringing it beyond that is just looking for trouble and heartache. Basically every time I have seen PHP used for real software development, the result has been spectacularly horrid.</p>
]]></content:encoded>
			<wfw:commentRss>http://pinderkent.blogsavy.com/archives/139/feed</wfw:commentRss>
		</item>
		<item>
		<title>It&#8217;s time for Haskell in the Web browser.</title>
		<link>http://pinderkent.blogsavy.com/archives/138</link>
		<comments>http://pinderkent.blogsavy.com/archives/138#comments</comments>
		<pubDate>Sun, 27 Jan 2008 00:31:13 +0000</pubDate>
		<dc:creator>pinderkent</dc:creator>
		
		<category><![CDATA[Development]]></category>

		<category><![CDATA[Haskell]]></category>

		<category><![CDATA[JavaScript]]></category>

		<category><![CDATA[Software]]></category>

		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://pinderkent.blogsavy.com/archives/151</guid>
		<description><![CDATA[JavaScript has been around for over a decade now. During that time, we&#8217;ve seen it implemented by every major browser vendor, and thus we&#8217;ve seen it become widely used by many Web sites. We&#8217;ve even seen JavaScript used in non-Web applications and uses.
But JavaScript has some pretty serious drawbacks. The performance of the various JavaScript [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://en.wikipedia.org/wiki/JavaScript">JavaScript</a> has been around for over a decade now. During that time, we&#8217;ve seen it implemented by every major browser vendor, and thus we&#8217;ve seen it become widely used by many Web sites. We&#8217;ve even seen JavaScript used in non-Web applications and uses.</p>
<p>But JavaScript has some pretty serious drawbacks. The performance of the various JavaScript interpreters embedded in the popular Web browsers has always been less than ideal. And being interpreted, it often becomes more difficult to detect syntax errors and other common mistakes. Worse yet, being weakly typed opens JavaScript scripts up to a whole host of type-related problems.</p>
<p>There are programs available to help with the development of JavaScript scripts. <a href="http://www.jslint.com">JSLint</a> analyzes JavaScript code, looking for a variety of problems. A JavaScript debugger, such as <a href="http://www.mozilla.org/projects/venkman/">Venkman</a>, is also essential. But even these tools do not catch many serious problems.</p>
<p>As more complex Web applications are developed using JavaScript, we&#8217;ve started to see certain limitations being hit. One such limitation is the maintenance of a sufficiently high level of quality. This is not only in terms of correctness, but also in performance and portability. The very nature of JavaScript makes quality control a tedious task.</p>
<p>It may be time for us to look beyond JavaScript, to technologies that offer the capabilities needed for larger-scale software development. One essential feature is strong typing. Ideally, this typechecking can be done statically (ie. before the code is executed). Type-related errors caught before an application is executed leads to the developer addressing them, rather than a bewildered user encountering a confusing error message at runtime, typically interrupting (if not losing outright) what they were working on.</p>
<p>Strong, static typing has additional benefits, especially when it comes to optimizations. The more restrictive semantics allow the optimizers within compilers and interpreters to make assumptions and decisions that could not otherwise be made. This in turn often allows for greater optimization techniques to be applied to the code, improving runtime performance and decreasing code size.</p>
<p>So instead of looking at a language like JavaScript, we should probably be looking more towards a language like Standard ML or <a href="http://www.haskell.org">Haskell</a>. I think Haskell would be an optimal choice. It offers many of the high level constructs of JavaScript, but it also addresses many of the aforementioned problems. What we lose relative to JavaScript is the ability to use techniques that lead to poor-quality, buggy code. But furthermore, we gain a language that promotes quality software through strong, static typing. Beyond that, Haskell has many advanced features, including pattern matching and lazy evaluation, that we really don&#8217;t find offered by JavaScript.</p>
<p>Haskell has even more going for it. Another major benefit is the availability of several interactive environments and interpreters. <a href="http://www.haskell.org/ghc/docs/latest/html/users_guide/ghci.html">GHCi</a>, for instance, is actively maintained, and is of a very high quality. There is also <a href="http://www.haskell.org/hugs/">Hugs 98</a>, which is a rather complete implementation of Haskell 98.</p>
<p>The purely functional nature of Haskell will become more and more important as consumer PCs begin to offer four to eight (or more) cores per CPU. Haskell can allow for the safe, automatic parallelization of code to a far greater extent than JavaScript ever could. We will need to take advantage of such features if we will want our Web applications, or even our applications in general, to effectively use the PCs of the near future.</p>
<p>So what we need to see is a Haskell implementation embedded within a major browser, and extended to offer DOM integration. This would allow for developers to use it instead of using JavaScript. The very nature of Haskell would allow for the development of complex, high-quality Web applications. With such Web applications becoming larger and more essential each day, we need a much more significant focus on quality and performance. Haskell will allow us to achieve this, while JavaScript will not.</p>
]]></content:encoded>
			<wfw:commentRss>http://pinderkent.blogsavy.com/archives/138/feed</wfw:commentRss>
		</item>
		<item>
		<title>Ada: it&#8217;s useful outside of the embedded software development world, too.</title>
		<link>http://pinderkent.blogsavy.com/archives/137</link>
		<comments>http://pinderkent.blogsavy.com/archives/137#comments</comments>
		<pubDate>Tue, 22 Jan 2008 02:13:11 +0000</pubDate>
		<dc:creator>pinderkent</dc:creator>
		
		<category><![CDATA[Business]]></category>

		<category><![CDATA[Development]]></category>

		<category><![CDATA[Haskell]]></category>

		<category><![CDATA[Software]]></category>

		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://pinderkent.blogsavy.com/archives/150</guid>
		<description><![CDATA[When you mention the Ada programming language to most developers, they tend to think of embedded software development, typically in mission-critical environments such as aircraft and electric power plant control systems. But we shouldn&#8217;t think that such environments are the only place where Ada can be of use. For the past several weeks, I have [...]]]></description>
			<content:encoded><![CDATA[<p>When you mention the <a href="http://en.wikipedia.org/wiki/Ada_%28programming_language%29">Ada programming language</a> to most developers, they tend to think of embedded software development, typically in mission-critical environments such as aircraft and electric power plant control systems. But we shouldn&#8217;t think that such environments are the only place where Ada can be of use. For the past several weeks, I have been working with a shipping company that makes extensive use of Ada for their in-house software.</p>
<p>I haven&#8217;t seen a company use Ada this extensively for such a wide range of software development tasks. They have back-end database applications written in Ada. They have client-side applications written in Ada. They&#8217;ve developed an in-house framework for developing Web applications using Ada. Even their custom build system is itself implemented in Ada.</p>
<p>So today I had an opportunity to talk with one of the managers there about why they use Ada so much. His responses were very interesting, I think. He said that Ada was introduced to their company by one of their developers in the early 1990s. Although they&#8217;ve had some difficulty finding developers who are proficient with the language, this manager reported enormous productivity gains for those developers they do employ.</p>
<p>I asked him to elaborate on the productivity benefits of Ada. The first benefit he mentioned was that it&#8217;s a language that inherently leads one to develop high quality software. This is no accident, of course. The language was designed for this very purpose, and thus explains why it has been successfully used for a vast amount of mission-critical software. The manager said that some developers initially found it too restrictive, but soon enough discovered that by following its best practices, they&#8217;d produce software with fewer bugs.</p>
<p>The manager went on to discuss how by using Ada and peer-review, they were able to eliminate a great many bugs before their software was deployed. As anyone who has deployed large-scale applications knows, the earlier a bug is found, the better. But the manager also pointed out that by writing less-buggy software in the first place, his developers ended up spending less time investigating and fixing their mistakes, and instead were able to produce more software to help meet the company&#8217;s business needs.</p>
<p>Many developers have reported similar benefits from programming languages like Eiffel, Haskell and Standard ML. Strong, static typing and other features like design by contract are known to help lead to reliable software. And so I asked the manager if they were considering using such languages. He replied that they had actually considered using Haskell for some smaller projects, and one of their developers was in the process of familiarizing herself with the language. He promised to keep me up to date with their developments, of which I am eager to hear about.</p>
<p>So far, this has been one of the most interesting clients I have worked with in the past while. After working with numerous Java, C#, VB.NET and Perl development teams over the last few years, it&#8217;s refreshing to see a team that adopts an alternative technology like Ada, and manages to boost their productivity to a level that is rarely achieved. Maybe it&#8217;s time for more developers to consider the use of Ada, even those who are working on fairly typical business applications.</p>
]]></content:encoded>
			<wfw:commentRss>http://pinderkent.blogsavy.com/archives/137/feed</wfw:commentRss>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.427 seconds -->
<!-- Cached page served by WP-Cache -->
