development

Coding Without Taxation

October 18, 2007 20:00:34.428

Russ Olsen takes the absurd "continuous tax of dynamic languages" argument and throws it back at static typing fans. I think Russ' points are pretty good.

Technorati Tags: , ,

Comments

absurd

[Isaac Gouy] October 19, 2007 0:49:24.524

Russ Olsen's example Java code is written in such an absurd way that it will be seen as a deliberate attempt to write bad code, let's see if I can do something as ridiculous with Smalltalk:

array_sort: anArray
   ^anArray sort: [:arg0 :arg1 |
      | length0 length1 |
      length0 := arg0 length.
      length1 := arg1 length.

      (length0 < length1) 
         ifTrue: [ ^true ]
         ifFalse: [
            (length0 = length1)
                ifTrue: [ ^true ]
                ifFalse [ ^false ]
         ]
   ]

absurd?

[iceken] October 19, 2007 8:35:43.761

This might be because it's Friday afternoon but when looking at compare api for Java, I don't think his code is that absurd.  If you skip some formatting it bascially comes down to 3 lines of code.

Needless to say I prefere sort: [:a :b | a length < b length]  anytime over those pesky java compare functions ;)

absurd

[Isaac Gouy] October 19, 2007 11:37:54.857

iceken wrote when looking at compare api for Java
Why are you looking at ye olde Java 1.4.2 api?

The first comment on Russ Olsen's blog corrects his comical 17 lines to

public void array_sort(String[] strings){
Arrays.sort(strings, new Comparator() {
public int compare(String arg0, String arg1) {
return arg0.length() - arg1.length();
}
});
}

 Share Tweet This
-->