What is Objective-C, and how does it differ from other object-oriented programming languages?

Updated Feb 20, 2026

Short answer

Objective-C is an object-oriented programming language that adds Smalltalk-style messaging and dynamic runtime features to the C programming language. It was the primary language for developing Apple applications before Swift, and it remains important for maintaining legacy macOS and iOS codebases and interoperating with existing Apple frameworks.

Deep explanation

Objective-C was created by extending the C language with object-oriented capabilities inspired by Smalltalk. Instead of replacing C, it builds on top of it, allowing developers to use standard C features (such as pointers, structs, and functions) alongside objects, classes, and methods.

Objective-C is best thought of as **C + object-oriented messaging + a powerful runtime**.

How Objective-C Works

Unlike many object-oriented languages that call methods directly, Objective-C sends messages to objects.

For example:

main.m
#import <Foundation/Foundation.h>
@interface Person : NSObject
- (void)sayHello;
@end
@implementation Person
- (void)sayHello {
NSLog(@"Hello!");
}
@end
int main() {
Person *person = [[Person alloc] init];
[person sayHello];
return 0;
}

The syntax:

OBJECTIVE-C
[person sayHello];

does not directly invoke a function. Instead, it sends the message sayHello to the person object. The Objective-C runtime determines which implementation should execute.

Message Dispatch and the Runtime

One of Objective-C's defining features is its dynamic runtime. Many decisions happen while the program is running rather than during compilation.

Rendering diagram…

This runtime enables features such as:

  • Dynamic method lookup
  • Message forwarding
  • Categories (adding methods to existing classes)
  • Method swizzling (replacing implementations at runtime)
  • Reflection and runtime inspection

These runtime capabilities make Objective-C extremely flexible, but they also reduce some compile-time safety.

💡 Rule of thumb: Objective-C favors runtime flexibility, while many modern languages favor stronger compile-time guarantees.

How It Differs from Other Object-Oriented Languages

FeatureObjective-CJava/C++/C#
Method callsMessage passingDirect method invocation
RuntimeHighly dynamicMore static
Memory managementOriginally manual, later ARCGarbage collection (Java/C#) or manual/RAII (C++)
Base languageExtension of CIndependent languages
Syntax[object method]object.method()

Some important differences include:

  • C compatibility: Existing C code can usually be reused directly.
  • Dynamic typing: The id type can reference any Objective-C object.
  • Runtime features: Classes and methods can often be inspected or modified while the application is running.
  • Messaging `nil`: Sending a message to nil safely does nothing and returns a default value instead of crashing.

Memory Management

Earlier Objective-C programs used manual reference counting with retain, release, and autorelease.

Modern Objective-C primarily uses Automatic Reference Counting (ARC), where the compiler automatically inserts the necessary memory-management calls.

ARC is **not** garbage collection—it performs compile-time insertion of reference-counting operations.

Where Objective-C Is Used Today

Although Swift is Apple's preferred language for new development, Objective-C remains valuable because:

  • Large enterprise iOS and macOS applications still contain Objective-C code.
  • Apple frameworks have extensive Objective-C APIs.
  • Swift and Objective-C interoperate well, allowing gradual migration.
  • Many SDKs and libraries continue to expose Objective-C interfaces.

Real-world example

Suppose a company has maintained an iOS banking application for over ten years. Most of the app was originally written in Objective-C, while newer features are being added in Swift. Rather than rewriting the entire application, developers keep the stable Objective-C networking and business logic while introducing new Swift screens.

This approach reduces risk, saves development time, and allows both languages to work together through Apple's interoperability features.

Logger.m
Logger *logger = [[Logger alloc] init];
[logger logMessage:@"User signed in"];

In practice, this lets organizations modernize their applications incrementally instead of performing an expensive full rewrite.

Common mistakes

  • * **Confusing messaging with function calls** — Objective-C sends messages through its runtime rather than directly calling methods.
  • * **Assuming ARC is garbage collection** — ARC manages reference counting automatically but does not periodically reclaim unused memory like a garbage collector.
  • * **Ignoring the runtime** — Many interview questions focus on the dynamic runtime because it is a defining feature of Objective-C.
  • * **Thinking Objective-C is obsolete** — While Swift is preferred for new Apple development, Objective-C is still widely used in existing production applications and frameworks.
  • * **Overlooking C compatibility** — Objective-C is an extension of C, so C features remain available alongside object-oriented programming.

Follow-up questions

  • Why does Objective-C use message passing instead of direct method calls?
  • What is ARC, and how does it differ from garbage collection?
  • What is the id type in Objective-C?
  • Why is Objective-C still worth learning today?

More Objective-C interview questions

View all →