Re: Program Structure
Re: Program Structure
- Subject: Re: Program Structure
- From: "Pelaia II, Tom" <email@hidden>
- Date: Wed, 29 Jun 2011 13:00:40 -0400
- Acceptlanguage: en-US
- Thread-topic: Program Structure
> I have set out to write an address book as my first program as it means displaying data, reading it from Text Boxes and reading/writing a SQLite database. I also need to pick up button press events, fill an NSTableView and respond to click events from the table.
>
CoreData is thew way to go unless you need to have tight control over the database schema. CoreData provides an object representation of your data, data abstraction and natural Cocoa integration.
> What I have is:
>
> MainMenu.xib - what I would have called a Windows Form in VS.
> JMainView - I have set this up to be the "code behind" MainMenu, it reads/writes data in the Text Boxes and handles button clicks and the selection of a record in the NSTableView, then calls functions in the other classes.
This sounds more like a view controller, so the name should probably be something like JMainViewController to avoid confusion. Consider subclassing NSViewController.
> JAddressData - this is the address data class.
> JAddressUpdater - reads/writes records from/to the SQLite database (it has static functions)
> JDataTableSource - the data source for the NSTableView, it originally picked up the click event from the table but now just deals with the data for the table.
You might also want to consider Cocoa bindings to see if that is appropriate. You can either use data sources or Cocoa bindings to manage your table data. Bindings provide automatic features thus reducing code and they work really well when you have several views of the same data as they are automatically kept synchronized.
> Is that a reasonable structure to use? If there is a web page with recommendations I am happy to look at it.
It is really difficult to make recommendations as there are many approaches and you need to decide what is best for your project.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden