iOS Development Methodology Applying Best Practices to the Xcode World Thursday, July 25, 13 This is a “Guided Exploration”, though I will be talking a lot. Please feel free to ask questions at any time, I’d like this to be more of a discussion than a presentation. the Ruby community has been preaching test-first Agile methodologies for years, even if you don’t entirely buy into what they are saying, they are pushing the discussion forward and improving their best practices. Today I want to talk about applying some of these practices to iOS/ Objective-C development in Xcode.
A walkthrough of iOS development methodology from SmartLogic's Tom von Schwerdtner.
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
iOS Development Methodology
Applying Best Practices to the Xcode World
Thursday, July 25, 13
This is a “Guided Exploration”, though I will be talking a lot.
Please feel free to ask questions at any time, I’d like this to be more of a discussion than a presentation.
the Ruby community has been preaching test-first Agile methodologies for years, even if you don’t entirely buy into what they are saying, they are pushingthe discussion forward and improving their best practices. Today I want to talk about applying some of these practices to iOS/Objective-C development in Xcode.
Tom von Schwerdtner
SmartLogic
smartlogic.io
twitter.com/tvon
github.com/tvon
Thursday, July 25, 13
So you understand my perspective...
Developing websites for over 10 yearsRuby for past 2.5 yearsiOS for past 1.5 years
The entire UIViewController is basically the viewDidLoad method.Our service loads items based on an API call.
This gives us a nicely isolated data source.
This is a good lead in to testing in isolation
Testing, and in Isolation
Thursday, July 25, 13
Testing in isolation means testing individual components without relying on external components.
If you need to be sold on testing, in short it allows you to change and refactor your code and knowing that doing so doesn’t break anything (or finding it and fixing it).
It reduces the
A Note on Tools
• BDD Tool: Kiwi
• Web Mocking: Nocilla
• (Ditch whatever Xcode gives you)
Thursday, July 25, 13
Hitting the network for every test is just a bad idea.I like to test against a dev server until tests are greeen, then stub requests.
A Category Test
Testing the parsing of a timestamp string to an NSDate
Thursday, July 25, 13
This is a good first test. It is isolated by nature (being a category).
This is a legitimate test, whenever you are parsing a string to turn it into something else you should test that your parsing works.
We initialize a table view (data source methods require it)We initialize our data sourceWe add two widgets to the data source items.We verify that cellForRowAtIndexPath returns the correct cell data.Note that this somewhat inadvertently tests WidgetCell, but that is not our concern so much as the verification that the right cell is returned.
Why test something this simple? Well, they say that the two hardest things in computer science are cache invalidation, naming things and off-by-one errors.
Besides which, your items array could be a more complex collection.
• Test WidgetCell configuration• Isolate the Data Source Test (don’t rely on widget cell)
Thursday, July 25, 13
There are improvements that could be made here, if interested.
Questions?
smartlogic.io
twitter.com/smartlogic
github.com/smartlogic
facebook.com/smartlogic
Thursday, July 25, 13
So that’s it. Depending on time left we can discuss testing techniques, organization or even work ona particular problem if someone has something they’d like to discuss.