Tilo Sloboda
1 min readAug 20, 2023

--

I acknowledge that we have a difference of opinion.

When we use programmer-friendly language like Ruby, clearly there is no "one right way".

Based on my experience in our production code, I see large service classes with many private methods that are used only once - several hundred of lines of code in one service class. A lot of code that is added by refactoring along the lines you describe, and instance variables being overused, and hidden behind attribute accessors..

When reading this code, I find myself always jumping up/down to the definition of the class variables, and other helper methods, to try to understand how particular parts of the code work.

I find it much easier to reason about and to test methods that are passing all parameters in, rather than relying on shared/pre-set state where it is not really needed.

I challenge the reader to keep an open mind and explore both ways to define services, incl. tests - re-write some code, and compare the resulting code and tests..

Different people may feel differently , and that is OK.

--

--

No responses yet