[Gambas-user] Gambas bug?

Fabián Flores Vadell fabianfloresvadell at ...626...
Sat Feb 11 15:29:49 CET 2012


2012/2/11 Benoît Minisini <gambas at ...1...>

> Le 11/02/2012 00:33, Fabián Flores Vadell a écrit :
> >
> > That problem could be described as "How to add methods from a helper
> object
> > without have to rewrite a wrapper for each method (with just a call
> within)
> > in the host class?".
> >
>
> Why don't you want to write wrappers? Is it just because it is boring?
>

Oh. Well, this is a very important reason. When I say "boring", I mean
distracting. Yes, when you get bored, you get distracted. When is needed to
do a task like this, what you are doing is get down the level of
abstraction of your thoughts (when I do this, my brain is complaining).

In fact this is one of the benefits of the OOP. The software is implemented
in the same terms from the problema domain, and one outcome is the
possibility to avoid jumping from an abstract level of reasoning (of the
domain) to a minor level (of the solution). So keep an high level of
abstraction when you write the code is a great advantage in productivity.

But, there's other very important reason (very close related). The code is
written one time, rewrited a few times, but is readed hundred times,
perhaps. So, a code more concise (but not least expressive), and as
consequence easily to understand, is more easily to test and to modify. So
it helps a lot to increase the programmer productivity.

So, I think that Gambas could have a feature to do this much more easily. A
method, in gb maybe, to do something like this:

'MyClass

$Collaborator1 AS HelperClass1
$Collaborator2 AS HelperClass2

'Then:

AddToInterface($Collaborator1.AMethod, $Collaborator1.AProperty,
$Collaborator2.AMethod, $Collaborator2.AProperty)


and voilà, this methods are now accesible directly from MyClass instances.

But, perhaps, could be easy enough to do this just using some existing
features of Gambas, and convey it as a design pattern.

I trying to intercept the calls to the methods, using the _unknown special
method, because  the calls would be simplified. If it works, The remaining
issue would be how to simplify passing arguments.



More information about the User mailing list