    <rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:content="http://purl.org/rss/1.0/modules/content/">
     <channel>
        <title>ACCU  :: An Introduction to Objective-C</title>
        <link>https://members.accu.org/index.php/articles/679</link>
        <description>Professionalism in Programming</description>
        <dc:language>en-us</dc:language> 
        <dc:creator>Administrator</dc:creator> 
        <admin:generatorAgent rdf:resource="http://www.xaraya.org" /> 
        <admin:errorReportsTo rdf:resource="mailto:webeditor@accu.org" />
       <sy:updatePeriod>hourly</sy:updatePeriod>
       <sy:updateFrequency>1</sy:updateFrequency>
       <docs>http://backend.userland.com/rss</docs>




<div class="xar-mod-head"><span class="xar-mod-title">Programming Topics + CVu Journal Vol 16, #4 - Aug 2004</span></div>

<table border="0" cellpadding="1" cellspacing="0">
    <tbody>
    <tr>
        <td valign="top">
            Browse in :
       </td>
       <td valign="top">

                                            <a href="https://members.accu.org/index.php/articles/">All</a>

                     &gt;                         <a href="https://members.accu.org/index.php/articles/c13/">Topics</a>

                     &gt;                         <a href="https://members.accu.org/index.php/articles/c65/">Programming</a>
<br />

                                            <a href="https://members.accu.org/index.php/articles/">All</a>

                     &gt;                         <a href="https://members.accu.org/index.php/articles/c76/">Journals</a>

                     &gt;                         <a href="https://members.accu.org/index.php/articles/c77/">CVu</a>

                     &gt;                         <a href="https://members.accu.org/index.php/articles/c101/">164</a>
<br />

                                            <a href="https://members.accu.org/index.php/articles/c65-101/">Any of these categories</a>

                    -                        <a href="https://members.accu.org/index.php/articles/c65+101/">All of these categories</a>
<br />
</td>
   </tr>
   </tbody>
</table>




<div class="xar-error">
   <p>
 <strong>Note:</strong> when you create a new publication type,
the articles module will automatically use the templates
<em>user-display-[publicationtype].xt</em>
and <em>user-summary-[publicationtype].xt</em>.
If those templates do not exist when you try to preview or display a new article,
you'll get this warning :-)  Please place your own templates in themes/<em>yourtheme</em>/modules/articles . The templates will get the extension .xt there. </p>
</div>
<div class="xar-norm xar-standard-box-padding">
   <h1><strong>Title:</strong>&nbsp;An Introduction to Objective-C</h1>
