lessons from Java, OOP

Richard Gaskin ambassador at fourthworld.com
Tue Nov 30 17:43:00 EST 2004


Ivers, Doug E wrote:
 > I'm finishing up my first semester of Java, and it has given
 > me a new perspective on programming.  I suspect that some OOP
 > concepts can be incorporated without changing the language but
 > through programming style.

Amen, brother.  So nice to hear that.  Most folks fond of OOP take a 
purist all-or-nothing approach, which is course really suggests that 
they would be happier with a different language altogether.  But there 
are indeed many stylistic/structural things a person can do to obtain 
many of the benefits of OOP.

Heck, look at the old Inside Mac volumes:  the way the various managers 
worked in Mac Classic was a good example of discrete, encapsulated 
functionality in which separate elements worked as black boxes, sending 
messages and data structures to each other according to their own API.

Theory aside, the practical benefits of OOP involve productivity, 
through ease of maintenance and reuse.  For all of the talk of portable 
C++ objects over the years, few have materialized and very few are 
cross-platform.  That is, unless you adopt an entire framework, like 
CodeWarrior's PowerPlant or Apple's XCode, but then you're moving past a 
portable object and are talking about a generalized application 
foundation, which is a much bigger thing.  Trying to reuse a single 
widget in C++ or Java often means pulling a long chain of superclasses 
along with it, so that what was described as a reusable object is really 
a large folder full of .c and .h files. ;)

With Transcript, there are many practices which can help facilitate 
those practical benefits.  While they may not satisfy OOP purists, such 
folks are probably happily using Java anyway so we can ignore them and 
get back to our own productivity.

Libraries are one useful way to deliver a collection of behaviors across 
multiple applications.  If you haven't read this you might find it a 
helpful starting point:

Extending the Runtime Revolution Message Path
An introduction to using Libraries, FrontScripts, and BackScripts
in Runtime Revolution's Transcript Programming Language
<http://www.fourthworld.com/embassy/articles/revolution_message_path.html>

Also check out getProp and setProp, as you'll find those can make short 
work of complex behaviors associated with the simple setting and getting 
of custom property values.

 > Let's see, what about inheritance?  There have been other threads on
 > this.  Certainly this exists in parts of Rev (stack->bg->card->group
 > scripts and properties).  It's up to the scriptor to take full
 > advantage of this, and maybe we could talk about best practices,
 > parentscripts, XOS, etc.  (BTW, have they decoupled textFont and
 > textSize inheritance yet?)

Yes to parentScripts!  Is there a Bugzilla request for that spec?

-- 
  Richard Gaskin
  Fourth World Media Corporation
  Developer of WebMerge: Publish any database on any Web site
  ___________________________________________________________
  Ambassador at FourthWorld.com       http://www.FourthWorld.com



More information about the use-livecode mailing list