Visual Basic - Python compare

Roman Yakovenko romany at
Tue Apr 29 09:59:59 CEST 2003

    Hi. I wrote Python - VB compare. 
Preface for compare: we have client - server application, 
where server is written in C++ and client consist of 2 part. Part 1 is
wrapper between C++ classes 
to COM objects. Part 2 is GUI written in VB 6.0. Now we want to migrate
from VB 6.0 to VB Net.
The only reason for migration is: VB Net modern environment. ( The
program is going to be fully rewritten. 
We have to do it, so we may choose a different development environment
). I decided to propose 
python instead of VB. For this purpose I wrote small VB-Python compare.
There are a few question 
in the compare. Also any comments are welcome. If I missed something
please report me. Also I would like
To hear about problems that exist( I believe they do ) for writing
application where server side is written in C++
and client side in python.


        Why Python is better then Visual Basic for me.

    Python is fully object oriented language (like C++). There are a few
futures in this language: generators, clear syntax.

    XML RPC lib. XML-RPC is a "Remote Procedure Call" method that uses
passed via HTTP as a transport. With it, a client can call methods with 
parameters on a remote server (the server is named by a URI) and get
structured data. This module supports writing XML-RPC client code; it
all the details of translating between conformable Python objects and
XML on the 
wire. Also client side and server side can be written in different
languages. It 
means that there is no need in wrapper of C++ classes for the client

Question: XML RPC lib use url in order to establish connection. In my
case I have 
a little bit different requests: client - written in python, server
written in C++, 
connection made over TCP IP. Also I'd like to see secured connection.

    Boost.Python lib - C++ library which enables seamless
between C++ and the Python. It means there are no more complicated
    struct World
        World(std::string msg): msg(msg) {} // added constructor
        void set(std::string msg) { this->msg = msg; }
        std::string greet() { return msg; }
        std::string msg;
    enum choice { red, blue };

        In order to expose this class to VB I need:
    1. To use VC++ wizard. There are 3 files this wizard adds, also it
touches idl, 
        resource and registration files. 
    2. After this I need to describe the functionality of this class. It
means every call I need to redirect to 
       internal object. The problems I meet here are: different data
types definitions. VB True == -1, C++ true == 1. 
       It means that if you don't insert right value then boolean test
in VB may faild. BSTR may be NullString, EmptyString. 
       During  redirection of calls it is possible to make a few bugs
(I suppose that copy + paste make a good job in this area). 
    3. VC++ idl compiler can't work with C++ build-in enums and
constants. It means that almost every const in the system 
       is duplicated. There were a few bugs in this area also. Developer
changed original enum value in C++ code without 
       changing it in idl. 
    4. There is no easy way to path errors to the calling object. If you
want to pass errors you need some global variable to keep 
        error description their. The only allowed error description is:
error id,  error message, help file. It is an ugly way to treat errors.

        In order to expose this class to python I need to write only
        class_<World>("World", init<std::string>())
            .def(init<double, double>())
            .def("greet", &World::greet)
            .def("set", &World::set);
            .value("red", red)
            .value("blue", blue);
    Export\import from (to) file is simpler - there is no more code that

translate object to string and string to object - python can handle it
There were a few bugs in this area also, like forgotten property or
    Every file is executable file - it means you may write testing code
within file. 
Also there is a "UNI Test" for python. 

    GUI - there are 5 or more different gui libraries for python: 
-Tk( build-in )
-Qt (may be the best advertising of this library is KDE)
-GTK (may be the best advertising of this library is GNOME)
    Python could work with COM.

    IDE - there are a lot of them, some of them are free and good. Also
there is 
environment for Visual Net.

    There are also a few installers for python that makes executable
(exe) from 
sources. If you do it you don't have to worry weather python installed
on user 
computer or not.

Thanks for your attention. Any comments are apriciated and welcom.


More information about the Python-list mailing list