FROM : Andy Lee
DATE : Tue Nov 06 04:36:20 2007
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
DATE : Tue Nov 06 04:36:20 2007
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
| Related mails | Author | Date |
|---|---|---|
| Arthur C. | Nov 4, 20:37 | |
| Bill Bumgarner | Nov 4, 21:04 | |
| Seth Willits | Nov 6, 02:37 | |
| Andy Lee | Nov 6, 04:36 |






Cocoa mail archive

