home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / objectiv / 465 < prev    next >
Encoding:
Internet Message Format  |  1992-08-18  |  10.7 KB

  1. Path: sparky!uunet!wupost!bcm!aio!shirley
  2. From: shirley@fdr.jsc.nasa.gov (Bill Shirley [CSC])
  3. Newsgroups: comp.lang.objective-c
  4. Subject: FAQ - Objective-C Answers to Frequently Asked Questions
  5. Keywords: FAQ
  6. Message-ID: <1992Aug18.092119@fdr.jsc.nasa.gov>
  7. Date: 18 Aug 1992 14:21:19 GMT
  8. Sender: shirley@fdr (Bill Shirley [CSC])
  9. Organization: Software Technology Branch - NASA/JSC
  10. Lines: 311
  11. Originator: shirley@fdr
  12.  
  13.  
  14.                 Answers to
  15.             FREQUENTLY ASKED QUESTIONS
  16.                 concerning    
  17.                    Objective-C
  18.             (last updated July 17, 1992)
  19.  
  20.  
  21.  
  22. Clarification: I have used the word `ObjC' for `Objective-C', the proper
  23.     and official name for the language discussed within, throughout
  24.     this file.  Is is simply a time and space saver.
  25.  
  26.  
  27.  
  28. Questions & Answers
  29. ~~~~~~~~~~~~~~~~~~~
  30. Q1. What is Objective-C?
  31.  
  32.  A1. An object oriented (OO) computer language based on the C language and
  33.     influenced by SmallTalk.  It was designed by The Stepstone Corp. (and
  34.     is a Trademark of Stepstone) and includes many of the OO things that
  35.     make Smalltalk the "language to learn OOP with", and many of the
  36.     great things about C that make it highly portable and very optimizable.
  37.     It is NOT C++.
  38.  
  39.  
  40. Q2. Who makes an Objective-C compiler, what does it cost, how do I order?
  41.  
  42.  A2.1    The Stepstone Corporation
  43.     (203) 426-1875 - (800) BUY-OBJEct voice / (203) 270-0106 fax
  44.     75 Glen Road
  45.     Sandy Hook, CT 06482
  46.  
  47.     compilers and runtime
  48.  
  49.         IBM RISC System/6000 w/ AIX
  50.         Sun 3, 4, SPARCstations w/ SunOS
  51.         HP9000/300,400,700,800 w/ HP-UX
  52.         DEC Stations w/ ULTRIX
  53.         Data General AViiON w/ DG/UX
  54.         SCO UNIX SYS V
  55.         PS/2 w/ AIX or OS/2
  56.         PC-AT w/ MS-DOS
  57.         VAX w/ VMS
  58.           /    MIPS
  59.      new <    NeXT
  60.           \    Macs with MPW (Mac Programmers Workshop)
  61.  
  62.     class libraries available for a subset of the above
  63.  
  64.  A2.2    NeXT, Inc.
  65.  
  66.         Comes bundled with the extended OS release.
  67.         (NeXTSTEP 3.0 - $295 on CD ROM)
  68.         (NeXTSTEP '486 - $995)
  69.  
  70.  A2.3    GNU Project
  71.  
  72.         Freely available
  73.         GNU Experimental Tape 
  74.         GCC 2 (the GNU C/C++/ObjC Compiler with many new
  75.             features - doesn't include runtime - yet)
  76.         prep.ai.mit.edu (18.71.0.38) pub/gnu/gcc-2.0.tar.Z
  77.         (See sites at end of file)
  78.  
  79.  
  80.  
  81.  
  82. Q3. Does GNU's gcc `do' Objective-C?
  83.  
  84.  A3. Didn't you read the above answer: It does as of release 2.0,
  85.     but does not initially include the runtime system required
  86.     to use ObjC.
  87.     Reports are: On the NeXT, which has a runtime system, programs
  88.     compiled with gcc 2.0 (as available on the net) run when linked
  89.     to NeXT's runtime library.
  90.     Hopefully, someone is working on a runtime system for all of us.
  91.     (Will it be NeXT compliant or Stepstone compliant, or maybe
  92.     a combination of both? or maybe even better... [*****] )
  93.     (What kind of gnu restrictions will it have?  One like gcc,
  94.     or one like bison?  i.e. Will any program using the GNU ObjC
  95.     runtime environment have to be freely available? [****] )
  96.  
  97.  
  98. Q4. What books concerning Objective-C are available?
  99.  
  100.  A4.1
  101.     Object Oriented Programming: An Evolutionary Approach
  102.     Author:    Brad J. Cox (, Andrew J. Novobilski second edition)
  103.     ISBN#:    0-201-10393-1
  104.     ISBN#:    0-201-54834-8
  105.     two editions
  106.  
  107.  A4.2
  108.     Objective-C: Object Oriented Programming Techniques
  109.     Authors:    Lewis J. Pinson, Richard S. Wiener
  110.     Publisher:    Addison-Wesley, 1991
  111.     ISBN#:        0-201-50828-1
  112.     Abstract:    Includes many examples, discusses both Stepstone's
  113.             and NeXT's versions of Objective-C, and the (minor)
  114.             differences between the two.
  115.  
  116.  A4.3
  117.     An Introduction to Object-Oriented Programming
  118.     Author:        Timothy Budd
  119.     Publisher:    Addison-Wesley
  120.     ISBN#:        0-201-54709-0
  121.     Abstract:    An intro to the topic of OOP, as well as a comparison
  122.             of C++, Objective-C, Smalltalk, and Object Pascal
  123.  
  124.  
  125. Q5. What is the difference between Objective-C and C?
  126.  
  127.  A5. ObjC is a superset of the ANSI C standard.  It is an object oriented 
  128.     language that has extensions similar to Smalltalk applied to C.
  129.     It includes a few more key words and constructs.
  130.     New Keywords:
  131.      @interface
  132.      @implementation
  133.      @public
  134.      @selector
  135.     [****************]
  136.  
  137.  
  138. Q6. What is the difference between Objective C and C++?
  139.  
  140.  A6. C++ has operator overloading, ObjC doesn't.  Some consider this
  141.     to be 'syntactic sugar', and it is, but it can be a quite
  142.     handy bit of syntactic sugar.
  143.      C++ has multiple inheritance, ObjC doesn't.  There is much
  144.     debate over the desirability and value of this.  There are
  145.     several ways to 'get arround' this in ObjC.
  146.      The run-time binding mechanism differ quite a bit in their functionality.
  147.     (Details?? [***])
  148.  
  149.  
  150. Q7. What is the difference between NeXT's, Stepstone's and GNU's
  151.     versions of Objective C?
  152.  
  153.  A7. NeXT has defined and distributed its own class libraries, which
  154.     are very integral to the NeXTstep environment.
  155.      NeXT also extended Stepstones definition of the language to include
  156.     new constructs, such as protocols, which are touted to deal with
  157.     some aspects of multiple inheritance.
  158.      NeXT's implementation does *not* support static binding, Stepstone's
  159.     does, and GNU's (does?/doesn't?).
  160.      Stepstone has a standard set of class libraries that work across
  161.     all supported machines.
  162.      GNU gcc (C/C++/ObjC) does not have a runtime system for
  163.     resolving message passing, or include any classes. (yet)
  164.      The Object (root) class of NeXT's and Stepstone's are slightly
  165.     different; there are several Object methods and runtime C
  166.     functions that are not part of Stepstone's.
  167.      NeXT (and GNU?) supports Categories, Stepstone doesn't.
  168.      NeXT has a native language debugger, Stepstone and GNU don't.
  169.      NeXT (3.0) supports Protocols and forward declarations of classes,
  170.     Stepstone (does/n't?), GNU (does/n't?).
  171.      [****************]
  172.  
  173.  
  174. Q8. What are some of the common problems of the language and how can
  175.     I work around them? (forward declarations of classes, class variables)
  176.  
  177.  A8.1 There is no inate multiple inheritance (of course some see this as a
  178.     benefit).
  179.       To get around it you can create a compound class ( a class with
  180.     instance variables that are /id/s of other objects.  They can
  181.     specifically redirect messages to any combination of the
  182.     objects they are compounded of. (It isn't *that* much of a 
  183.     hassle and you have direct control over the inheritance
  184.     logistics)
  185.       Protocols address this to some extent. [***]
  186.       [** how does Delegation fit in here? **]
  187.  
  188.  A8.2 ObjC has no class variables.
  189.       You can get around this by defining a static variable in the .m
  190.     file, and defining access methods for it.  This is actually a
  191.     more desireable way of designing a class hierarchy, becuase it
  192.     allows subclasses shouldn't access superclass storage (this would
  193.     cause the subclass to break if the superclass was reimplemented),
  194.     and allows the subclass to override the storage (if the classes
  195.     access all their own variables via methods)
  196.  
  197.  A8.3 problem X [****************]
  198.  
  199.  
  200. Q9. What class libraries are available for Objective C?
  201.  
  202.  A9.  See the related FAQ file -  _Objective C - a matter of Class_
  203.  
  204.  
  205. Q10.  Are there any FTP sites with Objectice C code?  Where?
  206.  
  207.  A10.  Yes.
  208.     There are NeXT related sites at
  209.      sonata.cc.purdue.edu
  210.      cs.orst.edu
  211.     And non-NeXT related sites at
  212.      ?
  213.  
  214.  
  215. Q11.  I'm an emacs junkie.  Are there any .el files somewhere to support
  216.     Objective-C?
  217.  
  218.  A11.  Yes.  Try sonata.cc.purdue.edu /pub/next/misc/objc.tar.Z
  219.  
  220.  
  221. Q12.  So show me a program, a simple example.
  222.  
  223.  A12.  See the companion file "A S[ia]mple Objective-C Program" or get
  224.     all of the code from music.sie.arizona.edu:pub/ObjC/Sample.tar.Z
  225.  
  226.  
  227. Q13.  What are Protocols?
  228.  
  229.  A13.  Protocols are an addition to (currently only NeXT's 3.0+ version of)
  230.     ObjC that allow you to organize related methods into groups
  231.     that form high-level behaviors.  This gives library builders
  232.     a tool to identify sets of standard protocols, independent of
  233.     the class hierarchy.  Protocols provide language support for
  234.     the reuse of design, whereas classes support the reuse of code.
  235.     Well designed protocols can help users of an application
  236.     framework when learning or designing new classes.  Here is a
  237.     simple protocol definition for archiving objects:
  238.  
  239.         @protocol Archiving
  240.         - read:(NXTypedStream *)stream;
  241.         - write:(NXTypedStream *)stream;
  242.         @end
  243.  
  244.     Once defined, protocols can be referenced in a class interface
  245.     as follows:
  246.  
  247.         // MyClass inherits from Object and
  248.         // conforms to the Archiving protocol
  249.         @interface MyClass : Object <Archiving>
  250.         @end
  251.  
  252.     Unlike copying methods to/from other class interfaces, any
  253.     incompatible change made to the protocol will immediately be
  254.     recognized by the compiler (the next time the class is
  255.     compiled).  Protocols also provide better type checking without
  256.     compromising the flexibility of untyped, dynamically bound objects.
  257.  
  258.         MyClass *obj1 = [MyClass new];
  259.  
  260.         // legal, obj2 conforms to the Archiving protocol.
  261.         id <Archiving> obj2 = obj1;
  262.  
  263.         // illegal, obj1 does not conform to the TargetAction
  264.         // protocol.
  265.         id <TargetAction> obj3 = obj1;
  266.  
  267.  
  268.         
  269.  
  270.  
  271.  
  272. Terminology
  273. ~~~~~~~~~~~
  274. C:        A programming language.
  275. FTP:        File Transfer Protocol.
  276. GNU:        A project making freely available software.
  277. message:    A "call" to an implementation of a method
  278. method:        An implementation of an ObjC "function"
  279. factory method:    A method which creates a new instance of a class
  280. class method:    A method which acts on or with the whole of a class rather
  281.         than an instance of a class.  Often used interchangably 
  282.         with _factory method_, but there is a subtle difference.
  283. instance method:A method witch acts on or with a specific instance of a
  284.         class.
  285. OOP:        Object Oriented Programming
  286. ObjC:        An abbreviation of Objective-C
  287. Object:        The base {class} of Objective-C.
  288. Objective-C:    An Object Oriented programming language extended from
  289.           the C language, and what this whole file is about.
  290.         It is also a registered trademark of The Stepstone
  291.         Corporation.
  292.  
  293.  
  294.  
  295.  
  296. ---
  297. All [**********] designate incompleteness of the FAQ.  If you have any
  298. questions, corrections, comment, suggestions pass them along.  I can be
  299. reached directly at <shirley@fdr.jsc.nasa.gov> or you can post to
  300. the news group (comp.lang.objective-c).
  301.  
  302. Disclaimer:  I am not related to any company or group mentioned above.
  303. This file was created to provide information to interested people, and
  304. not advertizing for anything listed above.
  305.  
  306. gnu ftp site, prep.ai.mit.edu:pub/gnu/etc/DISTRIB
  307.  (prep UK/Europe mirror) src.doc.ic.ac.uk (???)
  308.  (prep Netherlands mirror) ftp.win.tue.nl (131.155.70.100)
  309.  (prep UK mirror) src.doc.ic.ac.uk (146.169.3.7)
  310.  (prep Japan mirror) utsun.s.u-tokyo.ac.jp (133.11.11.11)
  311.  (Australian site) archie.au (IP number may change)
  312.  
  313.  
  314. Thanks to Glen Ditchfield, Bill Edney, Nik Gervae, Jacob Gore,
  315.  Robert D. La Ferla, Ken Lerman, Dan LaLiberte, Phillip Musumeci,
  316.  Gregor N. Purdy, Christopher Rath, and Paul J. Sanchez for input
  317.  ranging from one sentence to volumes.
  318. This information is what YOU make it.
  319. ---
  320. -- 
  321. Bill Shirley        | Not only are the Republicans coming to town, but the
  322. shirley@fdr.jsc.nasa.gov| local Fun Police are cracking down on victimless 
  323.             | crime.  Houston has become a scary place to live.
  324.