Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language


 
 
Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

C++ Programming

Can there be problems when a class is multiply inherited from 1000s of classes


Hi All,

We have done a object oriented design for a system which will create a
class multiply inherited by around 1000 small and medium sized
classes.

I would be greatful if you can help me with the following:
Can this create any problems with GNU g++ compilation, linking etc?
What would be the impact to the performance of the system?
Anything else we have to consider?

Thanks
Janaka

Janaka Perera wrote:
> Hi All,

> We have done a object oriented design for a system which will create a
> class multiply inherited by around 1000 small and medium sized
> classes.

> I would be greatful if you can help me with the following:
> Can this create any problems with GNU g++ compilation, linking etc?
> What would be the impact to the performance of the system?
> Anything else we have to consider?

> Thanks
> Janaka

'class is multiply inherited from 1000s of classes'

'class multiply inherited by around 1000 small and medium sized classes'

Which one do you mean? It makes quite a big difference.

john

Sorry.. it should be around 1000 classes, not 1000s
On 28 Maj, 11:06, Janaka Perera <janaka@gmail.com> wrote:

>>> Janaka Perera wrote:
>>> We have done a object oriented design for a system which will create a
>>> class multiply inherited by around 1000 small and medium sized
>>> classes.
>>> I would be greatful if you can help me with the following:
>>> Can this create any problems with GNU g++ compilation, linking etc?
>>> What would be the impact to the performance of the system?
>>> Anything else we have to consider?
>>'class is multiply inherited from 1000s of classes'
>>'class multiply inherited by around 1000 small and medium sized classes'
>>Which one do you mean? It makes quite a big difference.
> Sorry.. it should be around 1000 classes, not 1000s

First of all, please quote the text you are replying to (fixed above).

What John asked was if the object you are talking about will inherit
from 1000 classes or if 1000 different classes will inherit from the
object.

In the later case there should be no problems. In the first case there
might be some problems with the compiler (though I doubt it) and there
might be an impact on performance. However that would probably be the
least of your problem since trying to maintain such a monster would be
a nightmare.

--
Erik Wikstrm

On 28 May, 10:06, Janaka Perera <janaka@gmail.com> wrote:

> Sorry.. it should be around 1000 classes, not 1000s

*What* should be 1000 not 1000s? You didn't quote any context and your
message makes no sense on its own. Please see

http://cfaj.freeshell.org/google/

Thanks. Context added back in - but look how much manual cutting and
pasting I've had to do to put the context back in. Don't expect me
(or, I imagine, most other people) to do that for you very often.

[Janaka Perera]
[Subject: Can there be problems when a class is multiply inherited
from 1000s of classes]
We have done a object oriented design for a system which will create a
class multiply inherited by around 1000 small and medium sized
classes.

I would be greatful if you can help me with the following:
Can this create any problems with GNU g++ compilation, linking etc?
What would be the impact to the performance of the system?
Anything else we have to consider?

[John Harrison]
'class is multiply inherited from 1000s of classes'

'class multiply inherited by around 1000 small and medium sized
classes'

Which one do you mean? It makes quite a big difference.

[Janaka Perera]
Sorry.. it should be around 1000 classes, not 1000s

[Me]
I don't think John Harrison is worried about the difference between
the number of classes being 1000 or 1000s. The distinction between one
thousand and many thousands is unlikely to be significant. One
thousand may well be quite enough to introduce problems if there are
going to be any. The important distinction is (my emphasis):

'class is multiply inherited *FROM* 1000s of classes'

'class multiply inherited *BY* around 1000 small and medium sized
classes'

Which is it?

Gavin Deane

On May 28, 9:47 am, Janaka Perera <janaka@gmail.com> wrote:

> Hi All,

> We have done a object oriented design for a system which will create a
> class multiply inherited by around 1000 small and medium sized
> classes.

> I would be greatful if you can help me with the following:
> Can this create any problems with GNU g++ compilation, linking etc?
> What would be the impact to the performance of the system?
> Anything else we have to consider?

> Thanks
> Janaka

