[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sc-dev] Re: cross-platform gui wrappers - draft



On 1/13/06, Till Bovermann <tboverma@xxxxxxxxxxxxxxxxxxxxxxxx> wrote:
> 1. build a gloabl GUIFactory
> 2. since you get a valid SCButton out of the factroy you simply have to
>         search-replace for new instanciation of GUI-elements.

#2 is where I have the problem with that scheme: "since you get a
valid SCButton out of the factory." If the factory returns an instance
of a base GUI class, then it effectively destroys cross-platform
compatibility.

All of my code is written in terms of SCButton (for example) methods.
If someone on Linux configures the factory to return SCUM objects,
many of the method calls in my code will be invalid.

What I wanted to work toward is an object that would have a consistent
interface in all platforms, but where the implementation of each
wrapped method would "translate" the desired behavior expressed by the
method call into the actual call(s) needed to make the base object
exhibit the correct behavior.

Suppose, for example, that HypotheticalButton doesn't implement
.visible_(bool) but instead has .show and .hide. In the hypothetical
framework, the button wrapper would implement:

+ GUIButton {
	*viewSourceClass { ^HypotheticalButton }  // or support for factory constructor
	visible_ { |bool = true|
		if(bool) { view.show } { view.hide }
	}
}

... and the user doesn't have to be concerned about the base implementation.

Sorry if I'm being stubborn about this, but factories only solve the
constructor problem. In itself, it does nothing to address the problem
of what you can do with the object after you have it. For me, how the
object gets created is not important, but its interface for future
interaction is critical.

Maybe we're talking about two different problems?

hjh

--
James Harkins /// dewdrop world
jamshark70@xxxxxxxxxxxxxxxxx
http://www.dewdrop-world.net

"Come said the Muse,
Sing me a song no poet has yet chanted,
Sing me the universal."  -- Whitman