Naming conventions & organisational skills

K.I.L.E.R

Retarded moron
Veteran
I realise that there is a great importance placed on organisational skills when coding.

I believe that my greatest weakness is my skill with my inability to properly organise.
I have had people comment on the way I set out my code and it's readability and I'm currently writing another console RPG this time I am using classes instead of structures and a headre file with mutliple source files rather than 1 source file.

I'm implementing emotions into objects (characters, as people might like to call them), so far I have been successful with that. Can anyone belive that I could do that? :D

[OT]
My ego and arrogance as a coder goes overboard when I accomplish something like that. Is that something I should control?
[/OT]

Although can't say the same with the way I organise everything.

My source files are a mess, things are all over the bloody place and sometimes when looking for things I tend to think along the lines of:

"Bloody hell, where is 'function A'? or WTF is 'variable A'?"

I have read several articles on organisation but they are just general guidelines which have only helped me to a certain extent.

Since you guys are expereinced coders, can you guys tell me how best to go about organising my files and what's inside them.

Should I have 1 function to 1 source file?
Should I initialise my classes in different header files or in my main header file (which I tend to call 'init.h') ?

As usual all help is appreciated, even criticism. Thanks.
 
Traditional way AFAIK, is one header and one cpp per class.

All functions and variables have explicit names, even if that make them long.
(m_pDiscardedOctreeNode...)

Group classes inside the IDE thanks to tree like structure, to find easily what you want. (SceneGraph, SpatialSubdivision, WorlManagement,...)

You can also build 'specialized' modules, one sound and music, another IO, a third user input, a fourth physic engine, a fifth 3D rendering and so on and so forth...
 
Ingenu said:
All functions and variables have explicit names, even if that make them long.
(m_pDiscardedOctreeNode...)

Yeah, but keep in mind that this is useless if you have many functions which all have pretty much the same name. In this case, it's far more effective to choose some real different names, because you won't have to concentrate on checking the function's name that correctly.

Ingenu said:
You can also build 'specialized' modules, one sound and music, another IO, a third user input, a fourth physic engine, a fifth 3D rendering and so on and so forth...

That's real important. A clear separation of all terms of your project will protect you from losing control of which .cpp, .h, whatever belongs to which part of the project. And you won't end up begging for some kind of bubblesort to regain control over all this mess.

But the first thing to do is as simple as it sounds: Write comments. You'll never ever be in this goddam situation where you don't know what this variable is for again. Just comment on anything you do. But make sure to write some real useful comments. All sources I've seen lately were real bad declared.
Just remeber: A good programmer will never ask you WHAT you do in function a. But he might ask you WHY you do this. So better think twice of what you put into a comment.
 
Back
Top