On Jun 21, 2009, at 1:36 AM, syntonica wrote:

Hello All--

Hi Kevin,

I don't have much to add to the responses that others have already given you for your other questions, but I'll address the question below because I haven't seen anyone yet say what I'm about to say.

Finally, on a side note and because this is my first OOP, just how big should a class get? Just as a rule of thumb. I have 700 lines and 50 methods in my MyDocument class and it seems positively bloated to me. Is this normal? Or might I possibly have a bad design? I only see a couple of lines that could be factored into their own method and nothing that could really me moved into its own class.

My golden rule is very simple, though it doesn't mean that it's easy to apply it: each class should have a small (as small as it is meaningful for the project at hand) set of very well defined responsibilities. If a class has too many responsibilities, or if its responsibilities are too broad or unfocused, that's typically a sign that you should break it down. There are exceptions, but they're rare and whenever I think I've run into one of them, I don't touch the keyboard for a day or two until I am convinced that the exception is valid.

Wagner
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to