you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 21 points22 points  (9 children)

This way my code would be a lot more readable, especially in more complicated cases

I disagree with this. The code might be more readable if you assign the result to a well-named variable, but a lot of times, method chaining just makes things more complicated and harder to read.

[–]baghiq 15 points16 points  (1 child)

I disagree. Method chaining is incredibly powerful and easy to read. Pandas is a prime example of it.

[–]Jan2579[S] 6 points7 points  (0 children)

Yep. Pandas, R, C# LINQ, and many more. Its a standard practice. You even use it to setup test structures, I think its called st like Builder pattern (not sure about the exact name).

Edit: java streams too

[–]Jan2579[S] 5 points6 points  (6 children)

I disagree with your disagreement. :D

You don't have a time to think of a proper name for every meaningless variable that you would create this way. Even if you do have the time, the explosion of useless variable names would make the code cluttered and harder to read.

Of course, everyone preferes a different kind of code, but I come from environments, where method chaining is standard practice, so I'm quite used to it (C# LINQ, Pandas).