Thursday, September 06, 2007

Toolbox Design

I'm spent the last few days deciding on where to start, I said the toolbox would be first but the question remaining, was which part. The maths system seem the obvious choice, as a number of other systems will rely on them.

The vector class, now this should be relatively straight forward, a class that holds 4 floats, x, y, z and w. Throw in a couple of functions and operators and your done.

Now wait right there, as this class will be used often through out this project, such a gun'ho attitude just won't cut it. A small mistake here would lead to countless error further down the line. So as I plan to treat this project professionally, I'll be designing each class, in reasonable detail, before any coding. Actually I plan to design each system before I start coding.

What this means is sitting down with pen and paper, quite a bit of paper, and thinking about how the system is going to work. The main parts to consider are:
  • The classes and the what they will represent
  • The public, private and protected properties
  • Testing Methods
  • How they interact
  • Just about anything else
When finished, it time to type it up nice and neat, clear and concise.

For the maths section there will be, initially, 3 objects, a vector, a matrix and a quaternion, and these will be represented by the classes cVector, cMatrix and cQuat. Also there will be a number of helper functions, for things like creating a rotation matrix.

Also I say initially as the project progresses there may be a need to come back and add more to this system. Maybe some more helper functions, some slight changes to the classes or even add a new class that I didn't consider before.

For the most part this advise applies for any system, and I'll go through the same routine for each system of the toolbox, and beyond.


thing2k

No comments: