I couldn’t find a lot of good sources and I haven’t searched for projects
I came accross it when I was watching Uncle Bobs videos, but as there isn’t real support in Java he recommends to indent the less important code, which looks very odd…
The first search result only tells how to do it…
There are 2 problems it tries to solve:
- There is one kind of private: classes probably have multiple private functions.
Those private functions could belong to the entire class or just to one or a couple of functions.
The private functions for the entire class is supported, while the private functions for a part of the class or just one method is not. - A class can contain multiple abstractions. When you look into the code, you see all of these
abstractions at the same level. The step-down rule provides a way to hide the less important functions, untill you drill into those functions. Hereby it gives a structured way of maintaining the code. in other words, it basically gives you
this
inside the code.
The second example would indeed imply the order in which the code would be defined.
This is according to the step-down rule itself, but I could understand if this isn’t the best solution.
The functions are basically more private than private. This means they aren’t seen outside the class. In other words, they are just private.