Darel Rex Finley in 888

Objective-C Philosophy

2007.01.17   prev     next

OVER the course of my Dilbert-like career, I’ve had the occasion to work on a few C++ projects. Thankfully, that was some time ago, as web-based apps have now pretty much replaced C++ apps at most corporations. Writing apps on my own in C was something I enjoyed, but C++ struck me as a big, freighted beast that was supposed to make things easier and better, but somehow made the code much larger, and scattered it across many files in a way that, to my mind, made it harder to examine the code’s functionality at a glance. In theory, the idea of objects and methods seemed like a good one, but I was never very happy working with it in C++.

When I first decided, about a year ago, to devote a significant chunk of my free time to trying to write my first serious Cocoa app, I discovered that Cocoa apps are written in something called “Objective-C” (ObjC for short). I was apprehensive — what’s this, another C++-like language that takes all the fun out of writing an app in C? And since I had already learned C++ some years ago, did I really want to learn another one? Why didn’t Apple just use C++? Over the past several months, though, I’ve come to appreciate Apple’s decision to use ObjC as the development language of Cocoa, and I’ve accumulated a list of reasons why I like it better.

As I see it, there are five key differences between ObjC and C++. The first three are the ones that matter most to me, as a developer:

1. C Friendliness

  • C++ is not a strict superset of C. Not all C code will work in a C++ project.

  • ObjC is a strict superset of C. Any valid C code can be dropped into an ObjC project and you can expect it to work as it would in a C project.

2. Weight

  • C++ is a relatively heavy addition to C. Not only does it have more new syntax (as compared to ObjC), but it comes with a large, general-purpose class library that is considered part of the language — C++ programmers are expected to know it and use it, else risk writing code that will be automatically classified as “bad” by C++ developers and employers.

  • ObjC is a light addition to C. It has a relatively small set of new syntax, and it comes with no general-purpose class library. Maybe you can get one somewhere, but it’s not standard with the language, nor is it considered part of the language. Of course, with ObjC you can expect there to be a large class library with which you interface with your OS — as would also be the case in C++ — but there is no generalized “helper” library as in C++. An OS class library can be learned in pieces as needed: For example, I didn’t need to use sound in my first Cocoa app, so I didn’t even bother to learn it. But a general-purpose, organizational class library that’s considered part of the language must be learned in its entirety to make sure that you aren’t reinventing a wheel already included in it.

3. Syntax Similarity

  • In C++, the new, object-oriented syntax looks extremely similar to C — probably about as similar as they could make it.

  • In ObjC, the new, object-oriented syntax looks very different from C — even at a quick glance, you’d never mistake it for plain C. (It does, however, have the same compact brevity as C, which we C programmers like.)

Now let’s pause and take stock of what those three differences mean, as a group. One conclusion, I think, seems readily apparent: The architects of C++ didn’t like C. They thought of C as a bad mistake that needed to be replaced with something radically different. They built their language on C, and made its syntax look like C, so that it could springboard off the popularity of C, and would be thought of as the natural progression of C, in the minds of C programmers. But C++ is actually trying to get you to stop using C, and to do everything, as much as possible, in the new, object-oriented way. It doesn’t bother the designers of C++ that you have to learn a big class library; you’re probably a captive audience anyway since your employer is requiring you to use C++, or your school is requiring you to take a course in it. The way they saw it, learning a big class library will help you get used to doing things in the object-oriented way, and by making it a standard part of the language, force you to use it too.

ObjC, on the other hand, isn’t trying to replace C, but rather is just trying to add object capability on top of it. The goal of ObjC is to provide the shortest learning curve possible to get C developers working in a language that does objects — but isn’t hostile to its C roots. With ObjC, you just learn a few new items of syntax, and you’re ready to go. All your C code can be dropped into your ObjC project where it will work fine and won’t be considered a bad programming practice. And the new, object syntax stands out as clearly different from C, so you’ll always know what you’re looking at: If it looks like C, it is.

Of course, since ObjC allows you to do things in straight C as much as you care to, it’s a lot more dangerous in the hands of inexperienced developers, who will be far more likely to create a solid, stable app in C++. But if you’re a developer who has little trouble writing clean, bug-free apps in straight C, why give up C for no good reason? That would explain why C++ would be popular (in the pre-internet era) with big corporations that make use of large teams of junior programmers, whereas ObjC would be chosen by a company like Apple to be used in its own (and its third-party developers’) apps.

