This seems like two questions, so let me take a stab at each. As far as how detailed documentation should be, I'd say the more the merrier. Obviously, at some point you can get too verbose, but the opposite problem (lack of documentation) is much much more common and much harder to rectify. So: very detailed. As far as functions with "40 or 50 steps" you probably have to be more specific about the context. For maintenance, smaller, more encapsulated functions are generally better, but there are no hard and fast rules. In the right place, a 40-step function could be fine.... but it should still have proper documentation and comments. Does this answer your question?