Five Things You Need to Know About Objective C and The iPhone

What Is Objective-C?

Objective-C is a “simple computer language
designed to enable sophisticated object-oriented programming.
Objective-C is defined as a small but powerful set of extensions to the
standard ANSI C language.” Created to provide the C programming language
full object-oriented programming features in a simple way, Objective-C
is the primary language from which iPhone and iPad applications are
built.

Where Did Objective-C Come From?

Objective-C was originally created by Brad Cox and Tom Love in the early
1980s while they worked at their company called Stepstone. They had
gotten familiar with Smalltalk while working at ITT Corporation’s
Programming Technology Center in 1981. Cox understood that a language
such as Smalltalk could be very useful when creating development
environments, so he began modifying the C compiler, adding some of the
features of Smalltalk. This eventually became a working implementation
of an object-oriented extension to the C language. At the time it was
refered to as “OOPC” for “Object-Oriented Programming in C”.

The two programmers eventually created a new business called
Productivity Products International (PPI) to sell the new product. At
this point it combined an Objective-C compiler with class libraries. Cox published a description of Objective-C in 1986 in a book called
Object-Oriented Programming, An Evolutionary Approach. Steve Jobs
founded a company called NeXT, which licensed Objective-C from the
StepStone company, and in 1996 Apple aquired NeXT, and used OpenStep’s
Objective-C in its new OS, called Max OS X. The rest is history.

What Type of IDE Do I Need To Program in Objective-C?

The two primary development tools used to program in Objective-C are Xcode and Interface Builder.

The Xcode IDE is actually made up of windows that are used to develop
apps using the Xcode application itself. These windows include a project
window, text editor window, Documentation window and more.

Interface Builder is a graphical editor that is used to design all the
aspects of your app’s graphical user interface. Any time you make
changes within Interface Builder, the changes are reflected in Xcode.

Do I Have To Have a Mac to Program in Objective-C?

In order to use the iPhone Software Developer’s Kit (SDK) 4, you must be
using an Intel-based Mac running Mac OS X Snow Leopard or later–thus
far there is no Windows version of the SDK. That said, there are many
tools which can be used to create iPhone and iPad apps without the use
of the iPhone SDK 4 or a Mac.

Apple requires that all apps that are submitted to the App
Store to have been created using Objective-C, however app tools
such as Titanium and PhoneGap wrap apps that have been created
using other technologies–such as JavaScript, HTML 5 and CSS3–in
an Objective-C wrapper. So far, many such apps have been
successfully submitted and accepted by the App Store.

Rhodes is an open source framework
which enables developers to create native apps for the iPhone, as well
as Windows Mobile, BlackBerry, Symbian and Android. The apps that are
created using Rhodes are true native apps which are able to take
advantage of the iPhone’s capabilities (GPS, PIM contacts, camera,
etc.). One advantage of using Rhodes is that the source code can be
compiled to run on all major smartphone devices.

Titanium is open source
software which enables developers to use their current skill set, such
as JavaScript, HTML and CSS, and turn their work into native
applications that appear and work as if they were written in
Objective-C. Titanium features more than 300 APIs as well as a large
developer and support community. It is free to download and use, and is
available for Mac, Windows and Linux operating systems.

Zimusof’s DragonFireSDK
allows developers to use C and C++ to develop applications using Visual
Studio or Visual Studio Express. Zimusof is responsible for packaging
applications and handling developer submissions to Apple’s App Store on
behalf of its customers. Developers submit their apps to Zimusoft after
development and testing on their own Windows PCs. Pricing for
DragonFireSDK is $99 and includes one iTunes App bundling, with
additional bundles available for $10 each.

There is also an Objective-C compiler for .NET that is available via Google Code.

How Does Objective-C Differ from C?

Objective-C has a different approach to extending C than does C++. C++ programming
supports some aspects of object-oriented programming, generic
programming and metaprogramming. It also features a large standard
library that includes some container classes.

While Objective-C does add object-oriented programming, dynamic typing
and reflection to C, it doesn’t include a standard library, although it
is usually utilized with an OpenStep-like library (OPENSTEP, Cocoa, or
GNUstep), and these provide the functionality that C++’s standard
library provides. An Objective-C container class can hold any object
type, so some of C++’s container classes are not required.

Objective-C provides runtime support reflective features to C, while C++
programming
only adds a small amount of runtime support to C. Objective-C enables
an object to be queried about its own properties, while C++ programming cannot do
this without the use of external libraries.

Another difference is that while Objective-C and C++ both employ a mix
of run-time decisions and compile-time decisions, Objective-C is more
geared toward the former and C++ programming more towards the latter.

More Objective-C Resources

We’ve put together a list of resources for developers who are interested
in working with Objective-C. While not exhaustive, these resources can
help to get you started in the world of Objective-C.

  • Introduction to The Objective-C Programming Language – A detailed introduction to object-oriented programming in the context of the Objective-C programming language.
  • Objective-C Beginner’s Guide
    – Beginner’s guide to Objective-C with practical coding examples that
    contrast Objective-C to other OOP languages like Java and C++.
  • From C++ to Objective-C
    – I have tried to gather in this document a lot of C++ and Objective-C
    concepts, to show how to switch from one to another and understand the
    Objective-C paradigms.
  • Object Oriented Programming in Objective-C – These documents provide a brief introduction to Object Oriented Programming in the Objective-C language.
  • GCC, the GNU Compiler Collection
    – The GNU Compiler Collection includes front ends for C, C++,
    Objective-C, Fortran, Java, and Ada, as well as libraries for these
    languages.
  • W3Kit 2.2 – An object-oriented toolkit for building interactive World Wide Web applications.
  • Learn Cocoa – Featured tutorials from Cocoa Dev Central.

Related Articles

More by Author

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Must Read