The other two key differences have to do with how objects work in the two languages:

4. Object Independence

  • In C++, an object is wholly owned by the object that created it, and must ultimately be destroyed by that object. For example, if object A creates object X, then it is up to A to destroy X. Object A can temporarily share X with objects B and C, but X is always owned by A, and must be destroyed by it. In C++, each object is dependent on the object that created it.

  • In ObjC, by contrast, each object is an independent entity that can outlive the interest of its creator, and even outlive its creator. For example, if object A creates object X, and A tells B and C about X, then A can relinquish its interest in X, but X lives on as long as B and/or C are still interested in using it. Object A can even be destroyed, and object X lives on. Only when B and C (and any other objects that have been given a hand in X) have all said “I’m no longer interested in X,” will X be destroyed. (Update 2008.03.14 — This may be a feature specific to Cocoa’s and other development systems’ implementation of ObjC, not a required feature of ObjC itself.)

5. Object Orientation After Compilation

  • In C++, method names are discarded during compilation, and the resultant executable consists of code that could just as well have come from a straight C compiler.

  • In ObjC, method names are kept in the compiled app, resulting in executable code that allows the calling of methods by name. As the developer of a simple app, I have not found a use for this feature myself, but I can well imagine that it would permit the use of object A by object B even though the sourcecodes for each were never shared on one computer.

Taken together, differences 4 and 5 suggest that ObjC is a truer implementation of the concept of an “object” — its objects have more independent lives, and they retain much of their object-oriented nature even after compilation.

Put it all together, and what do you get? ObjC is a language for people who can (and do) write reliable, clean apps in straight C, but would also like the added ability to use objects. And when they use that ability, they want those objects to be as true to the object paradigm as they can be. C++ programmers might scorn the idea that ObjC is truer to the object paradigm, but such scorn would be based on the fact that ObjC does not frown on the use of straight C. In C++, object-orientation is not an added ability, but rather is a coding style — one that’s intended to force you to write your entire project a new, safer way. How true the resultant “objects” are to the object paradigm is of secondary importance to C++.

Thank you, Apple, for seeking out a little-used language with more author-friendly design goals, instead of going with the language everyone else was using at the time. I can’t imagine any other computer company being bold enough to make that choice.


Update 2008.03.11 — Guess what the development language is for the iPhone SDK? You got it.


Update 2008.03.14/2012.05.11 — Special thanks to Brad Cox and Tom Love for creating this language in the first place!


prev     next



Hear, hear

prev     next

Best Recent Articles

Method of Implementing A Secure Backdoor In Mobile Devices

When Starting A Game of Chicken With Apple, Expect To Lose

How I Clip My Cat’s Nails

Seasons By Temperature, Not Solstice

It’s Not A Criticism, It’s A Fact

Features (Regularly Updated)

A Memory of Gateway — news chronology of Apple’s ascendancy to the top of the technology mountain.

iPhone Party-Poopers Redux and Silly iPad Spoilsports — amusing litanies of industry pundits desperately hoping iPhone and iPad will go away and die.

Embittered Anti-Apple Belligerents — general anger at Apple’s gi-normous success.


My books

Now available on the iBookstore!



Daring Fireball

The Loop



Red Meat

Despair, Inc.

Real Solution #9 (Mambo Mania Mix) over stock nuke tests. (OK, somebody made them rip out the music — try this instead.)

Ernie & Bert In Casino

Great Explanation of Star Wars

Best commercials (IMO) from Superbowl 41, 43, 45, 46, and 47

Kirk & Spock get Closer

American football explained.

TV: Better Call Saul; Homeland; Survivor; The Jinx; Breaking Bad; Inside Amy Schumer

God’s kitchen

Celebrity Death Beeper — news you can use.

Making things for the web.

My vote for best commercial ever. (But this one’s a close second, and I love this one too.)

Recent commercials I admire: KFC, Audi

Best reggae song I’ve discovered in quite a while: Virgin Islands Nice

Pinball Arcade: Unbelievably accurate simulation of classic pinball machines from the late ’70s through the ’90s, with new ones added periodically. Like MAME for pinball — maybe better.

d120 dice: You too (like me) can be the ultimate dice nerd.

WiFi problems? I didn’t know just how bad my WiFi was until I got eero.

