DEV Community

Discussion on: Hard to Read Code is Not Empathetic

Collapse
 
bradtaniguchi profile image
Brad • Edited

I'm not sure it's all that easy to turn into a foot gun if you understand how for loops work

If you know its a foot gun it usually stops being a foot gun.

I think we are assuming something we shouldn't.
If we are being totally truthful, its not a given the developer knows how the classic for loop works. In the same fashion its not a given the developer knows how reduce works. You could argue all JS developers know about all types of loops, but then we all know that's false at some level.

Its not about one loop being better than the other in terms of being understood. Its the idea one loop is better than the other for everyone and anyone. It really depends on who the audience is.

I don't like being this nitpicky, but I wanted to bring it up because I feel like that's the goal of the post right? Yes I know how the classic for loop works. No I don't use it and no I don't think its easier to read.

Is there a right answer? NO, but I think there is a wrong way to go about thinking about it. Where we assume what we feel is "right" is right for everyone.

Its not about the code per say, its about the people reading the code.