Originally Posted by DeadmanDinesI use groups extensively, which helps avoid commenting since commenting in the list editor i've found is frustratingly buggy (e.g. new comments often show up about 3px tall and you have to resize them).
I've found that the more detailed groups you have, the less comments you need and the more structured your code becomes. Sometimes I actually have only 2 lines of code in a whole group by itself. So for instance, Geronimo's player movement uses these groups:
Player Movement
Motion Variables
Left/Right
Gravity
Jump
Move
Initialise Move Safely
Safety Loop
Test and Cap Inertia
Standing on Floor
Obstacle at Top?
Obstacle at Left?
Obstacle at Right?
Animation
Stopped
Walking
Jumping
Falling
Throwing
Hurt
Player Dies
Jump Attack
Throw Stones Attack
Throw Stones - Apply Velocity
As you can imagine, with that many groups, the need to comment code is minimal.
You can also tuck most of the code away, and see how it's working just from the group names. So in the case of the movement part, I can tell just from the group names that:
1. Motion variables are read from the keyboard input (move left/right, jump, etc) and applied to his internal inertia.
2. Move Safety is initialised (in such a way that it can be recycled and used by other objects later without conflict)
3. The safety loop is run to test for collisions and push out.
4. Tests are run to determine if the player is now next to a wall above, below, left or right, and in any of these cases his inertia in that direction is cancelled (so his gravity doesn't keep building up while he's standing on the floor).
And that's it, that's how his movement works. I actually had almost no recollection of how his movement worked before this, since I hadn't touched it in months. But just reading the group headings reminded me of the whole process
So it's worth doing. I usually don't do pseudocode though. I'll only bother with pseudocode for expressions (and then it's more like algebra, hence why I built Expression Editor Plus). Flowcharts I'll use for diagrams of an application (e.g. you press this option, go to that screen, press that option, go to that screen, etc).
Now how long is it till James strides in and shows us how many groups are in Tormishire?