You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by Berin Loritsch <bl...@apache.org> on 2001/08/16 18:18:37 UTC

Has anyone considered C++ Framework?

I know Avalon's charter says we have a Java Framework.
Avalon's Framework is very generic, and would easily be
converted to C++.  I would like to experiment with such
a beast--but was wondering if anyone else had any
feelings one way or the other with that.

---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org


Re: Has anyone considered C++ Framework?

Posted by Berin Loritsch <bl...@apache.org>.
I didn't have an immediate need.  Java does seem to have more
advantages in many areas.

Peter Donald wrote:
> 
> On Fri, 17 Aug 2001 02:18, Berin Loritsch wrote:
> > I know Avalon's charter says we have a Java Framework.
> > Avalon's Framework is very generic, and would easily be
> > converted to C++.  I would like to experiment with such
> > a beast--but was wondering if anyone else had any
> > feelings one way or the other with that.
> 
> Well I haven't considered doing it with Apache Avalon a lot of my previous
> work in this domain was C/C++ based. My history of framework + phoenix style
> apps is basically
> 
> 98     - *unnamed* module+kernel system (native C++ system)
> 98-99  - ACR System            (native C++ kernel, scriptable by java)
> 99     - My Avalon System      (native C++ kernel with java plugins)
> 00     - Telanon System        (java kernel with native C++ plugins)
> 00-01  - Apache Avalon System  (pure java)
> 
> You may notice a trend away from C++ above ;) The reason is that to write a
> comparable system you have to implement a lot of underlying support. In my
> case I had to be portable between linux/win which probably added to the
> burden.
> 
> First you need to find or implement a cross platform debugging library - this
> is almost essential. Basically this does stacktraces, debugger breaks,
> asserts, etc. However to achieve the same safety that I get for free in java
> my code will often something look like
> 
> void myClass::myMethod( int *pParam1, int param2 )
> {
>   guard(myClass::myMethod);
> 
>   assert( NULL != pParam1 );
>   assert( MemSys::isValidPointer( pParam1 ) );
> 
>   ...do work code here...
> 
>   unguard(myClass::myMethod);
> }
> 
> After that you need to write a decent memory subsystem that checks
> allocations. For every leaked allocation get a stack trace at allocating
> position. Most of my code was pre-STL stability/acceptance but if you adopt
> that you will also need to write your own allocators and possibly a decent
> garbage collector for small items.
> 
> After that you should implement a decent component system. Probably like COM.
> So instead of doing
> 
> if( component instanceof Configurable )
> {
>   (Configurable(component)).configure( ... );
> }
> 
> you would do
> 
> IConfigurable *pConfigurable =
>   (IConfigurable *)QUERY_INTERFACE( myComponent, IConfigurable );
> if( NULL != pConfigurable )
> {
>   pConfigurable->configure( ... );
> }
> 
> The remainder of work is creating registrys of one sort or another. These are
> simple if you work all your magic in statically bound apps. However as soon
> as you start using DLLs the issues become painful. Each interface needs to
> keep references to it's "parent" or "factory" and play the IncRef/DecRef
> game.
> 
> The advantages of C++ include;
> * superior GUI toolkits (either go native or QT for XP)
> * fast startup time
> * easy integration with existing products
> 
> The disadvantages of C++;
> * sooooooooooooo much more work
> * longer to develope even after you have the base
> * code becomes 90% defensive code 10% content
> 
> If you are interested I have a bunch of links for equivelent projects to what
> we are doing and pointers to some fundamental toolkits/runtimes. Just ping me
> and I will send em.
> 
> --
> Cheers,
> 
> Pete
> 
> *-----------------------------------------------------*
> * "Faced with the choice between changing one's mind, *
> * and proving that there is no need to do so - almost *
> * everyone gets busy on the proof."                   *
> *              - John Kenneth Galbraith               *
> *-----------------------------------------------------*
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: avalon-dev-help@jakarta.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org


Re: Has anyone considered C++ Framework?

Posted by Peter Donald <do...@apache.org>.
On Fri, 17 Aug 2001 02:18, Berin Loritsch wrote:
> I know Avalon's charter says we have a Java Framework.
> Avalon's Framework is very generic, and would easily be
> converted to C++.  I would like to experiment with such
> a beast--but was wondering if anyone else had any
> feelings one way or the other with that.

Well I haven't considered doing it with Apache Avalon a lot of my previous 
work in this domain was C/C++ based. My history of framework + phoenix style 
apps is basically

98     - *unnamed* module+kernel system (native C++ system)
98-99  - ACR System            (native C++ kernel, scriptable by java)
99     - My Avalon System      (native C++ kernel with java plugins)
00     - Telanon System        (java kernel with native C++ plugins)
00-01  - Apache Avalon System  (pure java)

You may notice a trend away from C++ above ;) The reason is that to write a 
comparable system you have to implement a lot of underlying support. In my 
case I had to be portable between linux/win which probably added to the 
burden.

First you need to find or implement a cross platform debugging library - this 
is almost essential. Basically this does stacktraces, debugger breaks, 
asserts, etc. However to achieve the same safety that I get for free in java 
my code will often something look like

void myClass::myMethod( int *pParam1, int param2 )
{
  guard(myClass::myMethod);

  assert( NULL != pParam1 );
  assert( MemSys::isValidPointer( pParam1 ) );

  ...do work code here...  

  unguard(myClass::myMethod);
}

After that you need to write a decent memory subsystem that checks 
allocations. For every leaked allocation get a stack trace at allocating 
position. Most of my code was pre-STL stability/acceptance but if you adopt 
that you will also need to write your own allocators and possibly a decent 
garbage collector for small items.

After that you should implement a decent component system. Probably like COM. 
So instead of doing

if( component instanceof Configurable )
{
  (Configurable(component)).configure( ... );
}

you would do

IConfigurable *pConfigurable = 
  (IConfigurable *)QUERY_INTERFACE( myComponent, IConfigurable );
if( NULL != pConfigurable )
{
  pConfigurable->configure( ... );
}

The remainder of work is creating registrys of one sort or another. These are 
simple if you work all your magic in statically bound apps. However as soon 
as you start using DLLs the issues become painful. Each interface needs to 
keep references to it's "parent" or "factory" and play the IncRef/DecRef 
game. 

The advantages of C++ include;
* superior GUI toolkits (either go native or QT for XP)
* fast startup time
* easy integration with existing products

The disadvantages of C++;
* sooooooooooooo much more work
* longer to develope even after you have the base
* code becomes 90% defensive code 10% content

If you are interested I have a bunch of links for equivelent projects to what 
we are doing and pointers to some fundamental toolkits/runtimes. Just ping me 
and I will send em.

-- 
Cheers,

Pete

*-----------------------------------------------------*
* "Faced with the choice between changing one's mind, *
* and proving that there is no need to do so - almost *
* everyone gets busy on the proof."                   *
*              - John Kenneth Galbraith               *
*-----------------------------------------------------*

---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org


Re: Has anyone considered C++ Framework?

Posted by giacomo <gi...@apache.org>.
On Thu, 16 Aug 2001, Berin Loritsch wrote:

> I know Avalon's charter says we have a Java Framework.
> Avalon's Framework is very generic, and would easily be
> converted to C++.  I would like to experiment with such
> a beast--but was wondering if anyone else had any
> feelings one way or the other with that.

I never was a C++ guy (mainly a C guru many years ago) but I can't think
of a Excalibur Component Management System realized in C++ (or at
least not that elegant as java can do)??

Giacomo

>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: avalon-dev-help@jakarta.apache.org
>
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org


Re: Has anyone considered C++ Framework?

Posted by Peter Donald <do...@apache.org>.
On Fri, 17 Aug 2001 19:18, Leo Sutic wrote:
> I have, but I don't know how we're going to do dynamic classloading. DLL /
> .so? 

Dynamic classloading is doable if you know the client interfaces before hand 
(like COM or normal CORBA). You just need to worry about all linking between 
libraries (sometimes you end up with highly delicate dll/.so dependency lists.

If you don't know interfaces before hand and want to do dynamic dispatching 
(ie find out methods available and then call them) then it as absolute PITA. 
I gave up on implementing that after about 8 days of agony ;) 

> Anyway, I use C++ for games development so maybe dynamic classloading
> isn't necessary.

Ever thought of doing games in avalon/java ? ;) I have - or at least the 
server part.

> But IMO what C++ needs is just a nice class library. We can deal with the
> components later, but what I want is a good toolkit similar to java.util.
> One that can handle object references properly (which stl doesn't - put one
> instance in two vectors and delete one vector: BAM dangling pointer.).

C++ is just too much damn work and there is too many competing "standards" 
none of which are interoperable and few of which are ever as complete as 
java. QT is nice though.

> So... Anyone considered a C# Framework?

Actually thought about it recently - a couple of days ago I did a bit of 
poking at C# - looks neat in parts and a cleaner runtime structure (Also no 
need for inner classes anymore - yea!). It seems to have inherited a lot of 
the cruft from C/C++ though ;( ... then again it would be kool to have 
several languages interoperate without jumping through loops.

The problem is that MSes version already has bunches of stuff not in 
specification apparently (or so saids their website). I suspect that for all 
intents and purposes it will still be a one vendor solution. There maybe a 
outside effort like Chillsofts ASP but I am not so sure.

Besides my main problems with java are scheduled to be all removed by 
tiger/jdk1.5 - yea!!!!! So it will depend on timing. If java opensources or 
gets to 1.5 before C# gains maturity then java wins - if not ...

-- 
Cheers,

Pete

*-----------------------------------------------------*
* "Faced with the choice between changing one's mind, *
* and proving that there is no need to do so - almost *
* everyone gets busy on the proof."                   *
*              - John Kenneth Galbraith               *
*-----------------------------------------------------*

---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org


RE: Has anyone considered C++ Framework?

Posted by Leo Sutic <le...@inspireinfrastructure.com>.
Berin,

I have, but I don't know how we're going to do dynamic classloading. DLL /
.so? Anyway, I use C++ for games development so maybe dynamic classloading
isn't necessary.

But IMO what C++ needs is just a nice class library. We can deal with the
components later, but what I want is a good toolkit similar to java.util.
One that can handle object references properly (which stl doesn't - put one
instance in two vectors and delete one vector: BAM dangling pointer.).

So... Anyone considered a C# Framework?

/LS


---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org