Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 6: Source File Organization

Chapter 6

Source File
Organization

so far, every project we've talked about has had all its source code crammed into its main.m file. The main() function and all the @interface and @implementation sections for our classes are piled into the same file. That structure's fine for small programs and quick hacks, but it doesn't scale to larger projects. As your program gets bigger, you'll have a ponderous file to scroll through, making it harder to find stuff. Back in your school days (assuming you're finished with them), you didn't put every term paper into the same word processing document (assuming you had word processors). You kept each paper in its own document, with a descriptive name. Likewise, it's a good idea to split your program's source code into multiple files, and you can give each one a helpful name. Compartmentalizing your program into smaller files gives you a chance to find important bits of code more quickly, and it h....


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial