First Generic Class
View Single Post
11-29-2007, 02:17 PM
Join Date: Sep 2007
Nice start TlcAndres, you seem to have grasped the basic concepts of classes just fine. Now for the problems - I'm analyising the design and structure of your classes here, not the code it contains (I'll let someone else comment on that)
The first problem would be the cohesiveness of the "core" class - that class has so many different tasks it's near impossible to see what the object is responsible for. Good object orientated design suggests that your classes should be loosely coupled and cohesive. A good rule of thumb is "one class, one task". I'm not saying you should stick to these strictly, just being aware of them will improve your code which will in turn make the code easier for other people to understand.
I only flicked through, but I noticed you have separated different parts of the core class into "groups" - indicated by the comments. I would suggest splitting these groups into separate classes, for example, you have some methods specific to members, I would refactor the code and take these methods out of the core class, placing them into their own class.
It just makes things easier and more logical. I also find it helps to think of things in terms of responsibilities, for example, what is the core class responsible for? Each class should have a clear cut responsibility, if you can't figure out what that is (or if the class has many responsibilities) then you should reconsider your object design.
So, my first suggestion for improvement would be to refactor the class, that is, pull out all the "method groups" and place them in their own class.
Any fool can write code that a computer can understand. Good programmers write code that humans can understand.
View Public Profile
Send a private message to Karl
Find More Posts by Karl