Monday, December 03, 2012

TDD Kata for iOS: MVP (Model-View-Presenter) Pattern

This 1 hour and 20 minute screencast guides you through a TDD Kata for designing with Model-View-Presenter pattern in iOS using the JetBrains AppCode IDE for objective-C and the OCMock static library.

The premise of this kata is that the existing ViewControllers in any iOS application are tightly coupled to presentation layer concerns. Rather than attempting to write tests directly against the view controllers, instead write unit tests to generate a Presenter class, injected with multiple protocols, that will coordinate activities between those protocols. In this classic "bank account transfer" example, the presenter delegates method calls to a remote account repository protocol, a local account repository protocol, and a view protocol. The use of OCMock to mock these protocols enables us to design and understand the interactions, and to "generate-by-usage" each element of the MVP pattern. Later in the kata an IOC container class, "ServiceLocator", is designed by unit test to standardize presenter instantiation in a single location.

This kata uses the JetBrains AppCode IDE to generate all tests and code. The kata has a heavy emphasis on effective use of keyboard shortcuts to generate classes, protocols, methods and import statements quickly and naturally as part of the design process. Please note that in this screencast, the key mappings have been set to the standard Intellij keymap used by Intellij (java). This keymap is often set as the default in other JetBrains IDEs. (JetBrains provides IDEs in multiple programming languages.)

To begin the kata screencast, click here.



6 comments:

Unknown said...

Thanks for the screencast, David. Is there a way to download the video file so that I am able to watch it offline later?
Thanks

Unknown said...

I was encouraged this website by my cousin. I am not sure regardless of whether this post is written by him as nobody else know such comprehensive about my trouble. You’re great! Thanks!Best advertising Agency in the world | top advertising agencies in pakistan | Marketing Agency | pakistani matrimonial

Unknown said...

I can't wait to see your examples of how your handwriting has evolved! I am obsessed with the different forms that handwriting takes. I love collecting old postcards just to see the writing...
website development for companies

James said...

Simon Olsberg - http://content.screencast.com/users/gaddzeit/folders/Objective%20C%20Tutorials/media/05d40fdc-8060-4d68-bfc7-493794a1756f/MvpKataForiOS_2012Dec02.mp4

Unknown said...

Thanks for sharing this information. iOS is the world’s most advanced mobile operating system, continually redefining what people can do with a mobile device. Together, the iOS SDK and Xcode IDE make it easy for developers to create revolutionary mobile apps. https://intellipaat.com

Unknown said...

Simply wish to say your article is spectacular. The clarity in your post is just impressive. thanks for sharing the screencast. SEO Company