Skip to main content

large code projects, recomended books/ links?

  • Have the visuals for the particle system and the collision objects loading and saving in the scene.

    image is scene with sphere tree rendered, and several hundred particles in a line, and textures. (wanted to see the performance hit of…

  • just finished the scene database sorted camera query (put in camera, get depth sorted visual objects to render which are inside the camera sphere and fustrum) other fun involved improving the stablity of the barrel distortion math in the vertex…

  • well, missed a week (was going to do weekly updates of progress) this was due to travel, sickness, and most of the work being non-visual.

    do have a world system (or scene database) loading and saving, this required support of loading and…

  • this week's update has limited visual improvment, have been playing with emulating barrel distortion in the vertex shader (slight radial scale on vertex)
    the intent is that with a more detailed world the effect should be more noticable,…

  • wow, barely getting 20hours a week to work on this so progress is slowwwww (>_<)

    finishing up first pass on the renderer (including refactor of generic data store for geometry to pass to openGl to turn into VertexBufferObjects)

  • nothing that fancy to show&tell, just openGl rendering in a window, some winGUI debug text on top, some lights, boxes, a display list unit sphere, and a arbitary piece of geometry called out as a plane with a texture on it. some of the things…

Submitted by davidcoen on

just a quick style query~ don't have much of a background in software eng. so was wondering if there are some recomendations on resources to help teach how to manage large code systems. (book recomendations?)

noticed what i am working on is up to 74files of code, and have just been doing the headers like

//===
#ifndef GEOM_H
#define GEOM_H
typedef class geombase GeomBase;
typedef class geometry Geometry;
typedef class geomskin GeomSkin;

#include "pos.h"
.
. // includes for all the types in the classes bellow
.
#include "dynamic_manager.h"

class geombase{
Collision *p_col;
.
. // class reference follows
.
};

#endif
//======= end file

doing (typedef)(includes)(class def) seems to work ok, but when i want external objects inside the class/struct in the header, having big probles with linking to try and get it to work (have a bit too much couplling of my data structs i guess, but for example, geometry objects have a possition object, and wanted pos objects to have a pointer to a geom object (geom has heirachy info) and with all the linking, can eventually get it to work, but add another embeded object to another class or change header order and this method seems to fall down real quick?

is there a better way? or just decrease code couplling....

Submitted by Jacana on Wed, 26/11/03 - 5:53 PMPermalink

I was told Code Complete is a good Software Eng book :) I have ordered it but have not got it in yet. It was written by an MS guy.

Precompiled headers would save you from having to include your classes all over the place - instead you could just do it in one place!

Submitted by Zaph on Wed, 26/11/03 - 7:38 PMPermalink

quote:Originally posted by Jacana

I was told Code Complete is a good Software Eng book :) I have ordered it but have not got it in yet. It was written by an MS guy.

"Code Complete" should be required reading for all developers!
http://www.stevemcconnell.com/

"Writing Solid Code" is another great book to read
http://www.microsoft.com/mspress/uk/books/book108.htm
but I thought there was meant to be a newer edition than that one (1994)

Submitted by CombatWombat on Thu, 27/11/03 - 12:13 AMPermalink

quote:Originally posted by davidcoen

