home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / sys / mac / programm / 12919 < prev    next >
Encoding:
Internet Message Format  |  1992-07-23  |  3.3 KB

  1. Path: sparky!uunet!stanford.edu!rutgers!dziuxsolim.rutgers.edu!gandalf.rutgers.edu!rgonzal
  2. From: rgonzal@gandalf.rutgers.edu (Ralph Gonzalez)
  3. Newsgroups: comp.sys.mac.programmer
  4. Subject: Re: Hypercard & OOP
  5. Message-ID: <Jul.23.10.25.06.1992.16061@gandalf.rutgers.edu>
  6. Date: 23 Jul 92 14:25:06 GMT
  7. References: <1992Jul23.074204.6270@reed.edu>
  8. Organization: Rutgers Univ., New Brunswick, N.J.
  9. Lines: 54
  10.  
  11. sharvy@reed.edu (V Headshape) writes:
  12.  
  13. >I recently read a book on object-oriented programming (which I have
  14. >never tried) , and was struck by the correspondences to hyperCard.  It
  15. >seems like backgrounds are analogous to abstract classes in OOP, while
  16. >cards function as specific instances of a class.  So, for instance,
  17. >you could define generally an object (say, a house) in a background script,
  18. >and then the cards of that background would be particular instances of that
  19. >object, which would "inherit" the general characteristics defined at the
  20. >background level; the card script would then define the particular
  21. >properties of the particular object that the card represented.
  22.  
  23. Dan Shafer discusses the connection between OOP and HyperCard in his
  24. "HyperTalk Programming" book (Hayden Books, 1988).  It is probably 
  25. incorrect to say that a card is an instance of a background, and it
  26. is also incorrect to say that an object "inherits" properties from its
  27. class definition. (Inheritance works between one class and another.  An
  28. object is an instance of a class -- the class desciribes its type.)  Rather,
  29. there are 5 classes in HyperCard:  stacks, backgrounds, cards, buttons,
  30. and fields.  You can define objects of these types only, and you can't 
  31. define new classes as you can in a true OOP language. 
  32.  
  33. >Unfortunately, backgrounds cannot contain other backgrounds, and cards cannot
  34. >contain other cards, so the inheritance is limited to single level, which
  35. >leaves us with a rather toy-like version of true OOP.  I hope future versions
  36. >of hyperCard will develop the OOP potential of hyperCard, or that some
  37. >implementation of OOP for the Mac in the user-friendly, GUI, spirit of
  38. >hyperCard will be developed.  Seems like an exciting area.
  39.  
  40. There's no inheritance going on because you can't define new classes.  The
  41. fact that information from the background object shows through the card
  42. object does not mean that the background "contains" the card.  Notice
  43. that backgrounds can send messages to cards and vice versa equally.
  44.  
  45. I agree that the above limitations disqualify HyperCard from being a true
  46. OOP language.  However, the intent of HyperCard is actually to provide
  47. a visual programming environment.  What is nice is that it implements
  48. the overall event loop of a Mac program for you -- it automatically
  49. sends the "mousedown" message to the button you click on.  You just
  50. script the handler for this message.
  51.  
  52. My ideal language (since I loathe having to write full-blown Mac
  53. programs via the ToolBox) would be like HyperCard only with the
  54. ability to define your own classes, some of which could be derived
  55. from the existing background, card, etc ones.  It would come with
  56. more existing classes to implement pop-up menus, etc.  It would
  57. be compilable and fast.  How about it, Apple!!??
  58.  
  59. -Ralph
  60. rgonzal@elbereth.rutgers.edu
  61. -- 
  62. Ralph Gonzalez, Computer Science, Rutgers Univ., Camden, NJ
  63. Phone: (609) 757-6122; Internet: rgonzal@elbereth.rutgers.edu
  64. --
  65.