|
-
Senior Member
http://en.wikipedia.org/wiki/Program...en_to_optimize more or less says it all.
When in doubt, learn to write for others reading your code (this will come in handy for them, or for when you want to come back and update your code). What good is something that goes ~1% faster if no one can figure out what it originally meant to do.
For my eyes, each listened event having its own event handler would be easier to read; In contrast with a 'one size fits all' routing function (in your case, switching between doOver, and doOut)--- im guessing that would be used like: 'addeventltnr(mouseevnt.over,SuperFunction); addeventltnr(mouseevnt.out, SuperFunction);'
Also if you have them in different functions, you will be able to quickly see what is being run where. ohhh the horrors I have seen/done; every other line 'if (thisfunctionisforthis)' do stuff, then the next 'if(thisfunctionisforsomethingelse)' do other stuff; oh the humanity! This makes updating, fixing or frankly just writing it near impossible.
So, in short: Program for the fastest Human Understanding, Not the fastest Computer Understanding. I suggest against the way you have posted.
Last edited by guardiankitty; 12-18-2011 at 10:35 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|