doing (typedef)(includes)(class def) seems to work ok, but when i want external objects inside the class/struct in the header, having big probles with linking to try and get it to work (have a bit too much couplling of my data structs i guess, but for example, geometry objects have a possition object, and wanted pos objects to have a pointer to a geom object (geom has heirachy info) and with all the linking, can eventually get it to work, but add another embeded object to another class or change header order and this method seems to fall down real quick?

is there a better way? or just decrease code couplling....

Hi david, it's been 5 yrs or so since I read "Large-scale C++ Software Design" by Lakos, but I seem to remember that this was quite relevant to this topic. I don't remember any particular rocket-science in the book (but I'd also make this comment about most of the C++ books out there anyway) but definately worth a read.

Just a quick piece of terminology before I jargon myself to death below - "typedef class geombase GeomBase" is known as a forward declaration of geombase. I'd usually skip the step of doing the typedef - and just forward declare my classes with "class GeomBase;" - this has the advantage that you don't need to know what class actually implements GeomBase in your other headers.

A couple of rules I use:

* When designing a class, prefer data members that are pointers or references where it's clean to do so (you'll only need the forward declaration if you do this)
* Only inline very basic functions in your class declaration that don't require you to bring in extra header files
* Every include file should fulfil its own needs for definitions (eg if it needs the full declartion of FooClass from foo.hxx then ensure that the include file includes foo.hxx) - you should get a clean compile if you passed the header through a compiler by itself

This breaks down a bit with using the STL (one of the hassles with C++ and large-scale development is how you're not able to forward declare templated classes) - so you just have to pull the STL headers in rather than foward declaring them.

Just another quick note on terminology - linking is the step where you grab the output object files from the compiler and roll them into an executable file. When you're saying problems with linking most programmers will understand this as problems with undefined symbols, but I think you're only talking about compilation problems here.

I agree precompiled headers are useful, but you do limit your portability, and lose some of your ability to break the source code up into modules. Where these things aren't important to you, precompiled headers are your friends :)

Cheers,

Mark/CW

PS the mod's I'd suggest to your code:

[code]
//===
#ifndef GEOM_H
#define GEOM_H

class GeomBase;
class Geometry;
class GeomSkin;
class Collision;

#include "pos.h"
.
. // includes for all the types in the classes bellow
.
#include "dynamic_manager.h"

class GeomBase{
Collision *p_col;
.
. // class reference follows
.
};

#endif
[/code]

Submitted by davidcoen on Thu, 27/11/03 - 8:49 PMPermalink

Thankyou for the recomandations, will have to case up those books, now to get back to finishing the particle system :)

Submitted by Kezza on Wed, 17/12/03 - 8:01 AMPermalink

quote:Originally posted by Jacana

I was told Code Complete is a good Software Eng book :) I have ordered it but have not got it in yet. It was written by an MS guy.

Precompiled headers would save you from having to include your classes all over the place - instead you could just do it in one place!

a software eng book written by an ms guy... i can't imagine how that would be a good thing.

also watch out for precompiled headers, they often get kidna big... and can force your compiler over the stack limit (easy to fix but annoying).

Submitted by davidcoen on Thu, 18/12/03 - 11:48 AMPermalink

actually 'code complete' is quite good (and evil, reading a code style book halfway through a big project is not a good idea)

just spent the last 10 hours implementing my IK system. note to self, when getting bored, implement small fun stuff, have been giggling to myself as the person drops to the ground in a large cloud of dust (also added objects being able to release particles when being collided with) at least that is working

also just purchased a copy of 'visual C++.net' and lost quite a bit of time reformating computer and finding the build setting i need to get it not rebuild the entire project on each change (hmmn, nortan anti virus can get upset when you start playing hatchet in the registry)

Posted by davidcoen on

just a quick style query~ don't have much of a background in software eng. so was wondering if there are some recomendations on resources to help teach how to manage large code systems. (book recomendations?)

noticed what i am working on is up to 74files of code, and have just been doing the headers like

//===
#ifndef GEOM_H
#define GEOM_H
typedef class geombase GeomBase;
typedef class geometry Geometry;
typedef class geomskin GeomSkin;

#include "pos.h"
.
. // includes for all the types in the classes bellow
.
#include "dynamic_manager.h"

class geombase{
Collision *p_col;
.
. // class reference follows
.
};

#endif
//======= end file

doing (typedef)(includes)(class def) seems to work ok, but when i want external objects inside the class/struct in the header, having big probles with linking to try and get it to work (have a bit too much couplling of my data structs i guess, but for example, geometry objects have a possition object, and wanted pos objects to have a pointer to a geom object (geom has heirachy info) and with all the linking, can eventually get it to work, but add another embeded object to another class or change header order and this method seems to fall down real quick?

is there a better way? or just decrease code couplling....


Submitted by Jacana on Wed, 26/11/03 - 5:53 PMPermalink

I was told Code Complete is a good Software Eng book :) I have ordered it but have not got it in yet. It was written by an MS guy.

Precompiled headers would save you from having to include your classes all over the place - instead you could just do it in one place!

Submitted by Zaph on Wed, 26/11/03 - 7:38 PMPermalink

quote:Originally posted by Jacana

