Categories

Object-Oriented Design

  • Jun 19, 2011

    Objective-C era

    An RSS-feed and location-based iOS application

    The purpose of this post is so that I will have a link to give people when they ask: how do I write an iOS application that pulls data from an RSS feed, displays it pretty and can put things on a map. I'll show you all of that and more as I rewrite my oldest iOS application from scratch: FuelView.

    Read article

  • Jun 22, 2010

    Objective-C era

    The design of every Mac application

    I was recently asked by a reader if I used any modelling program to model the classes and relationships in my Mac applications. The answer is no, I don't model the application side of my programs. The reason for this is not because applications are always small and simple. The reason is that all applications have approximately the same design — eventually everything in a well-designed application becomes intuitive.

    Read article

  • Mar 15, 2010

    Objective-C era

    Custom UI Bindings in Interface Builder

    In my last post, I showed how you might redesign the interface to the iPhone's UITableView if you wanted to reimplement it on the Mac using Cocoa Bindings. This time, I'll show you how to make those bindings editable in Interface Builder so you can use the entire class with no code at all.

    Read article

  • Mar 10, 2010

    Objective-C era

    Designing a view with Bindings (UITableView on the Mac)

    Bindings are one of the best ways of connecting your view and model on the Mac but due to the layers of abstraction involved — and the fact that they don't exist on other platforms — bindings can seem foreign and confusing. In this post, I'll show a complex view that is traditionally implemented without bindings (the iPhone's UITableView) and show how it might be redesigned for the Mac with bindings.

    Read article

  • Jan 5, 2010

    Objective-C era

    Quality control in application development without unit testing

    In my last two posts, I've shown a Mac app with full unit tests and an iPhone app with full unit tests. The reality though is that I do not write or test code this way. In this post, I look at why so few applications are actually developed using unit tests. I'll also look at the alternate approaches — both manual and automated — that are normally used to maintain high quality and low bug rates in application development.

    Read article

  • Dec 27, 2009

    Objective-C era

    A sample iPhone application with complete unit tests

    In this post, I present a complete Cocoa Touch iPhone application implemented with unit tests for all created code. I'll look at setting up build and debug targets and executables for both Application and Logic tests, and show you some of the differences between Application and Logic tests. The code for this post is an iPhone version of the Mac post I presented last week.

    Read article

  • Dec 21, 2009

    Objective-C era

    A sample Mac application with complete unit tests

    In this post, I present a complete Cocoa Mac application implemented with unit tests for all created code. I'll create the tests first and then only add the code required to make the tests pass, largely following a test-driven development (TDD) methodology. Next week I'll show the configuration and implementation of this project as an iPhone application for the benefit of Cocoa Touch developers.

    Read article

  • Dec 8, 2009

    Objective-C era

    The design of an iPhone application

    In this post, I'll discuss iPhone program design using the example of a small but non-trivial iPhone application to provide examples of how the design is implemented. The design includes: how to manage data coming from different sources, how to manage multiple views of that data and how to design your program so it remains simple and manageable as it grows. In short, I'll be discussing how Model-View-Controller (MVC) applies to an iPhone application but I'll also discuss how even simple programs are considerably more hierarchic through their controllers and branched through their models and views than the basic description "Model-View-Controller" might imply.

    Read article

  • Jun 10, 2009

    Objective-C era

    Method names in Objective-C

    Compared to other languages, method names in Objective-C are weird. They're long, they're wordy, they include names for the parameters and they seem to repeat information you can get elsewhere. Despite these apparent negatives, Objective-C method naming can save you time and effort. I'll show you how methods are named so that you can predict them without documentation and understand how methods work and how they use their parameters from their names alone.

    Read article

  • Dec 27, 2008

    Objective-C era

    Heterogeneous cells in a UITableViewController

    This post looks at writing a UITableViewController for a table view that contains behaviorally unrelated rows — a common occurrence on the iPhone for tables containing multiple groups. I will present a simple alternative to Apple's UITableViewController template code that will reduce complexity and code as well as refocus areas-of-concern for this heterogeneous arrangement.

    Read article

  • Dec 18, 2008

    Objective-C era

    OrderedDictionary: Subclassing a Cocoa class cluster

    The default Cocoa collection classes are highly capable but there are situations where you may need to override them to alter their functionality. I'll explain when and how you should do this with an example class: OrderedDictionary (an NSMutableDictionary subclass that maintains ordering of its keys).

    Read article

  • Nov 10, 2008

    Objective-C era

    Simplifying your code using NSDictionary

    Computers programs are good at mindless repetitive tasks, they are not good at broad decision trees. In this post, I will show you a way of eliminating conditionals from your code that are based on program state by using an array of NSDictionary objects to maintain state.

    Read article

  • Aug 16, 2008

    Objective-C era

    In defense of Objective-C 2.0 Properties

    Of all the new features in Objective-C 2.0, none were as controversial as declared properties. Judging from the attacks, much of the controversy stems from a misunderstanding about the role that properties occupy in a class. In this post, I'll explain why properties are useful in Objective-C — and it isn't auto-generated getters and setters or the dot syntax.

    Read article

  • May 24, 2008

    Objective-C era

    Adapter interfaces in Objective-C, using categories.

    The Categories feature of Objective-C lets the programmer add extra sets of methods after compilation, something impossible in most compiled languages. Using this feature, here is an Objective-C variant of the classic "Adapter" design pattern that allows two classes to work closely together, without two-way coupling dependency problems.

    Read article

  • Apr 6, 2008

    Objective-C era

    The value of immutable values

    This is an explanation of why Cocoa contains immutable value classes and why the value classes you create in your own program should be immutable too.

    Read article