Old title: How many classes per unit are advisable to have?
My question is specific to Delphi. I think that in Java and C# world it is a rather accepted practice to generally have one file per class. I think this is a good rule to follow in Delphi too, because in Delphi private members aren't really private if you have more than one class in a unit.
So I was surprised to hear from two different senior (and probably more experienced than I am) programmers tell me I divide my code too much. One of them told me to not be shy about placing 5-6 classes in a unit.
Is there some issue with "one class per module" rule that I am not aware of, that could warrant and explain the reactions of these programmers?
Vcl.Controls
. Tons of classes. But then look at theIndy
system - they do seem to follow the one class per unit concept. That being said, it's really a matter of opinion, and how you're most comfortable. – Homeroom