best way to implement dynamic design

Discussion in 'C++' started by jonathan, Aug 29, 2003.

  1. jonathan

    jonathan Guest

    hey all,

    I'd like to implement an application that is truly dynamic: the
    components are not only just known at runtime, but also the components
    are unknown at runtime: ie: some don't even ship with the application.

    When a new component is shipped, the application 'picks up' that
    component and drops it in to the interface (in this case a GUI button
    as well as an associated class with that gui buttion). The application
    then uses the code in that interface to customize the behaviour of the
    application.

    Sort of like a 'skin' - except instead of having external data
    customizing the look of an application, there is external code
    customizing the *behaviour* of an application. However, since there

    Also, I need this to be cross-platform so, if there is no internal
    solution to this problem (the language doesn't support it) I'm
    interested in solutions that work on MacOSX/Linux/Win. I'm using
    wxWindows as my GUI platform.

    Or - should I maybe go with wxPython instead?

    jon
    jonathan, Aug 29, 2003
    #1
    1. Advertising

  2. (jonathan) wrote in message news:<>...

    This is an ISO C++ newsgroup, which doesn't even support GUIs, let
    alone loading arbitrary code at run-time (which some systems do not
    support).

    Then again, I'm not sure if there *is* a forum for this, so I'll start
    rambling so that you have some stuff to look up, at least.

    Anyone interested only in ISO C++ should probably stop reading now. :)

    > I'd like to implement an application that is truly dynamic: the
    > components are not only just known at runtime, but also the components
    > are unknown at runtime: ie: some don't even ship with the application.


    There must be, at least, a published interface/protocol so that you
    can ask the module what it can do and how to get it to do that.

    > Also, I need this to be cross-platform so, if there is no internal
    > solution to this problem (the language doesn't support it) I'm
    > interested in solutions that work on MacOSX/Linux/Win. I'm using
    > wxWindows as my GUI platform.


    Java apps use a feature called "reflection" for this purpose; but C++
    doesn't support anything like reflection (yet), so this has to be done
    by the programmer. Further, ISO C++ doesn't support dynamic modules,
    since not all systems support dynamic modules (ISO C++ is designed to
    run on just about any computer). So, you're left with OS-specific
    technologies.

    On Windows, COM and ActiveX are commonly used for this sort of thing.
    On Linux, GNOME uses Bonobo, which is a CORBA-based technology; and
    KDE uses KParts.

    I have no idea about MacOS X. :) Maybe, if you're lucky, one of the
    Linux technologies is also portable there.

    You might be able to use one or more of these technologies, perhaps
    using different ones on different platforms. Alternatively, it may be
    possible to write your own component architecture, but such will be
    non-trivial (for a place to start, look up LoadLibrary on Windows and
    dlopen on Linux [and possibly MacOS X via its FreeBSD heritage]).

    > Or - should I maybe go with wxPython instead?


    That sounds like the easiest way to do it, if that'll work for you. It
    certainly makes sense to use a dynamic language like Python to add
    dynamic behavior to a program.

    In fact, you might be able to write the program and modules in C++ and
    use Python to glue them together -- those wacky people at boost.org
    have a C++/Python reflection library, which may be of some use here.
    It officially supports Windows and Linux, but it may be portable to
    MacOS X if someone (you?) makes it happen.

    I have no idea if any of this is relevant to you, but hopefully it'll
    lead you in the right direction.

    Good luck!

    - Shane
    Shane Beasley, Aug 29, 2003
    #2
    1. Advertising

  3. jonathan wrote:
    >>Did you have a C++ question?
    >>
    >>Please read the Welcome message:
    >>
    >>http://www.slack.net/~shiva/welcome.txt
    >>
    >>-Kevin

    >
    >
    > Fair enough, but I maintain that what I asked in fact *was* a C++
    > question - it dealt with the limitations of the language. The extra
    > stuff (about guis, etc.) is just context.
    >


    I don't really see a question about C++. The whole thing with drop-in
    components can't possibly be done in standard C++ since there's no
    concept of dynamic linking or anything like that. Unless maybe the
    components were interpreted by the main app somehow.

    -Kevin
    --
    My email address is valid, but changes periodically.
    To contact me please use the address from a recent posting.
    Kevin Goodsell, Aug 30, 2003
    #3
  4. jonathan

    Rolf Magnus Guest

    jonathan wrote:

    >> Did you have a C++ question?
    >>
    >> Please read the Welcome message:
    >>
    >> http://www.slack.net/~shiva/welcome.txt
    >>
    >> -Kevin

    >
    > Fair enough, but I maintain that what I asked in fact *was* a C++
    > question - it dealt with the limitations of the language. The extra
    > stuff (about guis, etc.) is just context.


    In this case, the answer is "what you want cannot be done".
    Rolf Magnus, Aug 30, 2003
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Steve C. Orr, MCSD

    Re: Best way to implement ASP Session variables

    Steve C. Orr, MCSD, Jul 16, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    359
    Steve C. Orr, MCSD
    Jul 16, 2003
  2. Kevin Spencer

    Re: BEST WAY TO implement shopping basket

    Kevin Spencer, Aug 5, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    386
    Kevin Spencer
    Aug 5, 2003
  3. David
    Replies:
    1
    Views:
    314
    Steve C. Orr [MVP, MCSD]
    Jun 3, 2004
  4. =?Utf-8?B?V2ViTWF0cml4?=
    Replies:
    3
    Views:
    4,209
    Joe Fallon
    Dec 9, 2004
  5. roygon
    Replies:
    10
    Views:
    541
    William Buchanan
    Apr 7, 2006
Loading...

Share This Page