Ones to Watch - WWDC 2015

Here at Stringer's Theory I like to focus not on Cocoa technologies per se but on best practices for programming with Cocoa. Sessions at WWDC each year tend to focus on explaining the former but tend not to cover so much the actual programming.

Every year though there are a couple of sessions which surprise and more broadly discuss ways to best use Cocoa, and now Swift to engineer your code.

Here are three of the best I noted from visiting this year's WWDC.

Advanced NSOperations

An excellent session presented by a snappily dressed framework evangelist walking us through the architecture of the actual WWDC app used by attendees at the conference.

It effectively demonstrates the benefits of decomposition of complex business logic into many discrete 'operations'. It's a demonstration that is built on the Single Responsibility Principle (SRP) applied to operations e.g. encapsulating small units of business of logic.

Use of these together with composition of multiple operations in queues is used to create complex dependant chains of business logic. As a bonus, this session provides a surprising solution that uses operation dependancies to enforce mutual exclusivity when handling multiple errors with alert views.

Best Practices for Progress Reporting

How do you solve the problem of reporting a single progress bar that represents the many different facets of a task like downloading, copying, long running computations? Add a cancel button to that UI and think about how that cancellation should propagate back to just the right place, om-my! Well this is just the kind of problem we're all about discovering best practices for solving.

Without thinking, this kind of thing can typically result in layers and layers of highly coupled code together with monstrously hard to understand and debug business logic. This is due to the nature of the reporting and cancellation of work requiring communication from the highest UI level all the way to the lowest application foundations and everything in-between.

Because it's such a common use case, iOS and OS X in recent years introduced the NSProgress class which gives us a Apple designed solution to this problem. This session takes us into the almost magic like NSProgress and through this use case shows us a great implementation of the Composite Design Pattern.

If you're not using NSProgress yet, you really should be and this is a great place to begin.

Protocol-Orientated programming in Swift

Probably one of the most specifically programming focussed sessions of this year's WWDC. It was repeated again on the last day due to both its popularity and how much I think the Swift team wanted as many people to get this.

Although essentially an introduction to Protocol extensions in Swift 2, it's really a discussion about one of the underlying driving ideas in Swift's design that makes it different to Obj-C, one which they call protocol-oriented development.

This sessions sets out to change the way we think about solving familiar programming problems. To its credit, the presenters spend the time to explain not just what protocol extensions are but to give an understanding of why it's a better approach over more familiar OOP ways of doing things.

It cleverly reaffirms some old ideas in software engineering; the one that most springs to mind being the Design Patterns sound bite "Program to Interfaces not Implementations". The narrative is even driven by the appearance of an old timer 'Crusty'. It turns out though Crusty might just be worth listening to and I think even he would probably find a lot to like about about Swift 2.

What this session tells me is that the team behind Swift have a real goal and focus on not just providing a faster, more modern language, but also providing a language that addresses real software design problems we encounter using our existing ones. You should enjoy this one!

Watch the videos:

Check this article out on Medium.

Join me for a 2 day workshop 'Mastering TDD & BDD for iOS' at CodeNode 22-23rd Sep - Early Bird Pricing ends 26th Aug