Ian Bicking: the old part of his blog

Able to make a mess with anything

Since when can a programming language be sexy?

The readability of code has a lot to do with the author's grasp of the language as well. You can write nasty code with any language, but Java is one of the few system that enforces nasty structure:

Python:

for i in range(6000):
    x={}
    for j in range(1000):
        x[j]=i
        x[j]

Java:

import java.util.*;

public class test {
    public static void main(String[] args) {
        for (int i = 0; i < 6000; i++) {
            Map x = new HashMap();
            for (int j = 0; j < 1000; j++) {
                Integer I=new Integer(i);
                Integer J=new Integer(j);
                x.put(I,J);
                x.get(I);
            }
        }
    }
}
Comment on Re: Ruby, Python, "Power"
by Eric Radman

Comments:

Java 5.0:

import java.util.*;

public class Test {
    public static void main(String... args) {
        for (int i = 0; i < 6000; i++) {
            Map<Integer,Integer> map = new HashMap<Integer,Integer>();
            for (int j = 0; j < 1000; j++) {
                map.put(i,j);
                map.get(i);
            }
        }
    }
}

But I'm not sure what you're getting at since this code doesn't actually do anything.

# Brian Slesinsky

Perhaps my post disproves my own point to some. I think the only thing I demonstrated was that it requires a lot more characters to write a program in Java that does nothing vs. a script in Python that does nothing. My problem is that I assume the virtue of Python code is self-evident, and it's not, because it's a matter of perspective. I suspect that Perl appears to be insane to most Java programmers, but it doesn't seem all that strange after writing a few things in Ruby.

# Eric Radman

source
Here's the ruby version, for completeness

6000.times do |i|
   x = Hash.new
   1000.times do |j|
      x[i]=j
      puts x[i] # Just to actually do something.
   end
end
# Joel Redman

> 6000.times do |i| > x = Hash.new > 1000.times do |j| > x[i]=j > puts x[i] # Just to actually do something. > end > end

But you would use this, of course:

puts (0..6000).map{(0..1000).to_a}

Docutils System Messages

System Message: ERROR/3 (<string>, line 1); backlink

Undefined substitution referenced: "i".

System Message: ERROR/3 (<string>, line 1); backlink

Undefined substitution referenced: "j".
# Jules