@DeerBear: Thank you for your explanation. I never heard of proxy methods before. I did a quick google and found a pattern named 'proxy pattern' which reads like what you wrote. Is this the same? Then this wouldn't be a native oop-functionality but a pattern like the observer pattern?
We are just beginning with patterns at the evening school, the observer being the first one, so please forgive me my ignorance :sign0104:
But for a project I would like to start with b4a instead of pure Java+SDK the observer pattern would fit perfectly into my needs.
@Erel: Are you mixing the Subject-Class or ConcreteSubject-Class with the Observer-Class? Where is the update()-Method in the Observer-Class?
As I understood the Observer-Pattern, the benefit is that the data stays in the ConcreteSubject and it notifies all attached observers when the state has changed. Or maybe I don't understand your code fully....?
Proxy is another pattern
Patterns are not ready-to-use recipes, they are ways of doing things.
Thus, there is no such thing as a good or bad implementation, but
there are more or less fit-for-purpose implementations.
To put it in another way, they are a way of solving a problem, but
that does not mean my implementation is worse than Erel's one or the
other way around. They are different as they use a different
approach and can be used best in different contexts.
I tend to be more philosophical about it

and thus decouple the
actual implementation code from what it should be
doing(the famous black box you might have read about somewhere

).
And yeah, it's true, as soon as you start using a pattern, you find
that you also use many more as a result of one
Some patterns you will want to have a peek at:
- Observer
- Proxy
- Facade
- Decorator
- Builder
- Command
Some of these we use in basic4android programming already,
although they do not surface as such.
Observer is used in events, for example, where
Decorator is used in the GUI(you have a surface and
decorate it with views).
And lots, lots more...
Regards,
A