Jonah Thomas wrote:
> I've consistently avoided OO. I've tried to avoid problems that are
> complicated enough for OO to be valuable.
That's similar to trying to avoid using create/does>. Yes, there is
some extra complexity. But in some, not all, problems it is very
worthwhile.
-snip-
> OO is a mature technology that's mostly failed. The promise was that it
> would work. The reality is that it can be made to work with a lot of
> inspired hard work, but by default it doesn't particularly get results.
No. Think of OOP as create/does> on steroids. For example:
\ **First let's use create/does>
0 constant to>
1 constant from>
\ assumes 4 byte cell
: CDobject \ create/does> object factory
create 4 allot
does>
>r
IF ( from>) r> @[EMAIL PROTECTED]
ELSE ( to>) r> ! THEN ;
CDobject x
ok
45 to> x
ok
from> x .
45 ok
\ **Now let's use objects
:class OOobject \ OO object factory
4 bytes data
:m to: ( n -- ) self ! ;m
:m from: ( -- n) self @[EMAIL PROTECTED]
;m
;class
OOobject y
ok
45 to: y
ok
from: y .
45 ok
Of course with objects we can do a lot more than create/does>. I won't
not go into all of that here.
Has create/does> failed? I don't think so.
What if someone had hyped create/does> as the "Magic Silver Bullet" that
would solve all of your programming problems? You and I both know that
is not true. But does that mean create/does> has no value and we should
now abandon it? I don't think so.
Same thing for OOP. It may well have been overly hyped. But if so,
that should have no bearing on a decision to use it today. For some
problems it is *very* useful. For other problems not.
I think that if any "over hyping" of OOP has occurred it was because
suddenly it gave users of languages other than Forth the power of a
create/does> construct. I can see where people using other languages
would become excited over suddenly having the power (and more) of
Forth's create/does>.
But again, create/does> is quite limited in what it can do compared to a
proper object programming extension. So I believe that in Forth there
is a place for both create/does> and OOP.
-Doug
> We're probably ripe for something new. Something that claims to fulfill
> the promises that OO made and failed at.
> People won't agree to go back
> to the bad old days before they had OO, when there was no way to get a
> good result except hard work and inspired improvisation. They'll want
> something new that looks even better.
>
> I'd like to predict what the new thing will be like. It has to explain
> why OO has failed. It must promise to succeed at those things and more.
> Do you have links to the clearest explanations about OO's promises? What
> was it exactly that project managers needed and didn't have, that they
> hoped OO would give them?


|