[Jprogramming] extend a class
Oleg Kobchenko
olegykj at yahoo.com
Sat Mar 18 06:02:43 HKT 2006
Raul removes one obstacle in the way of new_name_
to distinuish whether to call create by
what is commonly known as default contructor and distructor.
It also further ensures a principle common in many "more
truly" OO languages (unlike C++), that every object derives
from one common ancestor. In J's case it's locale 'z'.
There has been a pattern occurring previously
which called for creation of ad hoc lightweight
objects without the need to declare create and
destroy. This approach provides such possbility.
As for COCREATOR, it's only use is registered in the
the input package as the object holding a callback
on input completion.
However, as we look at a more substantial and
recent package, the grid, it was realized there
that the above callback lacks flexible separation
and instead a locale is accepted as an argument.
This approach is more robust and echoed in common
successful OO parterns such as Delegate and Listener,
where such objects are of independent arbitrary
classes not constrained by place of invokation.
The opposit practice of callbacks embeded in host form,
as used in VB and default .NET wizzards, are lacking effective
reuse: you are forced in every form to define the same
callbacks over and over again.
Also note that the callback patterns occur much
rarer than overall OO usage, but the COCREATOR
is created every time and just sits there idle.
--- "Miller, Raul D" <rdmiller at usatoday.com> wrote:
> new_z_=:3 :0
> o=. cocreate''
> ((,copath)coname'') copath o
> create__o y
> o
> )
> create_z_=: ]
> destroy_z_=: coerase at coname
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
More information about the Programming
mailing list