This second video in the cleaner code series talks about magic numbers, and how to avoid them. It also covers naming conventions for function names and binary variables. Use of subfunctions is also shown.
You can follow any comments to this entry through the RSS 2.0 feed.
You can skip to the end and leave a comment. Pinging is currently not allowed.
2 CommentsOldest to Newest
I long ago got in the habit of eliminating sqrt's from distance computations whenever possible, since the sqrt usually takes longer than computing the square of the distance. In this case, I would compare the sum of squares with r^2.
This is an excellent observation. I am thinking of adding another video in this series that might be able to fit in code optimizations like that.