VBScript Beginner Tips
Here are our top 10 tips for successful VBScript coding!
- Get a good text editor that you are happy with. Notepad is a good, free, editor but there are better ones. UltraEdit32 (www.ultraedit.com) is probably the best. Avoid using word processors, even simple ones like Wordpad, as any formatting code in the final output will result in errors.
- Plan your code project before you start coding - pen and paper is low-tech, but often the best way!
- Comment your code well. Something that seems obvious early on might not seem so obvious later! Remember, you can always remove the comments before the code goes "live".
- Save different "versions" of your code as you work through it. That way, if things go wrong, you can always go back to the last working version.
- Use meaningful names for variables, procedures and functions. If you feel up to it, use Hungarian Notation.
- Write separate bits of code to deal with different aspects of your project - don't try to write one huge function or procedure to handle everything.
- Build a code library of useful scripts and functions - no point reinventing the wheel! Remember to document them well and give the files meaningful names.
- Make small incremental modifications to your code and test your code at every stage of development. The more you test the earlier you'll spot flaws and errors. Leaving all the testing until the end will mean more hassle and more time spent tracing faults and flaws.
- Prototype big coding projects and break down big projects into smaller code sections. This way it's easier to spot coding bugs early on.
- Once you've finished, test your whole project thoroughly and if possible get others (family, friends, co-workers, etc) to test it. If the code relies on input (keyboard and mouse), check what happens when you do something unexpected (such as inputting numbers instead of text and so on). Other people are best to test code because, unlike you, they don't know how the code should work!!!!
- Have fun coding!!!!!