Posted on 2003-12-03
I'm designing a class, and once again I'm faced with the old problem: When fully implemented, the length of the class (lines of code) will be very large. Perhaps 1500 lines of code.
So the question becomes: How can I somehow divide/partition/organize the code so that it is partitioned into smaller chunks?
I've had this picture in my mind that if you can organize information into a tree/hierarchy, with each level of the three having hopefully <= 10 nodes, that information seems readable. It's when you nodes of the tree with, perhaps 40 children, that things are very hairy.
Where this comes into code is that I wish you could design code into hierarchies. What is the appropriate way to do this? What do you do when you have a class that has, say 10 data members, but has a function within it that is 1000 lines long and a few other functions totalling 500 lines? You can break the 1000 line long function into parts so that each part is on average say 75 lines long, but then you have this long list of component functions which are unorganized. And your .CS file is still huge.
I guess I'm just a bit frustrated with organizing my code, and I wish I could:
- Not have any .CS files that are big (>500 lines)
- Organize code into hierarchies