Document-based application on OS X

Can anyone send me a working example of how to write a document based application in AppleScript on OS X?

The demo named Mail Search (aka Watson) is a document-based application. But they did not explain why it is one, nor did they complete the Objective C example code for save and load code.

I have some experience with both Obj C and AS. How do I write the load and save code? A working example would be GREAT.

bob