|
|||||
|
On this page, you'll find some things I myself find usefull. If you are totally not interrested : skip it. I've divided it in a few parts ( like you haven't seen that already ) and if you read it carefully you see that the whole is almost equal to the sum of the part's ( there's just one part missing : your own opinion and practice ). |
|
Everything listed below are things that will make your life as a programmer easeyer.
Use some sort of variable
identification method, so you know what kind of variable you are working
with just by looking at it. I use the three letter prefix method. Wich
means I start my variable ( and object ) names with a three letter combination
specifiing the type of variable ( or object ). e.g. : int for integer
( intCount ) and btn for a button ( btnOK ).
Use self-explaining variable,
object and procedure names : 'btnOK' says much more then 'button1'. Also,
use variables for reoccuring values ( constants ). sglVAT says much more
then just 0.21 ( the VAT in Belgium ) and is also easeyer to adjust
( in this example : to increase ).
Use indentation to make things
clearer. e.g. :
Use comments to structure
your code, it will make things a lot more easy if you ( or somebody else
) need to change your code. In Delphi comments are put between { } or after
//, in JavaScript, comments are put after // and finally, in Visual Basic
you put comments after a single quotation mark : '.
Beginning Delphi Programmers : This stuf is for you :
If you have a giant piece
of code, put it into seperate units, this wil ease things a lot.
Using the Document.Write,
Document.WriteLn or Document.Clear method deletes the current
Contents of the Page, this includes al your code ! You should avoid using
these method's on you'r code page and instead open a new window for it.
If you have to do it on your (main) code page, ad a link to the current
page forcing the page to reload. eg :
You can Use single and Double
quotation marks interchangable in Javascript. This means that you can eather
use : Document.write('then he said : "you are a programmer".')
or Document.write("then he said : 'you are a good programmer'.")