everyone writes crappy code ;) we all just need to try and make it less crappy..
On 12/22/05, Merrill, Jason <[EMAIL PROTECTED]> wrote: > Very well said Paul. Couldn't agree more - mind you this is coming from > a guy who still writes crappy code. :) > > Jason Merrill | E-Learning Solutions | icfconsulting.com > > > > > > >>-----Original Message----- > >>From: [EMAIL PROTECTED] [mailto:flashcoders- > >>[EMAIL PROTECTED] On Behalf Of Paul BH > >>Sent: Thursday, December 22, 2005 2:07 PM > >>To: Flashcoders mailing list > >>Subject: Re: [Flashcoders] Faster code? > >> > >>Just to offer you guys a different take on this - It seems that my > >>post was encouraging extensive commenting of code. Actually, you will > >>find barely any comments in my code. I find that comments very often > >>get out of date as specifications change, what in essence you are > >>doing is repeating information (in code & in comments) - and > >>inevitably somewhere along the line one gets out of sync with the > >>other. > >> > >>I dont claim to write the fastest executing code in the world, but I > >>do strive to make it both human & machine readible. This comes down to > >>being very clear about what your functions are called, and breaking > >>down your work into pretty granular pieces - more than make would > >>expect. For example - lets say I have an if statement which checks > >>some stuff: > >> > >>//check mouse is in bounds > >>if(_xmouse>rightEdge && _xmouse<leftEdge && _ymouse>topEdge && > >>_ymouse<bottomEdge){ > >> ... > >>} > >> > >>I am likely to refactor something like this to: > >> > >>if(mouseInBounds()){ > >> ... > >>} > >> > >>private function mouseInBounds():Boolean{ > >> return _xmouse>rightEdge && _xmouse<leftEdge && _ymouse>topEdge && > >>_ymouse<bottomEdge > >>} > >> > >>This way I can notify other people who will be looking at the code > >>what my intention was. I use comments to notify when something was > >>done in a hackish way, of there is a known bug in the code, or > >>something else that may give a new pair of eyes a "huh?" moment... > >> > >>Back to my point about optimization - I can imagine some of you guys > >>are reading this and thinking that this will slow down the app too > >>much. Well, as Ryan mentioned in his post - write the clearest code > >>first *then* and only then, if it is too slow, identify where the > >>bottlenecks are and concentrate on them... > >> > >>*Stands down off soap-box* > >> > >>PBH > >>_______________________________________________ > >>Flashcoders mailing list > >>[email protected] > >>http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > NOTICE: > This message is for the designated recipient only and may contain privileged > or confidential information. If you have received it in error, please notify > the sender immediately and delete the original. Any other use of this e-mail > by you is prohibited. > _______________________________________________ > Flashcoders mailing list > [email protected] > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > _______________________________________________ Flashcoders mailing list [email protected] http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

