• 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: Breaking source file into multiple files?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Breaking source file into multiple files?


  • Subject: Re: Breaking source file into multiple files?
  • From: Matt Neuburg <email@hidden>
  • Date: Tue, 14 Sep 2004 19:52:56 -0700

On Tue, 14 Sep 2004 21:04:48 -0500, Todd Freese
<email@hidden> said:
>I have a source file that is getting really long and would like to break it
>up into several files for cleanliness. What is the „best approach¾ for doing
>this? Two approaches come to mind:
>
>1. Break file up and use an include call.
>2. Use Categories. (since I¼ve never use categories, this is a guess!)

(2) is fine, especially if you can break off a some compartmentalized
functionality; you can see an example of this the TextEdit source which is
on your hard drive (DocumentReadWrite.m is simply a category on Document).
You might even want to consider:

3. Break the functionality into multiple classes. A long source file is a
"bad smell"; consider refactoring. This makes sense especially if you can
extract some code that is potentially resusable separately. Again, look at
how in TextEdit the EncodingManager is a separate (singleton) object. It is
not quite true that only Document uses it, but it is nearly true. Anyhow my
point is that a helper object that acts as the helper of only one object is
nothing to be ashamed of.

m.

--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide
<http://www.amazon.com/exec/obidos/ASIN/0596005571/somethingsbymatt>



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Re: New ML List Software
  • Next by Date: Re: Distributing vs. re-using source code?
  • Previous by thread: Re: Breaking source file into multiple files?
  • Next by thread: [ANN] Shovel 0.2
  • Index(es):
    • Date
    • Thread