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

J

Janaka Perera

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
 
J

John Harrison

Janaka said:
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
 
?

=?iso-8859-1?q?Erik_Wikstr=F6m?=

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.
 
G

Gavin Deane

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
 
P

pawel.kunio

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
 
J

Janaka Perera

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

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/
 
J

Janaka Perera

On May 28, 2:31 pm, Erik Wikström <[email protected] wrote:
On 28 Maj, 11:06, Janaka Perera <[email protected] 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 Wikström]
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
 
J

John Harrison

Janaka said:
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

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/

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
 
?

=?iso-8859-1?q?Erik_Wikstr=F6m?=

On May 28, 2:31 pm, Erik Wikström <[email protected] wrote:
On 28 Maj, 11:06, Janaka Perera <[email protected] 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 Wikström]
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.

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?
 
J

Janaka Perera

On May 28, 2:31 pm, Erik Wikström <[email protected] wrote:
On 28 Maj, 11:06, Janaka Perera <[email protected] 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 Wikström]
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.

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.

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?



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)
 
A

archimed7592

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...
 
J

Janaka Perera

On May 28, 2:31 pm, Erik Wikström <[email protected] wrote:
On 28 Maj, 11:06, Janaka Perera <[email protected] 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 Wikström]
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.
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?

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)

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,015
Latest member
AmbrosePal

Latest Threads

Top