Although there are some cases, when its intended, both might be a sign
of novice design/design misuse.
None of those should pose any significant compilation problems under
gnu. But, the class inheriting from 1k others will compile slowly,
very slowly imho.

regards,
pawel

On May 28, 2:40 pm, Gavin Deane <deane_ga@hotmail.com> wrote:

It's FROM 1000s of classes..
Sorry for the inconvenience caused. I am new to this posting thing.
Actually this is my first post. Thanks a lot for the instructions.
I'll refer http://cfaj.freeshell.org/google/
On May 28, 2:31 pm, Erik Wikstrm <eri@student.chalmers.se wrote:
 On 28 Maj, 11:06, Janaka Perera <janaka@gmail.com wrote:

[Janaka Perera]
We have done a object oriented design for a system which will create a
class multiply inherited by around 1000 small and medium sized
classes.<snip>

[Erik Wikstrm]
What John asked was if the object you are talking about will inherit
from 1000 classes or if 1000 different classes will inherit from the
object.

In the later case there should be no problems. In the first case there
might be some problems with the compiler (though I doubt it) and there
might be an impact on performance. However that would probably be the
least of your problem since trying to maintain such a monster would be
a nightmare.

[Me]

It's the first case. If there is a performance impact, it definitely
going to be a problem for us. But maintaining the code will not be a
much problem since we are developing a code generator which will
generate code using a meta-base.

Thanks
Janaka

Right, that is a strange design. I have no experience with similar
designs, nor I suspect do many people. I think you are just going to
have to try it and find out.

Is this some kind of template meta-programming exercise?

If find it hard to believe that you've written

class Strange : public <huge list of 1000 classes here>
{

};

but with TMP you could achieve something similar. My guess would be that
you can expect problems, as you should examine carefully the benefits of
such a design. But as I said I have no experience.

john

On 28 Maj, 13:05, Janaka Perera <janaka@gmail.com> wrote:

If one might ask, how did you come up with that design. I can't think
of any good reason to inherit from so many classes. You can't possibly
have that many interfaces so you are most probably inheriting to get
functionality, but if you use generation why not just put it straight
in the class?

--
Erik Wikstrm

On May 28, 4:57 pm, Erik Wikstrm <eri@student.chalmers.se> wrote:

To make it better understandable, we are talking about a shared
library in Solaris platform generated by a code generator using Meta -
information.
The reasons behind the design are
1.      We can't generate the whole code set in to a single file because
GNU g++ cannot compile it even using a server with 16GB RAM in it for
the reason that code is too large.
2.      We have a set of common functions in the API which every program
uses this library wants. There are also another set of functionalities
requires by other modules (executables/libraries) depending its
requirement (lets say classes that represents entities). Some classes
are shared by multiple modules. By using this design we can inherit
the classes that we want and create similar interfaces(header files)
for each module which uses the API and still use the same shared
library since the symbols are same( We need all the interfaces
inherited only for a one module which uses this module)
3.      If we include the whole header information in to a single file
without separating and including only necessary ones, compilation of
the modules which uses this API take hours to compile.(true, it will
take a lot of time for this module to compile but it's a one time
compilation)
On May 28, 11:47 am, Janaka Perera <janaka@gmail.com> wrote:

> Hi All,

> We have done a object oriented design for a system which will create a
> class multiply inherited by around 1000 small and medium sized
> classes.

> I would be greatful if you can help me with the following:
> Can this create any problems with GNU g++ compilation, linking etc?
> What would be the impact to the performance of the system?
> Anything else we have to consider?

> Thanks
> Janaka

Depends on "how does it multiply inherited"(there is virtual
inheritance, for example) and "what is classes it multiply inherited
form"(have they base classes too? have they vtable(any virtual
functions, declared in those or those bases)?) and some other things...
On May 28, 2:02 pm, Janaka Perera <janaka@gmail.com> wrote:

I did a POC, created a class multiply inherited from 1500 classes.
Everything is successfully working without a problem.
Wanted let you all know. Thanks for all who replied.
Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc