Skip to main content

Posts

Showing posts from May, 2013

JavaScript Design Pattern

Design patterns are reusable solutions to commonly occurring problems in software design. They are both exciting and a fascinating topic to explore in any programming language.

One reason for this is that they help us build upon the combined experience of many developers that came before us and ensure we structure our code in an optimized way, meeting the needs of problems we're attempting to solve.

Design patterns also provide us a common vocabulary to describe solutions. This can be significantly simpler than describing syntax and semantics when we're attempting to convey a way of structuring a solution in code form to others.

In this book we will explore applying both classical and modern design patterns to the JavaScript programming language.

Open Source Book

Simple Reachability + Blocks

I like this block-based approach much more as opposed to listening for notifications or having a delegate callback on a central Reachability instance.

In most uses-cases I have seen so far you are probably just calling a method on the watching view controller and there it helps that the observer block can capture some state. Because of this we don’t need to use the C-level state passing.

At the time of this writing the code for DTReachability is now present on the develop branch of DTFoundation, it will be merged into master for the next release. Since it has a dependency on the SystemConfiguration.framework I put it into its own static lib and Cocoapods sub spec to use individually.

I am using this in AutoIngest for Mac now, but it should work without modification on iOS just the same. Your feedback is welcome.

Cocoanetics