Tag Info

Hot answers tagged

4

Yes, there is another way of limiting recursion depth, but I would not encourage it. In general, we can say that you are currently using a data-driven approach. public void myMethod(File arg, int accumulator) { where the accumulator counts the recursion call depth. The other way is to enumerate the calls. Said another way, hard-code the calls: private ...


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 ...



Only top voted, non community-wiki answers of a minimum length are eligible