Fritzables
Fritzables

Reputation: 383

Using the AppDelegate?

I regularly listen and watch the Stanford University iOS Programming Courses (CS193p) that are delivered by Paul Hegarty.

Even though these sessions move at a quick rate, they have proved valuable when it comes to learning the various topics covered.

In the latest series (Winter 2013) and in particular Lecture 2, Paul has made the comment disregard both the AppDelegate Interface & Implementation files created by XCode 4 when first creating a project and basically design your own Model.

Why do this if you have to redesign to include ‘window’ objects and the various application protocols when you can use the ones already provided to you in AppDelegate?

Upvotes: 4

Views: 236

Answers (1)

Sergey Kalinichenko
Sergey Kalinichenko

Reputation: 726987

I think that you misunderstood the suggestion to "disregard the app delegate." Considering the application delegate's central location, it sometimes tends to become a "dumping ground" for everything shared. Need a flag or two? Throw it into the app delegate! Need a counter? No problem, put it into the app delegate! This is precisely the thing you should not be doing: storing the application state is something the model does; keep the app delegate out of it.

I do not think that the advice is to throw away the generated code for the app delegate, though: you need it to manage your application's lifecycle. But managing the lifecycle is the only thing for which you should be using your app delegate: your model classes need to be cleanly separated from it.

Upvotes: 6

Related Questions