Posts Tagged ‘user interface’

One Dozen Easy C++ Programming Tips

Wednesday, December 12th, 2007
  1. Consistency breeds ease of use. Even if your buttons do some weird thing, as long as they all do the same weird thing users will eventually figure it out. Make the buttons each behave differently, however, and the user is lost forever.
  2. Sort data the way it is most likely to be used. The logical sort order for a date is chronological, not alphabetical.
  3. When in doubt, the default option should be the least destructive \ most undoable choice.
  4. If you have to write an explanation of your code, never assume that the reader has read the same papers you have, unless you told them what else to read–and where to find it–first.
  5. Wrong code comments are worse than no code comments.
  6. “Copy and paste” errors happen to everyone. Be on the look out for them.
  7. If a bug disappears in debug mode, 90% of the time it will be one of two things: 1) you are overflowing memory or 2) you have a thread race condition. At least two thirds of the time, it will be a memory overflow. It is extremely unlikely it is problem with the compiler.
  8. Releasing your program compiled in “debug mode” is not an acceptable “fix”. The bug only looks like its gone… it’s still there, and can come back to bite you at any time. Don’t do it, no matter how tempting it might seem.
  9. If the program crashes on exit, you probably freed something you didn’t properly allocate, or that isn’t allocated anymore.
  10. Leaking memory is bad. Freeing pointers or objects that don’t belong to you is worse. If an object you expect to be free is still hanging around, don’t force it, find out why… “fixing” bugs by patching the symptoms and not the cause makes the code much harder to repair in the long run.
  11. If you have an intermittent bug, and your “fix” made it go away and you don’t know why, the bug is almost certainly still there. If you can’t explain it, you didn’t fix it.
  12. Good documentation is more important than more features. Write it down, even if it’s just a simple “readme.txt” file… the next person who has to work with your stuff will appreciate it!

More tips? Ideas you would recommend? Post a comment!

Finger Tracking with Wii Remote

Tuesday, November 13th, 2007

Johnny Lee shares a simple but clever approach for implementing finger tracking with the Wii remote:

[youtube:http://www.youtube.com/watch?v=0awjPUkBXOU 350 292]