Hacker News new | past | comments | ask | show | jobs | submit | cgmorton's comments login

Eh. Your construction is perhaps easier to understand if you've never used the language, and are trying to learn it just by reading arbitrary source code. But who writes code for such a person?

You might as well spell out:

int iterator; for (iterator = ...

But everybody uses 'i', because it's faster and simpler, takes less time to read, and doesn't fill up your screen so that surrounding elements can be easily associated (e.g. a[i].do(x) vs myArray[iterator].doCoreFunction(element_x) <- yuck)


I write all the time:

    for(int index = 0; index < collection.size(); ++index)
I don't believe in the philosophy of saving seconds of programmer time at the cost of understandability, especially when the latter is increasingly more important. Also, calling it "index" makes it really obvious when you're possibly using it wrong (ie, as anything other than an index). My version of your latter example would never look so ugly, because I would never ended up with such badly worded things in the first place. (Who puts domain functions on their model objects?)

    for(int index = 0; index < things.size(); ++index) {
        final Thing thing = things.get(index);
        businessUnit.doSomething(thing);
    }


At some point this construction has the opposite effect of your stated goal. Programming languages have their own syntax, grammer, and idioms. Working with those isn't so much about saving time, but about making clear statements. I'm not certain how calling your variable index is better than calling it i - the entire fact that it implied in the construct.

I'm not disagreeing that having decent names is a good idea, just that idioms and convention convey a ton of meaning. For instance if any of my team ever did:

   def func(self, a, b, c): ...
There would be a problem. (most of the time anyway...)

By analogy: do you always refer to people strictly by full name (that is never calling Robert Smith by Bob, rob, Robert, etc)? Do you always refer to your vehicle as "my $Year $Make $Model" rather than "my car"? Why not? Because it is strictly clearer and easier to do so, with less ambiguity and chance for confusion. I'm guessing not, because the language you speak in has idioms and constructs that allow shortening this, and understanding is not lost.

Basically my point is that assuming the reader of your code is a complete neophyte, with no understanding of common idioms is largely ridiculous, and potentially harmful to the actual neophyte+(small amount of experince) folks because they wonder why the common pattern is not being followed... asking "why is this different? it must be special, not just a for loop..."


But people also write:

    for(int i = 1; i <= n; ++i)
        sum += i;
This would look immediately wrong if i was actually index.

Also, your analogy to linguistic concepts is bad. Sure I call people Bob, but I'm also not expecting to have to reread my conversation with them half a year later and modify it to say something else instead. Also, those linguistic concepts are not idioms. They are just alternate names and indexical constructions, respectively. An idiom is something like "What's up?", where the literal meaning of "what is up" is not intended, but rather another meaning that is completely lost unless you are in the know.


Using the variable names i/j/k for loops is such a widely used convention that IMHO it doesn't really mater for a lot of people. Virtually everyone I know will read "array[i]" and know exactly what's going on.

And believe it or not, those variable names aren't arbitrary. They hearken from the ancient times: http://programmers.stackexchange.com/a/86911


I tend to use

  for (auto iter = something.begin(); iter != something.end(); ++iter)
in C++. It's an abbreviation, but a clearer one (both to me and to the reader of my code). An integer is (to me) an index, not an iterator, so I'd kind of call that misleading anyway.


The correct solution would be to tell you what's happening.

"Your data will be deleted in 24 hours. You can undo this deletion at any time before then."


There's a reason 'Phobia' is a clinical diagnosis, not a policy justification.


> Second: Six months, you say? Can any of us think of a cohort of job seekers that routinely needs to contend with 6+ month employment gaps? I wonder, maybe, just maybe, do you think that has a powerful "objective" stigma attached to it disproportionately often might find it difficult to compete equitably in the job market? I wonder which 50% of the population I might ask to find out more about this.

Oh, wait, you mean women? For a most of that rant I thought you meant ex-convicts, because there is definitely an objective stigma against them (and they're certainly out of the job market). Now that I think about it, it's possible that the amount of ex-cons in the 6-month+ unemployment bracket, plus maybe ex-mental-institution or ex-rehab individuals, is significant enough to skew the results. The original paper doesn't address this, at least not that I can see.


Man, $1 million is more money than I will ever need.

So I'll do it for $3 million. Your move.


See, that's why this 17 year old kid is much smarter than you. He got in before the race to the bottom started!


They wouldn't even need to trade securities. Just search the future data for some successful tech IPOs and then invest in those companies early and heavily. Returns would be fantastic, and the risk of feedback from your future-influenced actions would be much lower.


Or, one was a good salesman and the other was not. Or maybe the second one was strapped for cash and really needed the sale.

I'd rather not theorize until we get some more data points.


I played a different game called 'which one appeals to me more on first glance'. I ended up with a perfect 10/10 split.

Could it be that different fonts will be more aesthetically pleasing for different uses? Even if they're typographically similar??


My question is, what are you doing 'enjoy[ing] things that you can buy with money'? Hasn't it been well enough established that things don't make you happy? The Greeks figured that out two thousand years ago, guy!

Let me tell you, I bought a used car just this year and I appreciate it way more because I didn't bankrupt myself to do so.


"Have you seen anyone sad on a jet ski?"


This sheds some light on this comment about the pawns: '(Move "forward" indicated in white.)' The 2006 picture has white lines and this new one doesn't.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: