I'd rather rewrite code any-day then fix someone else's... i'd be willing to wager that i'm saving time too. I comment my code a bit, but i only take the time to do any docs if a client feels very strongly about it.

On Dec 21, 2005, at 6:19 PM, JesterXL wrote:

I just re-write. Everytime I'm asked to port old code, it's usually in AS1,
or AS1 that masquareades as AS2, or is so messed up, it needs to be
re-written anyway. Additionally, half of those projects are "upgrade from
AS1 to AS2" or "Flash to Flex".

If Flash stops changing, and the code that keeps getting thrown at me
actually works for a change and is malleable, then I could see the point of
commenting.  Currently, nope.

----- Original Message -----
From: "Judah Frangipane" <[EMAIL PROTECTED]>
To: "Flashcoders mailing list" <flashcoders@chattyfig.figleaf.com>
Sent: Wednesday, December 21, 2005 6:10 PM
Subject: Re: [Flashcoders] Faster code?


This happens all too often. As common as this is, it is something you
*must* do. Especially if you are the person that has to go back and
change stuff at a later date. I dont know how many times I have gone
back and looked at my code and I was like, "what the (explicitive
deleted) was I doing". Now I write code for readability.


// bad (IMHO)
if (getIsTrue(myTest)) {
    return (10/2 + 5)/mc._x;
}

// good
var isSomethingTrue = getIsTrue(myTest)

if (isSomethingTrue) {
    var retVal = (10/2 + 5)/mc._x;
    return retVal;
}

Trust me dude, I am having to rewrite an asp app in flash remoting
asp.net and none of the code is commented. So I have spent 3/4ths of my time trying to interprit another persons code and the other half writing a flash remoting version of it. Readability is more important than speed
(IMHO). Either way comment. :)

Judah

JesterXL wrote:

What I want to know is who is paying for #2? Very rarely do I ever get
time
to comment anything, and even if I did, the code I commented changes the
next day, rendering the whole endeavor fruitless.

...not to mention most service work is always a custom job/rewrite anyway.

----- Original Message -----
From: "Paul BH" <[EMAIL PROTECTED]>
To: "Flashcoders mailing list" <flashcoders@chattyfig.figleaf.com>
Sent: Wednesday, December 21, 2005 4:49 PM
Subject: Re: [Flashcoders] Faster code?


I think these are all great, but if I can be the voice of caution for
a moment...

remember that when you write code, it is for 2 interpreters:

1) the Actionscript VM
2) the person who has to go back and change stuff at a later date,
which may or may not be you...

Its often very easy to forget number 2 - so, while writing doing
things like avoiding function calls may be faster for 1) it can end up
making things a lot slower for 2)

Also, when you go through your code & optimise it, make sure you are
efficient with your efforts - you will probably find you can nail down
key performance spikes to just a few functions / algorithms... be
careful not to optimise to death, and try and measure your gains at
each step

I'm not saying code shouldnt be optimised at the expense of (human)
readability, just that sometimes it gets a little overdone...

ta

PBH

On 12/21/05, Steven Sacks <[EMAIL PROTECTED]> wrote:


the fastest loop through an array is:
 var len = myArray.length;
 while( len-- ) {
   ...
 }
yes, it's faster then for..in.


Not always. Sometimes, this loop is faster than a while (i--)

for (var i = items.length; --i - (-1); ) {
      ...
}

It's ugly, yes, but it is faster than while (i--) depending on how many items you're iterating through. Run some tests if you don't believe me.
:)

_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders






_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to