    <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/journals/793</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>


        <h2>Journal Articles</h2>


<div class="xar-mod-head"><span class="xar-mod-title">CVu Journal Vol 17, #2 - Apr 2005 + Programming Topics</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/journals/">All</a>

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

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

                     &gt;                         <a href="https://members.accu.org/index.php/journals/c97/">172</a>
                    (12)
<br />

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

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

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

                                            <a href="https://members.accu.org/index.php/journals/c97-65/">Any of these categories</a>

                    -                        <a href="https://members.accu.org/index.php/journals/c97+65/">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 April 2005 13:16:11 +01:00 or Sun, 03 April 2005 13:16:11 +01:00</p>
<p><strong>Summary:</strong>&nbsp;<h3>Part 5 - The Philosophy Behind
Objective-C</h3></p>
<p><strong>Body:</strong>&nbsp;<div class="section" lang="en">
<div class="titlepage">
<h2><a name="d0e22" id="d0e22"></a></h2>
</div>
<p>As mentioned in Part 1, it was Cox's idea to apply the
principles of Smalltalk to a lower-level language like C, thus
producing a useful hybrid which combined the advantages of both.
Polymorphism is implemented by late binding and is not dependent on
inheritance, as it is permitted to send any message to any object.
This gives the developer the maximum flexibility and enables
techniques such as delegation and notification, which are very
important in the construction of complex graphical user interfaces.
These techniques are very difficult to implement in C++, as the
compiler needs to know at compile time about all the member
functions that are going to be called on an object. Objective-C
programmers tend to find C++ very restrictive in this regard, and
they typically say that they are having to fight against the
language instead of being able to use it as a tool. In fact, I must
admit to having experienced this feeling myself. Supporters of C++,
on the other hand, say that having the compiler do the checking for
you eliminates at an early stage a common class of errors. The fact
remains, however, that certain problems are very difficult to solve
in pure C++, and vendors like Trolltech (who supply the Qt
application development framework) and Microsoft provide some quite
elaborate mechanisms in order to get around this.</p>
<p>Another area where the message-passing model of Objective-C
shines is distributed objects; with NeXT/Apple's PDO invoking a
method belonging to an object in another thread, address space, or
even a remote host differs little from invoking one in a local
object..</p>
<p>It has been said that C++ excels at solving closed-world
problems, while Objective-C's realm is an open world. Anguish et
al. write:</p>
<div class="blockquote">
<blockquote class="blockquote">
<p><span class="bold"><b>Closed-World Applications</b></span></p>
<p>The engine compartment of an automobile is analogous to
closed-world applications. It is desirable to know in advance every
component that will be inside the engine compartment and how they
will fit together. Engines are carefully designed and their design
is seldom modified after they leave the factory. Any variation in
the connections between engine components is probably a
manufacturing error. Languages such as C++ and to a lesser extent
Java provide language-level features that are well-suited to
solving closed-world problems. The static strong typing used by C++
and Java enables the compiler to verify that all components fit
together as planned at the cost of making variation, redesign, and
modification of existing applications more difficult. Some
applications require the verifiability of static strong typing and
can overcome the reduction in flexibility. Some programmers are
just more comfortable solving closed-world style problems and might
never be satisfied with Cocoa because it is designed to solve
open-world problems.</p>
<p><span class="bold"><b>Open-World Applications</b></span></p>
<p>The passenger compartment of an automobile is analogous to
open-world applications. Any constraints on the type or number of
people and things that can be placed in the passenger compartment
detract from the utility of the automobile. Some constraints are
inevitable, but the designer of a passenger compartment must strive
for maximum flexibility. The price of that flexibility is that the
designer cannot anticipate everything that might be put in the
passenger compartment. The designer must work with incomplete
information. Objective-C provides language-level support for
solving open-world problems. Objective-C objects can operate with
anonymous objects in different applications. It is possible to send
messages to objects even though the receiver might not understand
the message. It is possible to add behaviors to existing compiled
objects without recompiling them. The flexibility provided by
Objective-C aids the development and life-cycle modification of
most desktop applications, but the cost is that the compiler cannot
always verify that the components fit together. In some cases,
errors that might have been caught by a compiler with a different
language cannot be caught until an Objective-C application is
running.</p>
<p>Most graphical user interfaces are examples of open-world
applications. Restrictions on the type and number of graphical
components available reduce the utility of user interfaces.
Sometimes it is necessary to create new user interface components
that were not anticipated by the original designers and still be
able to integrate the new components with the old components.
Plug-ins and context menus are other examples of open-world
applications.</p>
<p>It is certainly possible to create open-world applications with
static strongly typed languages, but it is more difficult. It is
also possible to use strong static typing with Objective-C and gain
many of the benefits at the cost of flexibility. Cocoa and
Objective-C emphasize flexibility at the expense of compile time
verifiability. Much of the increased programmer productivity
attributed to using Cocoa results from Objective-C's flexibility.
(Anguish, S., op. cit. pp. 25-26)</p>
</blockquote>
</div>
<p>My first introduction to C++ was something of a disappointment.
To be sure, I was greatly impressed by the power of the 'template'
facility to operate with arbitrary types, though it did not seem as
elegant as the strong generic typing of SML and Haskell. I expected
C++ to come packaged with general-purpose and GUI class es in the
same way as Smalltalk, and all I got was <tt class=
"classname">iostreams</tt>! The position is a little better today,
as the standard C++ library now incorporates the Standard Template
Library, a very versatile basic set of algorithms and data
structures, yet I still have the impression that people who work in
C++ 'cut their own code' for the most part rather than make the
maximum use of code written by others.</p>
<p>I hope to have convinced the reader that Objective-C is very
simple in terms of both its syntax and its concepts; much like
Java, it eschews 'frills' like operator overloading and multiple
inheritance. It has no 'templates' either, which are perhaps the
source of the best and the worst of C++. However, the APIs
associated with Objective-C, for example those of Apple's Cocoa,
tend to have a very steep learning curve.</p>
<p>As the programming language of choice for new Macintosh
applications, Objective-C would seem to have a future at least as
secure as that of its main platform. In the wider world of object
computing, however, I perceive a trend away from low-level hybrids
like Objective-C and C++ towards managed object environments like
those of Java and the Microsoft Common Language Runtime on the one
hand and scripting languages like Perl, Python and Ruby on the
other. There are several reasons for this. First, languages in the
C family allow the programmer access to raw, unchecked pointers,
which, while often efficient, can also lead to application crashes
and buffer overruns. The difficulty of providing reliable automatic
garbage collection for these languages can also cause crashes (from
deallocating unallocated memory) and memory leaks. The Cocoa
frameworks use partly manual and partly automated reference
counting, which is better than leaving memory management completely
to the programmer, but inappropriate use of <tt class=
"literal">-retain</tt> and <tt class="literal">-release</tt> can
still result in crashes and memory leaks, and of course, there is
always the possibility of the retain count never reaching zero
because of circular references; in addition, the book-keeping
overhead involved with reference counting can be extremely severe
where a large number of objects is inserted into and taken out of
container objects. Object programming seems to me to demand
automatic memory management, something which is possible in C++ and
Objective-C only under controlled circumstances, like the 'safe
mode' of Microsoft Visual C++ .NET. As computers become ever
faster, the undoubted machine efficiency of Objective-C and C++ is
perceived as less of an advantage relative to the interpreted, thus
slower, but also safer, easier and more flexible, scripting
languages.</p>
</div>
</p>
<p><strong>Notes:</strong>&nbsp;</p>
<p><em>More fields may be available via dynamicdata ..</em></p>
</div>
</channel>
</rss>
