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