Tag Info

New answers tagged

2

EDIT: I realize my answer didn't exactly answer the question, while there is no real downside, from my timing results there is no real upside either. The difference between a inline property getter is 0.002 seconds over 500 million iterations. My test case may also not be 100% accurate since its using a struct because there are some caveats to the jitter and ...


3

I'm on the fence whether your code should be called a fluent interface or a train wreck. Either way, method chaining should not be overused because it decreases readability. I have first hand experience from a project where I found myself writing wrapper functions to shorter some chains. Furthermore, some folks such as Robert C. Martin in "Clean Code" ...


1

First, I think it is a good idea to refactor the with part into its own function. It makes IMHO the code easier to read, and it corresponds to the "Single Level of Abstraction" principle, which is one characteristic of clean code. Second, if it is a good idea to decorate every class of your program with this additional method, depends. I would do this only ...



Top 50 recent answers are included