Message Board


Message Board > Programming > The importance of proper code formatting..

April 20, 2013, 00:08
Zomg
None
641 posts
I don't blame dyslexic people, but I know a dyslexic guy. He does random code formatting (it does not provide readability at all).

Example code:
<script type="text/javascript">

function bla(){ if(x=5=y=10;} if (

whee=lol){bla=9;
}

Horrible readability. I always have to reformat his code in order to debug it. After twenty minutes of debugging I finally found his error. He didn't close the <script> tag. That is one of the cardinal rules of coding.. always close your code block first before you add anything to it!! I cannot stress it enough. Good code practice.

The code in his entire JS block didn't get executed even though it was called onto with html by using onload="bla()". The browser went in quirks mode, ignored the entire <script> section and just rendered the <h1> text.

So now you see the importance.. and how such a stupid error as a closing </script> tag can cause you minutes if not hours of debugging. I was calling all variables and checking their values.. lol.

Anyway. :)
____________
#
June 6, 2013, 19:22
Dennis
どこかにいる
2092 posts

should'nt "if (whee=lol)" be "if (whee==lol)" ?
____________
Kwakkel
#
June 6, 2013, 19:39
Zomg
None
641 posts
You can do assignment inside a condition, as far as I know.

http://stackoverflow.com/quest … practice-or-not

Apparently it's not proper practice.
____________
#
June 11, 2013, 22:19
Dennis
どこかにいる
2092 posts

oh I remember using it back in the days of DIV and Fenix.

while(EnemeyId = get_type(type enemy))

end


To loop through all living enemy processes and get their type.
____________
Kwakkel
#
June 12, 2013, 01:11
Zomg
None
641 posts
Zomg awesome stuff.
____________
#
November 9, 2013, 23:59
PB
Defender of the faith
630 posts

http://closure-compiler.appspot.com/home
____________
#
November 10, 2013, 13:35
Zomg
None
641 posts
A closure compiler. Neat.
____________
#
November 10, 2013, 22:23
PB
Defender of the faith
630 posts

It compiles JavaScript, created by Google :)
____________
#

Message Board > Programming > The importance of proper code formatting..

Quick reply


You must log in or register to post.
Copyright © 2005 Booleansoup.com
Questions? Comments? Bug reports? Contact us!