3 ms·
The 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 id
by arvinsim 9y ago
The 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.