Re: How to split large class files?
Re: How to split large class files?
- Subject: Re: How to split large class files?
- From: Andy Lee <email@hidden>
- Date: Mon, 5 Nov 2007 22:36:20 -0500
On Nov 5, 2007, at 8:37 PM, Seth Willits wrote:
The largest controller I have in any project is about 5,000 lines
including comments and empty lines etc. Feels too big to me, but
breaking it up into multiple classes just lead to having too many
interdependent classes, so I just busted it up into separate files
and categories to group things logically for my own benefit. Doesn't
change the code usage at all. It's a happy medium for now.
Another way to refactor, besides "horizontally" into categories and
cooperating classes, is "vertically" into subclasses. Maybe some of
your ivars and methods can be grouped into a top-level class, others
into a subclass, others into a subclass of *that*, etc. Even if
you'll never create other subclasses of the intermediate classes, it
might help with clarity and debugging just to break up the class's
logic this way. For example, you can write unit tests specific to an
intermediate class that don't have to worry about possible
complications added by the code in subclasses.
--Andy
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden