• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to split large class files?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >How to split large class files? (From: Arthur C. <email@hidden>)
 >Re: How to split large class files? (From: Bill Bumgarner <email@hidden>)
 >Re: How to split large class files? (From: Seth Willits <email@hidden>)

  • Prev by Date: No Cocoaheads Lake Forest meetings tomorrow or in December
  • Next by Date: IKSlideShow problem with NSImage
  • Previous by thread: Re: How to split large class files?
  • Next by thread: FYI - installer packages are the preferred deployment method now
  • Index(es):
    • Date
    • Thread