Part 3: What Are The Downsides to Putting the Core Data MOC in the App Delegate

In part 2, I talked about why putting the MOC in the app delegate is a violation of the Single Responsibility Principle.

In part 1, I talked about why putting the MOC in your app delegate makes you dependent on Core Data for your application’s persistence.

Today I like to talk about the 3rd reason I gave in part 1, which is:

  • Any code you write that uses myManagedObjectContext will be dependent on the App Delegate.

Continue reading →

Part 2: What Are The Downsides to Putting the Core Data MOC in the App Delegate

In my previous post, I gave some reasons why putting the Core Data MOC in your app delegate was a bad idea. Those reasons were:

  1. The app delegate is managing the Core Data stack. Classes should only have one responsibility. The app delegate is already responsible for managing application lifecycle. It shouldn’t be managing the Core Data stack as well.
  2. You are completely dependent on Core Data and using it as your persistence method for your app. What if you decide to switch to Realm or something?
  3. Any code you write that uses myManagedObjectContext will be dependent on the App Delegate.
  4. Any tests you write will be dependent on the App Delegate and Core Data and will be hard to test and slow as a result.

In the previous post, we talked about how putting the Core Data MOC in your app delegate makes your app dependent on Core Data as your persistence mechanism and makes it hard to use something else.

Continue reading →

3 Ways To Fix Your iOS Testing Woes

Lots of companies have constant problems testing their iOS apps. Here are some ways to fix or ease them.

1. Don’t Make Developers Run or Write UI Tests

UI tests are black box tests and test the app from the perspective of the user. Your developers are the worst choice to test the app from this viewpoint and you need a fresh set of eyes for those tests. The QA engineer’s job is to test the app from the user’s viewpoint. Your QA Engineers should write these tests.

Plus, UI tests run entirely too slow for your developers to run them all the time and are much too failure prone. Don’t waste their time by making them write and run these tests.

Continue reading →