3 ms·
You're not getting the point. In a large codebase, I want to be able to skim code. I don't want to parse idiomatic code. I literally want to be able to read it
by NTDF9 9y ago
You're not getting the point.
In a large codebase, I want to be able to skim code. I don't want to parse idiomatic code. I literally want to be able to read it like a novel and get down to the lines that I'm interested in.
Granted Java is not the best. But Python-like languages (with no static typing and "tricky idiomatisms") make it so hard to parse a 10,000 lines100,000files.
- arvinsim 9y agoThe purpose of idioms is to have common vocabulary that everyone can understand easily when you read it. The downside is that you do have to recognize those idioms in the first place.
- stouset 9y agoThis, so so so so so much. Idioms and good abstractions are precisely how one mentally elides large volumes of code. When reading the following snippets: int doubles[10]; for(int i = 0; i < sizeof(doubles) / sizeof(int); I++) { doubles[i] = i * 2; } (0..9).map { |i| i * 2 } the latter is the one that I can understand the purpose of at a single glance. The details of iteration, properly counting the number of iterations, etc. are incidental to the thing I'm actually trying to accomplish. Worse, if you do start to filter out those things it's maddeningly easy to overlook obvious bugs because of a typo in the boilerplate. One of these requires me to think like a computer, and one of these hides the irrelevant details and lets me focus on the actual problem being solved. Multiply this one example by dozens of times per source file, and the incidental complexity becomes absolutely massive.
- dragonwriter 9y agoNo, I'm getting the point (I think: you do directly contradict yourself when you say you want to skim code and to read it like a novel, since skimming and reading word-for-word are very different, nearly polar opposite, approaches.) I'm saying that, but for the issues I noted, I find the code you gave easy both for skimming and direct reading, it's clear, concise, direct, and well-formatted with a familiar shape for the basic outline of what it does (again, but for the points raised in my earlier post), the first two points making it easy to read, the last two making it easy to skim.