Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!tut.cis.ohio-state.edu!ucbvax!MJM.XYPLEX.COM!milan From: milan@MJM.XYPLEX.COM (Milan Merhar) Newsgroups: comp.lang.forth Subject: (none) Message-ID: <9105240406.AA06146@ucbvax.Berkeley.EDU> Date: 22 May 91 14:53:10 GMT Sender: daemon@ucbvax.BERKELEY.EDU Reply-To: Milan Merhar Organization: The Internet Lines: 51 's message of Wed, 22 May 91 13:43:54 GMT <9105221409.AA02362@xyplex.com> >>Ben Eaton asked "What is Object Oriented Programming ?" The two-bit answer is that in OOP the code to perform actions is tied to the data being manipulated. Trivial example: VARIABLE TURNIP ( plain old variable) TURNIP 0 ! ( initialize to zero) TURNIP @ 1 + TURNIP ! ( increment by one, non-object-oriented) VALUE TURNIP ( smart variable; returns value if "TO" = FALSE and stores value if "TO" = TRUE) 0 TO TURNIP ( initialize to zero) TURNIP 1 + TO TURNIP ( increment by one; Object-oriented) In the second case, the code isn't actually performing the store to the variable, but rather just setting a flag (by invoking the "TO"). When the variable name is invoked, it itself does the store. So what, you may say? Well, if you have a very complicated data structure, you might not want some other guy mucking it about. For example, in a record-locked database, it's essential that only one bit of code in the system actually does the "bit twiddle" needed to assign or free temporary data ownership. So, it makes sense to have that code in a single place, rather than allowing it to be duplicated throughout the code whererever the data structure is accessed. INHERITANCE is an OOP concept to describe the passing-along of access methods from a primitive data object to compound objects containing the primitive ones. (This is suspiciously similar to the way that defining words pass along their DOES> part to words they later create.) Various commercial OOP extensions to Forth have been made over the years, ranging from the smart-variables of MMS-FORTH to NEON (now called YERK, I believe) where most every Macintosh system resource was accessable as an object. Milan J. Merhar Internet: milan@eng.xyplex.com Xyplex Inc. Telephone: (508)264-9900 330 Codman Hill Rd. FAX: (508)264-9930 Boxborough, MA 01915 USA