Python component model

sturlamolden sturlamolden at yahoo.no
Sun Nov 12 11:39:53 EST 2006


skip at pobox.com wrote:

> Having never used java or .NET I'm not sure what you're looking for.

There is a whole generation of computer users out there scared stiff of
using the keyboard. Soon, computers will not have a keyboard at all.
The trend is perhaps more pronounced among managers not writing code
themselves, but "taking decisions" about which tools to use.

The answer to these needs are so-called "RAD tools" like Borland
Delphi, Visual Basic, Visual C# .NET, and perhaps Java's NetBeans.
Instead of writing code, a "programmer" selects "components" from a
menu, drags the component over a "form" and then drops it onto the
"form". A form can e.g. be a web page, a GUI window or just an
invisible abstract container in case the program doesn't have a visual
interface. Components can be visual GUI widgets like buttons and
sliders, but also "invisible" objects like files and sockets. Instead
of creating a file by typing "open" one would "drag 'n drop" a "file
component" from a menu onto the form, and then type in the name in some
sort of "property menu" for the component. If one needs a tcp socket,
one don't type "s = socket(...)" in the code but select an socket from
a menu and drop it over a form.

In order to do this, a RAD tool need some sort of standardised
component model. Sure, it must be able to inspect the component, but
also interpret the methods and members that it finds. The RAD tool must
be able to inspect the model to find out what to "publish" in the
property menu, what event it generates, etc. Typical component
standards used for this is ActiveX (in Visual Basic), .NET in Visual
C#, VCL in Delphi, and JavaBeans in NetBeans. If you build a component
that does not follow the standard, the RAD tool can't use it. For
example in JavaBeans, every pair of method that looks like
"component.setSomething(...)" and "component.getSomething(...)" is
parsed by the RAD tool as the property "Something" and put into the
property meny for the component. The programmer can change the value of
this property by typing into the property menu.

The most extreme RAD tool is LabView, where no code is written at all,
not even event handlers which are still hand coded in the other RAD
tools. In labView, everything is "dragged and dropped", and the dropped
components are connected by "cables" just like a circuit board. There
are even "components" encapsulating for and while loops. If you need a
while loop, you drop a while loop onto the form. If you need a
subroutine, you drop a subroutine onto the form, etc. Nothing is typed.

Does Python need a standard component model like ActiveX, VCL, .NET or
JavaBeans?

First, there are GUI designer's for Python. These include GLADE, QT
Designer and wxGlade. We don't need a Python object model to support
GUI designers. Second, are we really that scared of writing code? Some
obviously are. Why is dropping a socket component preferred over typing
"socket"? Those that want LabView or Visual Basic knows where to find
it.

Python already has "properties". What Python don't have is "events",
but that can be easily implemented (and is implemented in all GUI
toolkits) e.g. using exceptions and references to functions. En event
can be raised by raising an exception. Perhaps we should define an
standard "event" interface just to shut them up? Then we have a
"component model".




More information about the Python-list mailing list