2500 words on the subject of brevity in programming
reprog.wordpress.com
reprog.wordpress.com
The author's example of "overly verbose" Java is rather unfair. Compare the 11-line example with loads of temporary variables to something like this:
Set results = new SortedSet();
for (Method m : String.Class.getMethods()) {
if (m.getName().toLowerCase().contains("index")) {
results.add(m.getName());
}
}
return results.toArray();After adding a couple of extension methods (to make the syntax more similar) I can write:
from methodName in "".MethodNames()
where methodName.Grep("index",RegexOptions.IgnoreCase)
orderby methodName select methodName;
in C# "".MethodNames().Where(m => m.Grep("index",RegexOptions.IgnoreCase)).OrderBy(m => m)It's irrelevant how complex doing hello world in Java is since no user actually cares about stuff visible in text mode starting a decade or more back.
Of course, Java won't win a brevity contest, but System.out.println isn't the best pick to demonstrate this.
But anyway I can't agree that "no user actually cares about stuff visible in text mode". There is a very substantial community of programmers that don't like to use IDEs.
Actually, there IS a plan, sort of. At first I just threw in the odd random picture so that the blog would look a bit more interesting than long blocks of text (one of the early posts has the Buffy cast in it); but I quickly found myself falling into the habit of using only sushi, because I liked the visual thematic unity that those pictures give me.
(The last photo in that particular article fills me with so much sushi-lust that I could hardly concentrate on the argument I was trying to make.)