ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button
Article:
  An Introduction to RubyCocoa, Part 2
Subject:   Code is hard to read
Date:   2005-03-05 06:06:11
From:   MrN
First of all: Pretty cool article. I like to know of the fact that you can do fancy OSX GUI programming with Ruby and how. But there is a little problem that makes it difficult for me to benefit from this article.
The code is a bit hard to read because of e.g. those large comments even around suboptimal code. A suggestion. Instead of (I stripped the comments):

count = indices.length - 1
indices = indices.reverse
for i in 0..count
@files.delete_at(Integer(indices[i]))
end

where count has a misleading name, you could just do:

indices.reverse_each do |f|
@files.delete_at(Integer(f))
end

or something like that.
Now I feel better *g*.