Tell me more ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I just finished reading the objective-c developer handbook from apple. So I pretty much know everything that there is to know about objective-c (hee hee hee). I was wondering how do I go about designing a 3-tier application in objective-c. The 3-tiers being a front-end application in Cocoa, a middle-tier in pure objective-c and a back-end (data access also in objective-c and mysql db).

I'm not really interested in discussing why I'd need a 3-tier architecture, I'd like to narrow the discussion to the 'how'.

For example, can I have 3 separate x-code projects one for each tier? If so how would I link the projects together. In java, I can export each tier as a jar file and form the proper associations.

share|improve this question
Is this an iOS or Mac OS X application you are trying to create? – Johan Karlsson Dec 6 '12 at 7:10
OSX application – hba Dec 6 '12 at 18:25

closed as not a real question by gnat, Walter, ElYusubov, Tim Post, Robert Harvey Dec 7 '12 at 0:34

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, see the FAQ.

1 Answer

Your 3 tiers can be part of the same project or entirely separate -- it all depends on your choice as the architect. For a small mostly self contained application with a GUI you'll use a[n] MVC pattern to work with the GUI and any data you need to store. If you ORM your data to a database, you won't even write that tier yourself -- someone already wrote the database application and you're just interfacing with it.

If there is lots of application logic between the data (model) and the view, or it makes sense to have your logic as a stand-alone utility, then perhaps you should abstract that logic into it's own program (with accompanying dev library) and simply call it or link to the library from your application.

In both the case of interfacing with a database and extracting useful functionality to a library, you will still be writing all the code that interfaces with the data and any libraries in one project when you need to present the information to the user in a stylish manner. You could use Cocoa or any other GUI library; you could have a web front end as well -- it's all up to you.

Don't get bogged down by trying to hard to implement and mould into some philosophical 3 tier application. Rather, if you're doing things right, it will come quite naturally.

share|improve this answer
Thanks Dave. How do I call object-c objects that are declared in another code-x project? Could you please list the steps I need to take. – hba Dec 6 '12 at 18:24

Not the answer you're looking for? Browse other questions tagged or ask your own question.