John Lam 1997 — 2026

Scalable API's

Chris Anderson wrote today about scalable API’s, and in particular about how MVC is not an abstraction that should be applied liberally across all types of applications.

I couldn’t agree more. After spending a limited amount of time working with the Cocoa frameworks on OS X, one of the things that struck me was how much friction was involved in writing a simple event handler. MVC is used everywhere in Cocoa. While Interface Builder abstracts away a significant amount of the details in making this work (it creates an in-memory object graph that defines the View that it serializes to disk for you rather than generating code), you still have to manually do things like define your model and controller classes EVERY SINGLE TIME you want to build a UI.

The amount of friction involved in this process is substantial. It is nowhere near as simple as double clicking on a button in a traditional RAD-style dev tool and having your editor drop you into the Click event handler.

That said, the challenges involved in building a “scalable API” are considerably greater than “let’s not do MVC”. One of the things that I hated about the way classic Windows controls operated was the fact that they held a copy of the data that they owned, rather than delegating ownership of that data to some (and almost always more appropriate) application data structure. The last time I spent significant amounts of time writing windows client apps, I almost exclusively used the virtual list view and virtual tree view controls since they finally provided me with the flexibility (and performance) that I required in my app.

The other thing that also needs to be done in the client app dev space is to provide reasonable hooks to enable unit testing of user interfaces. I would love to see an external mechanism whereby I can drive the entire UI of my application from a test script. Currently, I manually build this layer in the software that I’m writing, but it would be really nice to see a unit-test centric windows client framework in the future.

1 archived reader comment

Thong Nguyen (2003-02-14)

Um. Isn’t “manually creating models” far easier than having populate and keep the ui component synchronized with your internal data structures? I find MVC more ‘declarative’. It makes things more scalable, and IMO, easier to work with. Microsoft (with windows forms) seems to be behind the times.