Favorite local pad thai: Pho Asian Noodle on Lane Ave. Yes, that place; blame Taco Bell for the amenities. Use the lime, chopsticks, and sriracha. Yummm.

Um, could there something wrong with me if I like this? Or this?

This entire site as a zip file — last updated 2018.02.01

Previous articles

Nothing More Angry Than A Cornered Anti-Apple

Let ’Em Glow

The Ultimate, Simple, Fair Tax

Compassion and Vision

When Starting A Game of Chicken With Apple, Expect To Lose

The Caveat

Superb Owl


Basic Reproduction Number

iBook Price-Fixing Lawsuit Redux — Apple Won

Delusion Made By Google

Religion Is A Wall

It’s Not A Criticism, It’s A Fact

Michigan Wolverines 2014 Football Season In Review

Sprinkler Shopping

Why There’s No MagSafe On the New Mac­Book

Sundar Pichai Says Devices Will Fade Away

The Question Every Ap­ple Naysayer Must An­swer

Apple’s Move To TSMC Is Fine For Apple, Bad For Samsung

Method of Implementing A Secure Backdoor In Mobile Devices

How I Clip My Cat’s Nails

Die Trying

Merger Hindsight

Human Life Decades

Fire and the Wheel — Not Good Examples of A Broken Patent System

Nobody Wants Public Transportation

Seasons By Temperature, Not Solstice

Ode To Coffee

Starting Over

FaceBook Messenger — Why I Don’t Use It

Happy Birthday, Anton Leeuwenhoek

Standard Deviation De­fined

Not Hypocrisy

Simple Guide To Pro­gress Bar Correctness

A Secure Backdoor Is Feasible

Don’t Blink

Predictive Value

Answering the Toughest Question About Disruption Theory

SSD TRIM Command In A Nutshell

The Enderle Grope

Aha! A New Way To Screw Apple

Champagne, By Any Other Maker

iOS Jailbreaking — A Perhaps-Biased Assessment

Embittered Anti-Apple Belligerents

Before 2001, After 2001

What A Difference Six Years Doesn’t Make

Stupefying New Year’s Stupidity

The Innovator’s Victory

The Cult of Free

Fitness — The Ultimate Transparency

Millions of Strange Dev­o­tees and Fanatics

Remember the iPod Killers?

Theory As Simulation

Four Analysts

What Was Christensen Thinking?

The Grass Is Always Greener — Viewing An­gle

Is Using Your Own Pat­ent Still Allowed?

The Upside-Down Tech Future

Motive of the Anti-Ap­ple Pundit

Cheating Like A Human

Disremembering Mi­cro­soft

Security-Through-Obscurity Redux — The Best of Both Worlds

iPhone 2013 Score Card

Dominant and Recessive Traits, Demystified

Yes, You Do Have To Be the Best

The United States of Texas

Vertical Disintegration

He’s No Jobs — Fire Him

A Players

McEnroe, Not Borg, Had Class

Conflict Fades Away

Four-Color Theorem A­nal­y­sis — Rules To Limit the Problem

The Unusual Mo­nop­o­list

Reasonable Projection

Five Times What They Paid For It

Bypassable Security Certificates Are Useless

I’d Give My Right Arm To Go To Mars

Free Advice About Apple’s iOS App Store Guidelines

Inciting Violence

One Platform

Understanding IDC’s Tablet Market Share Graph

I Vote Socialist Be­cause...

That Person

Product Naming — Google Is the Other Microsoft

Antecessor Hypotheticum

Apple Paves the Way For Apple

Why — A Poem

App Anger — the Supersized-Mastodon-In-the-Room That Marco Arment Doesn’t See

Apple’s Graphic Failure

Why Microsoft Copies Apple (and Google)

Coders Code, Bosses Boss

Droidfood For Thought

Investment Is Not A Sure Thing

Exercise is Two Thirds of Everything

Dan “Real Enderle” Ly­ons


Ignoring the iPod touch

Manual Intervention Should Never Make A Computer Faster

Predictions ’13


Zeroth — Why the Century Number Is One More Than the Year Number

Longer Than It Seems

Partners: Believe In Ap­ple

Gun Control: Best Ar­gu­ments

John C. Dvorak — Translation To English

Destructive Youth

Wiens’s Whine

Free Will — The Grand Equivocation

What Windows-vs.-Mac Actually Proved

A Tale of Two Logos

Microsoft’s Three Paths

