using RADs in object-oriented way

Serge Boiko boiko at demogr.mpg.de
Wed May 21 12:10:08 EDT 2003


Hi, there,
I have a question regarding the usage of IDE/RAD tools with Python, but the
problem might be more general and equally can be applied to any
language (see Allen Holub's notes on IDE/RADs for Java:
http://www.javaworld.com/javaworld/jw-07-1999/jw-07-toolbox.html). 

When I use IDE/RAD I can easily create a GUI for my
application. Initially this GUI may consist of the standard components
provided by my IDE of choice. Usually I don't edit the code created by IDE
directly.  Instead I subclass the container class (i.e. the
application skeleton) and fill it with the contents and functionality
I want.  This gives me an important flexibility: I don't have to
change my code if I modified a file created by the RAD tool. Put it
another way: any cosmetic changes of my application don't affect the
functional part, these parts live in separate modules.

This approach works fine if I use *STANDARD* components. But what if
instead of plain standard button presented by the class StandardButton
I want to use a button of the class MyButton derived from
StandardButton and my RAD doesn't provide facilities to add custom
widgets written in Python? Surely, I could remove an instance of the
StandardButton from the container widget and replace it with an
instance of MyButton (again in the module that contains my
functionality and is not generated by the RAD). This approach is not
applicable to every situation, however. For complex layouts it may
cause unpredictable results. An alternative solution is to extend
functionality of the StandardButton dynamically adding/overriding
methods of StandardButton at runtime. See recipe 5.12 in the Python
Cookbook. It works if we need to modify our base class functionality
only slightly.

More general approach would be to use some refactoring techniques but
it implies that my IDE supports them. By the way is there any IDE that
can do that?

So my question is: how to deal with such a situation in an
object-oriented and reusable way, to separate RAD generated code for
manually coded stuff? 

If these words are too abstract I could give a simple Python example.

Many thanks and looking forward to hearing from you, Python gurus!
-Serge






More information about the Python-list mailing list