I am writing a Mac Cocoa application that will manipulate database files, which can be easily be implemented using NSDocument technology, as they relate directly to disk files.
However the majority of the app will manipulate items within this database. When user opens a database item, a new Window should appear to allow the item to be viewed, edited, saved, so the database item doesn’t directly relate to a disk file. Note that undo and redo is appropriate here.
Is it appropriate to use NSDocument technology for both database windows and database item windows, or is there a better approach?
I think using
NSDocumentwould be a great choice. It would allow you to take advantage of most of the provided functionality, such asNSDocumentController, undo support, window management, etc. You will have to override some methods, such as loading and saving. It might be difficult to get the “Open Recent” menu to work correctly for these documents (maybe use a custom URL scheme?). The disadvantages of using NSDocument are… none that I can think of. You would have to write everything from scratch, and it would be even harder to integrate them into the rest of the application.