Obviously I'll be repeating a lot of suggestions from the above linked "programming best (and worst) practices
" discussion, but as you're after individual habits and reasoning I'll list some of the things that are most important to me personally here, and try to briefly explain the reasoning behind them. 1. Always be consistent. Always.
A lot of things in programming -- and using an event sheet is
essentially programming -- are subjective and come down to personal preference. It's important that you choose a preference and stick to it
within any given project; you should never have to wonder if a variable name is in camelCase, ALL_CAPS_WITH_UNDERSCORES, or some other style, because you should be following your own consistent set of rules for these things.
If you assign some meaning to particular styles (ALL_CAPS for constants for example) it will even help by providing additional hints when reading your code.2. Use sensible, meaningful variable and object names.
Don't be tempted to save typing by using one character or very short abbreviated names unless there is already an established convention to do so for a particular usage.
It may be clear what you mean now, but it might be less clear if you have to read the same code again after not touching it for a year or if you find you need to hand it over to someone else to be updated.
Using proper names is also a good step towards making your code/events "self documenting", rather than having to explain what it means by adding comments -- see the next point.3. Use comments to describe why things are a certain way or to explain unusual code, not to describe what your events are doing.
Your events already explain what they're doing, and should be quite clear if you've chosen sensible names. Comments should be used to explain why
you're doing it, which may be less readily apparent at a glance.
For example, you might have an event that sets a boolean instance variable to true if a particular sprite is colliding with another. You don't need to write a comment saying that, as the event already describes it perfectly; instead, explain why you're doing so.4. Use the functions and expressions that most clearly express your intent.
Something there will be multiple functions or expressions which produce the same result. Consider for example the system expressions floor() and int(): when applied to a number such as 4.6 both will produce a result of 4, but these functions have different purposes, and you should use the one which matches what you're actually trying to do. Again, this will help to make your code "self documenting" and easier to understand.
Hope that's the sort of thing you're after.