Amazon Won’t Be A Big Winner In the DOJ’s Price-Fixing Suit

Infinite Sets, Infinite Authority

Strategy Analytics and Long Term Ac­count­a­bil­i­ty

The Third Stage of Computing

Why 1 Isn’t Prime, 2 Is Prime, and 2 Is the Only Even Prime

Readability BS

Lie Detection and Psy­chos



Microsoft’s Dim Pros­pects

Humanity — Just Barely

Hanke-Henry Calendar Won’t Be Adopted

Collatz Conjecture A­nal­y­sis (But No Proof; Sorry)

Rock-Solid iOS App Stability

Microsoft’s Uncreative Character

Microsoft’s Alternate Reality Bubble

Microsoft’s Three Ruts

Society’s Fascination With Mass Murder

PlaysForSure and Wikipedia — Revisionism At Its Finest


Patent Reform?

How Many Licks

Microsoft’s Incredible Run

Voting Socialist

Darwin Saves

The Size of Things In the Universe

The Self-Fulfilling Prophecy That Wasn’t


Nobody Was In Love With Windows

Apples To Apples — How Anti-Apple Pundits Shoot Themselves In the Foot

No Holds Barred

Betting Against Hu­man­i­ty

Apple’s Premium Features Are Free

Why So Many Computer Guys Hate Apple

3D TV With No Glasses and No Parallax/Focus Issues

Waves With Particle-Like Properties

Gridlock Is Just Fine

Sex Is A Fantasy

Major Player

Why the iPad Wannabes Will Definitely Flop

Predators and Parasites

Prison Is For Lotto Losers

The False Dichotomy

Wait and See — Windows-vs-Mac Will Repeat Itself

Dishonesty For the Greater Good

Barr Part 2

Enough Information

Zune Is For Apple Haters

Good Open, Bad Open

Beach Bodies — Who’s Really Shallow?

Upgrade? Maybe Not

Eliminating the Im­pos­si­ble

Selfish Desires

Farewell, Pirate Cachet

The Two Risk-Takers

Number of Companies — the Idiocy That Never Dies

Holding On To the Solution

Apple Religion

Long-Term Planning

What You Have To Give Up

The End of Elitism

Good and Evil


How Religion Distorts Science

Laziness and Creativity

Sideloading and the Supersized-Mastodon-In-the-Room That Snell Doesn’t See

Long-Term Self-De­lu­sion

App Store Success Won’t Translate To Books, Movies, and Shows

Silly iPad Spoilsports

I Disagree

Five Rational Coun­ter­ar­gu­ments

Majority Report

Simply Unjust

Zooman Science

Reaganomics — Like A Diet — Works

Free R&D?

Apple’s On the Right Track

Mountains of Evidence

What We Do

Hope Conquers All

Humans Are Special — Just Not That Special

Life = Survival of the Fittest

Excuse Me, We’re Going To Build On Your Property

No Trademark iWorries


Twisted Excuses

The Fall of Google

Real Painters

The Meaning of Kicking Ass

How To Really Stop Casual Movie Disc Ripping

The Solitary Path of the High-Talent Pro­gram­mer

Fixing, Not Preaching

Why Blackmail Is Still Illegal

Designers Cannot Do Anything Imaginable

Wise Dr. Drew

Rats In A Too-Small Cage

Coming To Reason

Everything Isn’t Moving To the Web

Pragmatics, Not Rights

Grey Zone

Methodologically Dogmatic

The Purpose of Lan­guage

The Punishment Defines the Crime

Two Many Cooks


One Last Splurge

Making Money

What Heaven and Hell Are Really About

America — The Last Suburb


What the Cloud Isn’t For

Diminishing Returns

What You’re Seeing

What My Life Needs To Be

Taking An Early Re­tire­ment

Office Buildings

A, B, C, D, Pointless Relativity

Stephen Meyer and Michael Medved — Where Is ID Going?

If You Didn’t Vote — Complain Away

iPhone Party-Poopers Redux

What Free Will Is Really About

Spectacularly Well

Pointless Wrappers

PTED — The P Is Silent

Out of Sync

Stupid Stickers

Security Through Nor­mal­cy

The Case For Corporate Bonuses

Movie Copyrights Are Forever

Permitted By Whom?

Quantum Cognition and Other Hogwash

The Problem With Message Theory

Bell’s Boring Inequality and the Insanity of the Gaps

