ArticleslgStudy

science

Objective-C

Objective-C is a science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Objective-C rather than just read about it. In short: Objective-C is a high-level general-purpose, object-oriented programming language that adds Smalltalk-style message passing (messaging) to the C programming language. Originally developed by Brad Cox and Tom Love in the early 1980s, it was selected by NeXT for its NeXTSTEP operating system.

Key takeaways

  • Objective-C belongs to science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Objective-C to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Objective-C from memory before moving on to harder problems.

Reference excerpt

Objective-C is a high-level general-purpose, object-oriented programming language that adds Smalltalk-style message passing (messaging) to the C programming language. Originally developed by Brad Cox and Tom Love in the early 1980s, it was selected by NeXT for its NeXTSTEP operating system. Due to Apple macOS’s direct lineage from NeXTSTEP, Objective-C was the standard language used, supported, and promoted by Apple for developing OS X and iOS applications (via their respective application programming interfaces (APIs), Cocoa and Cocoa Touch) between 1997, when Apple purchased NeXT, and 2014 when Apple introduced the Swift programming language. Objective-C programs developed for non-Apple operating systems or that are not dependent on Apple's APIs may also be compiled for any platform supported by GNU, GNU Compiler Collection (GCC) or LLVM/Clang. Objective-C source code "messaging/implementation" program files usually have .m filename extensions, while Objective-C "header/interface" files have .h extensions, the same as C header files. Objective-C++ files are denoted with a .mm filename extension.

History Objective-C was created mainly by Brad Cox and Tom Love in the early 1980s at their company Productivity Products International (PPI). Leading up to the creation of their company, both had been introduced to Smalltalk while at ITT Corporation's Programming Technology Center in 1981. The earliest work on Objective-C traces back to around then. Cox was intrigued by problems of true reusability in software design and programming. He realized that a language like Smalltalk would be invaluable in building development environments for system developers at ITT. However, he and Tom Love also recognized that backward compatibility with C was critically important in ITT's telecom engineering milieu. Cox began writing a pre-processor for C to add some of the abilities of Smalltalk. He soon had a working implementation of an object-oriented extension to the C language, which he named Object-Oriented Pre-Compiler (OOPC). Love was hired by Schlumberger Research in 1982 and had the opportunity to acquire the first commercial copy of Smalltalk-80, which further influenced the development of Objective-C. To demonstrate that real progress could be made, Cox showed that making interchangeable software components really needed only a few practical changes to existing tools. Specifically, they needed to support objects in a flexible manner, come supplied with a usable set of libraries, and allow for the code (and any resources needed by the code) to be bundled into one cross-platform format. Love and Cox eventually formed PPI to commercialize their product. To avoid legal disputes with his previous employers, Cox reimplemented his compiler for the language, which was renamed "Objective-C". The company's main product line consisted of this compiler, along with class libraries intended to be used with it. In 1986, Cox published the main description of Objective-C in its original form in the book Object-Oriented Programming: An Evolutionary Approach. Although he was careful to explain that there is more to the problem of reusability than just what Objective-C provides, the language was often compared feature for feature with other languages.

Popularization through NeXT In 1988, NeXT licensed Objective-C from Stepstone (formerly PPI, the owner of the Objective-C trademark) and extended the GCC compiler to support Objective-C. NeXT developed the Application Kit and Foundation Kit libraries on which the user interface and Interface Builder were based. While the NeXT workstations failed to make a great impact in the marketplace, the tools were widely lauded in the industry. NeXT dropped hardware production and focused on software tools, selling NeXTSTEP and later OpenStep as platforms for application development. To circumvent the terms of the GPL, NeXT had originally intended to ship the Objective-C frontend separately, allowing the user to link it with GCC to produce the compiler executable. Richard M. Stallman initially considered the arrangement permissible, but changed his assessment after consulting GNU's lawyers. NeXT then agreed to make its Objective-C frontend part of GCC. The work to extend the GNU Compiler Collection (GCC) was led by Steve Naroff, who joined NeXT after working on Objective-C at Stepstone. The compiler changes were made available as per GNU General Public License (GPL) terms, but the runtime libraries were not, rendering the open source contribution unusable to the general public. This led to other parties developing such runtime libraries under open source licenses. Later, Naroff was also a principal contributor to the Objective-C frontend for Clang at Apple. The GNU project started work on its free software implementation of Cocoa, named GNUstep, based on the OpenStep specification. Dennis Glatting wrote the first GNU Objective-C runtime in 1992. The GNU Objective-C runtime introduced in 1993 was developed by Kresten Krab Thorup while he was a university student in Denmark. Thorup also worked at NeXT from 1993 to 1996.

Apple development and Swift After acquiring NeXT in 1996, Apple Computer used OpenStep in its then-new operating system, Mac OS X. This included Objective-C, NeXT's Objective-C-based developer tool, Project Builder, and its interface design tool, Interface Builder. Both were later merged into one application, Xcode. Most of Apple's current Cocoa API is based on OpenStep interface objects and is the most significant Objective-C environment being used for active development. At Worldwide Developers Conference (WWDC) 2014, Apple introduced a new language, Swift, which was characterized as "Objective-C without the C".

Syntax Objective-C is a thin layer atop C and is a "strict superset" of C, meaning that it is possible to compile any C program with an Objective-C compiler and to freely include C language code within an Objective-C class. Objective-C derives its object syntax from Smalltalk. All of the syntax for non-object-oriented operations (including primitive variables, pre-processing, expressions, function declarations, and function calls) are identical to those of C, while the syntax for object-oriented features is an implementation of Smalltalk-style messaging.

… excerpt ends here. Continue reading the full article.

Worked examples

Example 1 — a first encounter with Objective-C

Start with the simplest possible case. Write down what Objective-C claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Objective-C before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Objective-C ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Objective-C

In research
Objective-C appears in science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Objective-C in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Objective-C is common in secondary-school and first-year university syllabi. It links to neighbouring topics C programming language family, Class-based programming languages, Compiled programming languages, so understanding it makes those chapters shorter.
In everyday life
Look for Objective-C outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Objective-C” →

How to study Objective-C in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Objective-C means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Objective-C out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Objective-C in simple terms?

Objective-C is a high-level general-purpose, object-oriented programming language that adds Smalltalk-style message passing (messaging) to the C programming language. Originally developed by Brad Cox and Tom Love in the early 1980s, it was selected by NeXT for its NeXTSTEP operating system.

Why does Objective-C matter?

Because it connects several science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Objective-C?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Objective-C.

Tags

  • C programming language family
  • Class-based programming languages
  • Compiled programming languages
  • Dynamically typed programming languages
  • GNUstep
  • NeXT
  • Object-oriented programming languages
  • Objective-C
  • Programming languages created in 1986

Keep exploring