Controller vs. AppDelegate?


When I did the Challenge exercise, I used a controller object (CountCharsController) while I see that the suggested solution uses the AppDelegate (CountCharsAppDelegate in mine, LetterCountAppDelegate in the solutions). What is the difference? Is there any advantage? Or is this just another example of multiple ways to skin the cat?


With a project this simple it’s hard to point to any particular advantage between the two. Certainly if the task of counting the characters were more complicated, involving a dozen or more methods, then it would be a good candidate for being moved into its own controller object. The challenge solution uses the AppDelegate object provided by the project template for simplicity, as the goal of this chapter is to show how to respond to UI events using target/action.