Jon Aquino's Mental Garden

Engineering beautiful software jon aquino labs | personal blog

Saturday, February 19, 2005

Those up and coming little scripting languages

There are some recent programming languages that have all sorts of syntax features to make a programmer's job easier: Ruby, Python, and Groovy are very cool. For instance, instead of having to type ...

Map personToTypeMap = new HashSet();
personToTypeMap.put("Fred", "ISTJ");
personToTypeMap.put("Mary", "ENFP");
personToTypeMap.put("Bob", "INTJ");
for (Iterator i = personToTypeMap.keySet(); i.hasNext(); ) {
String person = (String) i.next();
System.out.println(person + " is type " + personToTypeMap.get(person);
}

... you can do the following in Groovy ...

["Fred":"ISTJ", "Mary":"ENFP", "Bob":"INTJ"].each { person, type |
print(person + " is type " + type)
}

I think this conciseness is amazingly cool.

Java is OK -- a bit verbose (see above), but I'd take it over C++ any day since it takes care of memory management, and is just simpler overall.

0 Comments:

Post a Comment

<< Home