<p><strong>Author:</strong>&nbsp;</p>
<p>
<strong>Date:</strong> 03 August 2004 13:16:06 +01:00 or Tue, 03 August 2004 13:16:06 +01:00</p>
<p><strong>Summary:</strong>&nbsp;<p>This series of articles aims to introduce the Objective-C programming language to readers of C Vu, who are users of C and C++. I will try to show how the language manages to add object-oriented facilities to the low-level features of C in a way that is radically different from that of C++.</p></p>
<p><strong>Body:</strong>&nbsp;<div class="sect1" lang="en">
<div class="titlepage">
<h2><a name="d0e22" id="d0e22"></a></h2>
</div>
<p>Stroustrup, the designer of C++, has been at pains to emphasise
that C++ is not just C with an object-oriented extension but rather
a new multiparadigm language that happens to support objects;
indeed, recent developments in the language have been more in the
direction of generic types ('templates') rather than
object-orientation as traditionally conceived. The Standard
Template Library, which is now part of the Standard C++ Library,
also shows some influence from the functional programming style. In
pursuit of this goal, the author and the later standardisers of the
language have had no compunction in 'improving' on C by for
instance strengthening the type system and changing the namespace
rules, with the result that a standards-conforming C source is not
guaranteed to perform as the programmer expected after being passed
to a C++ compiler.</p>
<p>The designer of Objective-C Brad J. Cox, had other ideas. His
goal was to make available some of the facilities of the high-level
Smalltalk-80 programming environment to users of C, so as to
enhance productivity without taking away the advantages of
efficiency, versatility and portability that such a low-level
language can offer. The object-oriented part of Objective-C is
entirely orthogonal to its C-based component, so that a standard C
source is always a perfectly good Objective-C source. Cox's
problem, then, was how to extend C in such a way so as to enable
powerful and easy object-oriented programming without impinging on
the original syntax and semantics of the language. The solution he
found is to my mind extraordinarily elegant, though it does involve
syntactical conventions that seem quite strange to someone without
a Smalltalk background; as a result, it only takes an hour or two's
study and practice for a C programmer to learn enough to become
proficient at Objective-C.</p>
<p>In his book, <i class="citetitle">Object-Oriented Programming,
an Evolutionary Approach</i>, Cox addressed what he calls 'the
software crisis', namely the tendency of large IT projects to be
delivered late, to end up costing much more than their allocated
budget, not deliver the intended functionality, and indeed, to fail
entirely. Software development is contrasted unfavourably with
electronic engineering: software developers keep writing the code
over and over again with minor variations to suit the demands of
each individual system, while their hardware counterparts are able
to create new devices largely by slotting in and connecting
components that they have acquired from third parties and are thus
much more productive. If development could be largely reduced to
putting together systems from <span class="emphasis"><em>software
ICs</em></span> with minimal wiring in between, this would go a
long way to solving the software crisis, Cox argued. At the time,
he knew of only one development system which provided such
components at the IC level, and that was Smalltalk, but the use of
Smalltalk was limited by the fact that it required its own 'box' or
run-time environment to work, and being interpreted rather than
compiled, its performance was unspectacular on the computers of the
day. Much could be gained if one could program in C and yet make
use of libraries that are available to the Smalltalk
programmer.</p>
<p>Cox's company, the Stepstone Corporation, brought out an
Objective-C compiler in 1983 with a Smalltalk-like library called
ICPak(R). ICPak101provided foundation classes, including Object,
the root object, and data-structure classes like Sets,
Dictionaries, Arrays, Lists and Strings, while ICPak201 had classes
to build cross-platform graphical user interfaces; the coroutine
library TaskMaster was added later. Richard Stallman and others
developed open-source equivalents of the compiler, run-time system
and basic class library for the GNU project, starting in 1992.
However, arguably the most signigicant event in the history of the
language was its adoption in 1988 by NeXT Computer Corporation as
the development language of choice for their UNIX-based NexTStep
operating system running on their proprietary workstations. They
made some extensions to the language, such as Categories and
Protocols, and rather then use Stepstone's ICPak libraries, they
developed their own, called Foundation and AppKit. NeXT's
workstations, though they drew widespread admiration, did not sell
well, and so their development environment, now called OpenStep,
was ported to other architectures, as NeXT transformed itself into
a software company. OpenStep became popular with financial
institutions, scientists, and, so I am assured, US intelligence
agencies because it could be used to produce powerful applications
with a graphical front end in a remarkably short time; one of these
applications was the first World-Wide Web browser, written by Sir
Tim Berners-Lee at CERN in 1992. Unfortunately, support for
multi-platform OpenStep came to an end after NeXT was acquired by
Apple in 1996, but the concept still lives in the Cocoa development
frameworks on Apple's Mac OS. The open-source GNUstep project
provides libraries and tools to do OpenStep-style development on
non-Mac OS platforms.</p>
<p>Objective-C's fortunes have been very different from those of C
and C++, and, unlike them, it has never become a mainstream
development tool. It is beyond the scope of these articles to
speculate as to why this might have been so. (I do not believe Dr
Cox minds too much, as his idea of exploiting reusable software
components has been abundantly vindicated, from Visual Basic custom
controls to Python libraries; he has retained his enthusiasm for
Smalltalk-style languages and is now a member of the Ruby
community.) The closest thing to a standard is Apple's compiler and
frameworks, since the vast majority of Objective-C users work
either with these or with GNUstep. Subsequent articles will discuss
Objective-C as implemented by NeXT/Apple, and the code examples
will illustrate the use of the Foundation framework. I have not
tested the code on GNUstep but have reason to expect that it will
work there with little or no modification.</p>
</div>
<div class="sect1" lang="en">
<div class="titlepage">
<h2><a name="d0e42" id="d0e42"></a>Availability of
Objective-C Resources</h2>
</div>
<p>Apple's development tools, including their
compiler<sup>[<a name="d0e47" href="#ftn.d0e47" id=
"d0e47">1</a>]</sup>, can be downloaded free of charge from their
site. As far as I am aware, the original Objective-C compiler and
ICPak libraries produced by the Stepstone Corporation are no longer
commercially available. The open-source GNU Compiler Collection
(GCC) version 3.4 offers a compiler with facilities very similar to
Apple's. The Portable Object Compiler (POC) is in reality an
Objective-C front-end to various C compilers and is available free
from its author, Mr David Stes. Metrowerks CodeWarrior development
tools for Mac OS will interoperate with Apple's Interface Builder
GUI construction tool and include an Objective-C compiler that will
produce code that links with Apple's frameworks. IBM's Visual Age
C/C++ Advanced Edition for Mac OS X also has Objective-C
support.</p>
<p><span class="emphasis"><em>D A Thomas</em></span></p>
</div>
<div class="bibliography">
<div class="titlepage">
<h2><a name="d0e57" id="d0e57"></a>Bibliography and
References</h2>
</div>
<div class="bibliomixed">
<p class="bibliomixed">Anguish, Scott, Erik Buck and Donald
Yacktman, <span class="citetitle"><i class="citetitle">Cocoa
Programming</i></span>, SAMS, 2002</p>
</div>
<div class="bibliomixed">
<p class="bibliomixed">Apple Computer Inc., <span class=
"citetitle"><i class="citetitle">The Objective-C Programming
Language</i></span>, available online at <span class=
"bibliomisc"><a href=
"http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/"
target=
"_top">http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/</a></span></p>
</div>
<div class="bibliomixed">
<p class="bibliomixed">Apple Developer Connection <span class=
"bibliomisc"><a href="http://developer.apple.com/" target=
"_top">http://developer.apple.com/</a></span></p>
</div>
<div class="bibliomixed">
<p class="bibliomixed">Beam, Michael and James Duncan Davidson,
<span class="citetitle"><i class="citetitle">Cocoa in a
Nutshell</i></span>, O'Reilly, 2003</p>
</div>
<div class="bibliomixed">
<p class="bibliomixed">Budd, Timothy, <span class=
"citetitle"><i class="citetitle">Introduction to Object-Oriented
Programming</i></span>, 3rd ed., Addison-Wesley, 2001</p>
</div>
<div class="bibliomixed">
<p class="bibliomixed">Cox, Brad J. and Andrew J. Novibilski,
<span class="citetitle"><i class="citetitle">Object-Oriented
Programming, an Evolutionary Approach</i></span>, 2nd ed.,
Addison-Wesley, 1991</p>
</div>
<div class="bibliomixed">
<p class="bibliomixed">Cox, Brad, <span class="citetitle"><i class=
"citetitle">Planning the Software Revolution</i></span>, IEEE
Software Magazine, November 1990, available online at <span class=
"bibliomisc"><a href="http://www.virtualschool.edu/cox/pub/PSIR"
target=
"_top">http://www.virtualschool.edu/cox/pub/PSIR</a></span></p>
</div>
<div class="bibliomixed">
<p class="bibliomixed">Cox, Brad, <span class="citetitle"><i class=
"citetitle">TaskMaster</i></span> available online at <span class=
"bibliomisc"><a href=
"http://www.virtualschool.edu/cox/pub/TaskMaster/" target=
"_top">http://www.virtualschool.edu/cox/pub/TaskMaster/</a></span></p>
</div>
<div class="bibliomixed">
<p class="bibliomixed">Davidson, James Duncan and Apple Computer
Inc., <span class="citetitle"><i class="citetitle">Learning Cocoa
with Objective-C</i></span>, 2nd ed., O'Reilly, 2002</p>
</div>
<div class="bibliomixed">
<p class="bibliomixed">Duncan, Andrew M., <span class=
"citetitle"><i class="citetitle">Objective-C Pocket
Reference</i></span>, O'Reilly, 2002</p>
</div>
<div class="bibliomixed">
<p class="bibliomixed">GNU Compiler Collection <span class=
"bibliomisc"><a href="http://gcc.gnu.org" target=
"_top">http://gcc.gnu.org</a></span></p>
</div>
<div class="bibliomixed">
<p class="bibliomixed">GNU Objective C Class Library <span class=
"bibliomisc"><a href=
"http://www.cs.rochester.edu/u/mccallum/libobjects" target=
"_top">http://www.cs.rochester.edu/u/mccallum/libobjects</a></span>
and <span class="bibliomisc"><a href=
"http://theory.uwinnipeg.ca/gnu/libobjects/%20libobjects_toc.html"
target="_top">http://theory.uwinnipeg.ca/gnu/libobjects/
libobjects_toc.html</a></span></p>
</div>
<div class="bibliomixed">
<p class="bibliomixed">GNUstep <span class="bibliomisc"><a href=
"http://www.gnustep.org/" target=
"_top">http://www.gnustep.org/</a></span></p>
</div>
<div class="bibliomixed">
<p class="bibliomixed">Hillegass, Aaron, <span class=
"citetitle"><i class="citetitle">Cocoa Programming for Mac OS
X</i></span>, 2nd ed., Addison-Wesley, 2004</p>
</div>
<div class="bibliomixed">
<p class="bibliomixed">IBM Inc. <span class="bibliomisc"><a href=
"http://www-306.ibm.com/software/awdtools/vacpp/features/xlcpp-mac.html"
target=
"_top">http://www-306.ibm.com/software/awdtools/vacpp/features/xlcpp-mac.html</a></span></p>
</div>
<div class="bibliomixed">
<p class="bibliomixed">Mahoney, Michael and Simson Garfinkel,
<span class="citetitle"><i class="citetitle">Building Cocoa
Applications: A Step-by-Step Guide</i></span>, O'Reilly, 2003</p>
</div>
<div class="bibliomixed">
<p class="bibliomixed">Metrowerks Inc. <span class=
"bibliomisc"><a href=
"http://www.metrowerks.com/MW/Develop/Desktop/Macintosh/Professional/Mac9.htm"
target=
"_top">http://www.metrowerks.com/MW/Develop/Desktop/Macintosh/Professional/Mac9.htm</a></span></p>
</div>
<div class="bibliomixed">
<p class="bibliomixed">Objective-C FAQ <span class=
"bibliomisc"><a href=
"http://www.faqs.org/faqs/computerlang/Objective-C/faq/" target=
"_top">http://www.faqs.org/faqs/computerlang/Objective-C/faq/</a></span></p>
</div>
<div class="bibliomixed">
<p class="bibliomixed">Pinson, Lewis J. and Richard S. Wiener,
<span class="citetitle"><i class="citetitle">Objective-C:
Object-Oriented Programming Techniques</i></span> , Addison-Wesley,
1991</p>
</div>
<div class="bibliomixed">
<p class="bibliomixed">Portable Object Compiler <span class=
"bibliomisc"><a href="http://users.pandora.be/stes/compiler.html"
target=
"_top">http://users.pandora.be/stes/compiler.html</a></span></p>
</div>
</div>
<div class="footnotes"><br>
<hr class="c3" width="100">
<div class="footnote">
<p><sup>[<a name="ftn.d0e47" href="#d0e47" id=
"ftn.d0e47">1</a>]</sup> This compiler is a GCC derivative and also
supports a dialect called <span class=
"emphasis"><em>Objective-C++</em></span>, which allows mixing of
C++ and Objective-C source; this is meant to facilitate the porting
of legacy applications written in C++ to Cocoa.</p>
</div>
</div>
</p>
<p><strong>Notes:</strong>&nbsp;</p>
<p><em>More fields may be available via dynamicdata ..</em></p>
</div>
</channel>
</rss>
