[futurebasic] Re: Fear and Loathing Guide

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : November 1997 : Group Archive : Group : All Groups

From: David Blache <microcsm@...>
Date: Fri, 28 Nov 97 00:49:48 -0600
Mel Patrick wrote:

>I did take a look at the Sun examples and I for one will be... driving a
>car...It made absolutely no sense whatsoever for the examples given. I sort
>of got what they were "pedalling" at, but I can still think of easier ways
>to do it.

I give up.

>I think, OOP got its base perhaps from the fact that developers could turn
>into code mills and churn out stuff in short order with their reusable
>objects. And when you need to make a living off programming that would be a
>considerable advantage. Note, I didn't say efficient nor compact code. Just
>lots of it.

I make a living programming.

>How about giving an example of what an object handler would look/work like?
>A simple one like a toolbar object. Doesn't even have to use real FB3
>commands, just pseudo codes. You don't even have to explain it, see if we
>can figure it out.

Ok.  Here's the simplest one I can think of.  Let's say you have a class 
defined for cShape like so:

BEGIN CLASS "cShape", ""
  DIM oRect AS Rect


To create a new object of this class:

myShape = NEWOBJECT(cShape)

To set the rect and tell your object to draw:

'direct manipulation of a property


'indirect manipulation of a property
myShape.oRect = theRect

Now suppose that you want to also have objects that do ovals as well.  
Rather than changing your cShape code which is already bug tested, and 
working fine as it is, you create a subclass of cShape, and override the 
Draw method, like so:

BEGIN CLASS "cOval","cShape"

Since cShape already has a rect, there is no need to DIM one in the 

METHOD Draw         'override

To override any method of the superclass, you just define the method in 
the new class.

Now you have two types of objects at your disposal - one that draws 
rectangles, and one that draws ovals.  But you didn't have to modify or 
even _touch_ the original source code for cShape - which means less 
chance for introducing bugs.  That's just _one_ of the benefits of OOP.

>So long as FB3 lets me program the way I want to (right or wrong), I'm
>certainly looking forward to it! If it forces one to abandon my free form
>approach it's not going to be "fun" anymore. And if its not fun, I won't be
>doing it.

Nobody ever said you would be forced to use OOP in FB^3.

|       David Blache - Developer       |
|   Staz Software, Inc - Stazologist   |
|        (tech@...)       |
|   Microcosm Software, Inc. - Owner   |
|        (microcsm@...)        |