|
|
|
|
|
by megawatthours
3216 days ago
|
|
Something I see often and is a huge code smell to me is not using the most restrictive form of iteration. If you see collection.map(...) you know that each iteration is simply a pure function from original element to transformed element, which is an immense help when reading the code. If you can use only map / filter / takeWhile / join etc to express what you are doing, use those! If not, try and just use reduce / foreach. If not, try and just use for. Only use while if nothing else works! |
|
You'd think so, but I've had colleagues who managed to fuck that up and use map or list comprehension solely for side-effects.