MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/programming/comments/bsuurg/making_the_obvious_code_fast/eos0tx6/?context=3
r/programming • u/[deleted] • May 25 '19
263 comments sorted by
View all comments
-8
I don't understand linq and streams. What's wrong with the imperative for loop? How is it any easier to read than a for loop and a variable?
Linq and streams are not how the computer executes your code, it's not how you'd write the math. What's the point?
0 u/[deleted] May 25 '19 [deleted] 1 u/Beaverman May 25 '19 How is it more explicit? It's way more explicit to just do the thing you want to do.Yes, they are higher level. That doesn't make them good.In each case, the benefits for the writer of the code include reliability (no off-by-one errors with indices and such)That's solved by for-each loops. They are pretty simple in their function, and easily understandable.brevity (lack of boilerplate).How is doing what you actually want to do boilerplate? If what you want to do is sum a set of numbers, then why not just sum those numbers? → More replies (2)
0
[deleted]
1 u/Beaverman May 25 '19 How is it more explicit? It's way more explicit to just do the thing you want to do.Yes, they are higher level. That doesn't make them good.In each case, the benefits for the writer of the code include reliability (no off-by-one errors with indices and such)That's solved by for-each loops. They are pretty simple in their function, and easily understandable.brevity (lack of boilerplate).How is doing what you actually want to do boilerplate? If what you want to do is sum a set of numbers, then why not just sum those numbers? → More replies (2)
1
How is it more explicit? It's way more explicit to just do the thing you want to do.
Yes, they are higher level. That doesn't make them good.
In each case, the benefits for the writer of the code include reliability (no off-by-one errors with indices and such)
That's solved by for-each loops. They are pretty simple in their function, and easily understandable.
brevity (lack of boilerplate).
How is doing what you actually want to do boilerplate? If what you want to do is sum a set of numbers, then why not just sum those numbers?
→ More replies (2)
-8
u/Beaverman May 25 '19
I don't understand linq and streams. What's wrong with the imperative for loop? How is it any easier to read than a for loop and a variable?
Linq and streams are not how the computer executes your code, it's not how you'd write the math. What's the point?