Hello, Mike and Rez!
I have bought your book (4th ed.) recently, and it's great!
And I have some questions about source code organization.
I'm a web-developer and some C++ stuff little confuse me. One of the most confusing thisng for me is header files.
When we use header files as inteface for class it's OK. But then we add some typedefs, enums, global vars, #include s and other non-class stuff
and header become a horrible mess.
I'd read some articles describing diffecrent best-practices about using headers like blog.knatten.org/2012/11/30/ho…void-includes-in-headers/. And it seem reasonable.
But let's look at GCC4 code:
1. Actors. I supposed that every "package" in project is self-containing. But in Actor.h or ActorFactory.h I don't see any #include. If I try to take Actors pakage and add it to another project for exaple, it wouldn't complile at all, cause it depends on another pars of system AND (it scares me greatly) it depends implicitly! Is this normal practice or not?
2. Another thing is interfaces.h. This header contains tens of different interface classes and some contantns, typedefs and so on. I understand that it is simpler to include one header than bunch of headers but what if our engine will have not tens but hundreds of classes? interfaces.h wiil become some sort of God header (by analogy this God object).
3. Precompliled headers is good or evil? When should we use it? And it contains most of standard library includes, but this way leads to implicitly dependencies. Or it's OK?
And why some code contains in GameCodeStd.cpp but not in .h?
And two more questions:
1. Why folder, contains Process.h and other called "Mainloop"? I can't find connection.
2. I can't find where g_pApp instance creates.
I hope, you'll help me.
Regards.
I have bought your book (4th ed.) recently, and it's great!
And I have some questions about source code organization.
I'm a web-developer and some C++ stuff little confuse me. One of the most confusing thisng for me is header files.
When we use header files as inteface for class it's OK. But then we add some typedefs, enums, global vars, #include s and other non-class stuff
and header become a horrible mess.
I'd read some articles describing diffecrent best-practices about using headers like blog.knatten.org/2012/11/30/ho…void-includes-in-headers/. And it seem reasonable.
But let's look at GCC4 code:
1. Actors. I supposed that every "package" in project is self-containing. But in Actor.h or ActorFactory.h I don't see any #include. If I try to take Actors pakage and add it to another project for exaple, it wouldn't complile at all, cause it depends on another pars of system AND (it scares me greatly) it depends implicitly! Is this normal practice or not?
2. Another thing is interfaces.h. This header contains tens of different interface classes and some contantns, typedefs and so on. I understand that it is simpler to include one header than bunch of headers but what if our engine will have not tens but hundreds of classes? interfaces.h wiil become some sort of God header (by analogy this God object).
3. Precompliled headers is good or evil? When should we use it? And it contains most of standard library includes, but this way leads to implicitly dependencies. Or it's OK?
And why some code contains in GameCodeStd.cpp but not in .h?
And two more questions:
1. Why folder, contains Process.h and other called "Mainloop"? I can't find connection.
2. I can't find where g_pApp instance creates.
I hope, you'll help me.
Regards.
The post was edited 1 time, last by andjey ().