At 4/17/13 10:58 AM, egg82 wrote: There's got to be a reason for it, so why in the world should you limit yourself to five class members at once?
Beside that a 5 members maximum seems like a arbitrary number, having small classes is viewed as a good thing. To quote the book Clean Code (which is by the way a interesting read for anyone who wants to write better code) : "The fewer methods a class has, the better. The fewer variables a function knows about, the better. The fewer instance variables a class has, the better.".
It describes what ideal code should look like. To name a few guidelines:
Maximum 400 lines per class (200 lines is ideal)
No more than 3 arguments on a method (the fewer the better)
"The first rule of functions is that they should be small. The second rule of functions is that
they should be smaller than that." (I think it comes down to about 5 lines)
The book covers on almost everything related to writing code, from variable names to class organization.
At first I thought these strict constraints would bog everything down, but I'm starting to see why they came up with these rules.