I was told Code Complete is a good Software Eng book :) I have ordered it but have not got it in yet. It was written by an MS guy.

"Code Complete" should be required reading for all developers!
http://www.stevemcconnell.com/

"Writing Solid Code" is another great book to read
http://www.microsoft.com/mspress/uk/books/book108.htm
but I thought there was meant to be a newer edition than that one (1994)

Submitted by CombatWombat on Thu, 27/11/03 - 12:13 AMPermalink

quote:Originally posted by davidcoen

doing (typedef)(includes)(class def) seems to work ok, but when i want external objects inside the class/struct in the header, having big probles with linking to try and get it to work (have a bit too much couplling of my data structs i guess, but for example, geometry objects have a possition object, and wanted pos objects to have a pointer to a geom object (geom has heirachy info) and with all the linking, can eventually get it to work, but add another embeded object to another class or change header order and this method seems to fall down real quick?

is there a better way? or just decrease code couplling....

Hi david, it's been 5 yrs or so since I read "Large-scale C++ Software Design" by Lakos, but I seem to remember that this was quite relevant to this topic. I don't remember any particular rocket-science in the book (but I'd also make this comment about most of the C++ books out there anyway) but definately worth a read.

Just a quick piece of terminology before I jargon myself to death below - "typedef class geombase GeomBase" is known as a forward declaration of geombase. I'd usually skip the step of doing the typedef - and just forward declare my classes with "class GeomBase;" - this has the advantage that you don't need to know what class actually implements GeomBase in your other headers.

A couple of rules I use:

* When designing a class, prefer data members that are pointers or references where it's clean to do so (you'll only need the forward declaration if you do this)
* Only inline very basic functions in your class declaration that don't require you to bring in extra header files
* Every include file should fulfil its own needs for definitions (eg if it needs the full declartion of FooClass from foo.hxx then ensure that the include file includes foo.hxx) - you should get a clean compile if you passed the header through a compiler by itself

This breaks down a bit with using the STL (one of the hassles with C++ and large-scale development is how you're not able to forward declare templated classes) - so you just have to pull the STL headers in rather than foward declaring them.

Just another quick note on terminology - linking is the step where you grab the output object files from the compiler and roll them into an executable file. When you're saying problems with linking most programmers will understand this as problems with undefined symbols, but I think you're only talking about compilation problems here.

I agree precompiled headers are useful, but you do limit your portability, and lose some of your ability to break the source code up into modules. Where these things aren't important to you, precompiled headers are your friends :)

Cheers,

Mark/CW

PS the mod's I'd suggest to your code:

[code]
//===
#ifndef GEOM_H
#define GEOM_H

class GeomBase;
class Geometry;
class GeomSkin;
class Collision;

#include "pos.h"
.
. // includes for all the types in the classes bellow
.
#include "dynamic_manager.h"

class GeomBase{
Collision *p_col;
.
. // class reference follows
.
};

#endif
[/code]

Submitted by davidcoen on Thu, 27/11/03 - 8:49 PMPermalink

Thankyou for the recomandations, will have to case up those books, now to get back to finishing the particle system :)

Submitted by Kezza on Wed, 17/12/03 - 8:01 AMPermalink

quote:Originally posted by Jacana

I was told Code Complete is a good Software Eng book :) I have ordered it but have not got it in yet. It was written by an MS guy.

Precompiled headers would save you from having to include your classes all over the place - instead you could just do it in one place!

a software eng book written by an ms guy... i can't imagine how that would be a good thing.

also watch out for precompiled headers, they often get kidna big... and can force your compiler over the stack limit (easy to fix but annoying).

Submitted by davidcoen on Thu, 18/12/03 - 11:48 AMPermalink

actually 'code complete' is quite good (and evil, reading a code style book halfway through a big project is not a good idea)

just spent the last 10 hours implementing my IK system. note to self, when getting bored, implement small fun stuff, have been giggling to myself as the person drops to the ground in a large cloud of dust (also added objects being able to release particles when being collided with) at least that is working

also just purchased a copy of 'visual C++.net' and lost quite a bit of time reformating computer and finding the build setting i need to get it not rebuild the entire project on each change (hmmn, nortan anti virus can get upset when you start playing hatchet in the registry)