Paying the Rent At the 6 Park Avenue A­part­ments

Primary + Reviewer — An Alternative IT Plan For Corporations

Yes Yes Yes


Hey Hey Whine Whine

Microsoft About Microsoft Visual Microsoft Studio Microsoft

Hidden Purple Tiger

Forest Fair Mall and the Second Lamborghini

Intelligent Design — The Straight Dope

Maxwell’s Demon — Three Real-World Ex­am­ples


Entitlement BS



Einstein’s Error — The Confusion of Laws With Their Effects

The Museum Is the Art

Polly Sooth the Air Rage

The Truth

The Darkness

Morality = STDs?

Fulfilling the Moral Du­ty To Disdain



Real Design

The Two Rules of Great Programming


The End of the Nerds

Poverty — Humanity’s Damage Control

Berners-Lee’s Rating System = Google

The Secret Anti-MP3 Trick In “Independent Women” and “You Sang To Me”

ID and the Large Had­ron Collider Scare

Not A Bluff

The Fall of Microsoft

Life Sucks When You’re Not Winning


The Old-Fashioned Way

The Old People Who Pop Into Existence

Theodicy — A Big Stack of Papers

The Designed, Cause-and-Effect Brain


IC Counterarguments

The Capitalist’s Imaginary Line

Education Isn’t Eve­ry­thing

I Don’t Know

Funny iPhone Party-Poopers

Avoiding Conflict At All Costs

Behavior and Free Will, Unconfused

“Reduced To” Ab­sur­dum

Suzie and Bubba Redneck — the Carriers of Intelligence

Everything You Need To Know About Haldane’s Dilemma

Darwin + Hitler = Ba­lo­ney


Designed For Combat

Speed Racer R Us

Bold — Uh-huh

Conscious of Con­scious­ness

Future Perfect

Where Real and Yahoo Went Wrong

The Purpose of Surface

Eradicating Religion Won’t Eradicate War

Documentation Overkill

A Tale of Two Movies

The Changing Face of Sam Adams

Dinesh D’Souza On ID

Why Quintic (and Higher) Polynomials Have No Algebraic Solution

Translation of Paul Graham’s Footnote To Plain English

What Happened To Moore’s Law?

Goldston On ID

The End of Martial Law

The Two Faces of Ev­o­lu­tion

A Fine Rec­om­men­da­tion

Free Will and Population Statistics

Dennett/D’Souza Debate — D’Souza

Dennett/D’Souza Debate — Dennett

The Non-Euclidean Ge­om­e­try That Wasn’t There

Defective Attitude Towards Suburbia

The Twin Deficit Phan­toms

Sleep Sync and Vertical Hold

More FUD In Your Eye

The Myth of Rub­ber­neck­ing

Keeping Intelligent Design Honest

Failure of the Amiga — Not Just Mis­man­age­ment

Maxwell’s Silver Hammer = Be My Honey Do?

End Unsecured Debt

The Digits of Pi Cannot Be Sequentially Generated By A Computer Program

Faster Is Better

Goals Can’t Be Avoided

Propped-Up Products

Ignoring ID Won’t Work

The Crabs and the Bucket

Communism As A Side Effect of the Transition To Capitalism

Google and Wikipedia, Revisited

National Geographic’s Obesity BS


Theodicy Is For Losers

Seattle Redux


Living Well

A Memory of Gateway

Is Apple’s Font Rendering Really Non-Pixel-Aware?

Humans Are Complexity, Not Choice

A Subtle Shift

Moralism — The Emperor’s New Success

Code Is Our Friend

The Edge of Religion

The Dark Side of Pixel-Aware Font Rendering

The Futility of DVD En­cryp­tion

ID Isn’t About Size or Speed

Blood-Curdling Screams

ID Venn Diagram

Rich and Good-Looking? Why Libertarianism Goes Nowhere

FUV — Fear, Uncertainty, and Vista

Malware Isn’t About Total Control

Howard = Second Com­ing?

Doomsday? Or Just Another Sunday

The Real Function of Wikipedia In A Google World

Objective-C Philosophy

Clarity From Cisco

2007 Macworld Keynote Prediction

FUZ — Fear, Uncertainty, and Zune

No Fear — The Most Important Thing About Intelligent Design

How About A Rational Theodicy

Napster and the Subscription Model

Intelligent Design — Introduction

The One Feature I Want To See In Apple’s Safari.