Danny's Lab

Engineering the World

The problem with Object-Oriented Programming

Published on: Apr 8, 2018
Reading time: 1 minute

I've been a die hard C programmer for many years. But it wasn't until Objective-C (and eventually Swift) that I found an Object-Oriented programming that I found acceptable. And the reason was because while they had objects and classes, these weren't the only ways to have different components interact with each other. I've often had a hard time articulating with my peers exactly what the issue was.

I would cite the delegate pattern and the way Objective-C and Swift relies on protocols and delegates. To which OO programmers would always say "you can do that in <xyz language> too." But I believe Charles Scalfani has done a pretty good job explaining the pitfalls in his article: Goodbye, Object Oriented Programming.

Indeed, I've always had an issue with typical OO models when you're trying to do anything with a database or graphics. Inevitably you end up wondering if your string class should inherit from your graphics or database classes or vice-versa. Nothing seems to really make any sense and you end up doing the containment thing anyway but now you have this award indirection you have to manage.

If you haven't already done so, you should definitely watch this 2015 WWDC Video on Protocol Oriented Programming.