I think we should write code for the reader. That is, the poor colleague who must understand our intent.
I have never read one single class where the private fields or properties plays a crucial role in my understanding of said class.
Usually I visit a class for the following reasons:
- Knowing the value of a static constant, and get an overview of them
- Reading the constructor (or the setup/initialize steps) to identify preconditions the class may enforce on me (shame on you!)
- Further my understanding of how the public API works, particularly for slightly obscurely named methods and to identify side-effects
- Get an idea of the public properties/fields/getters/setters
I do not however care to read the details of private helper methods, or private constants, or fields. That's why I think you should declare your classes like this:
- Public data types, enumerations and constants
- Static methods
- Constructors & initializers
- Public methods
- All your private stuff, preferably in the order most likely to be of interest to me as a reader