Coding and Testing: The Coding Importance of Crossing the T and Dotting the I

When coding, it is always important to remember the details. Cross every t and dot every i. For instance in a PHP script, leaving out ; (semi-colon) at the end of a statement can bring a whole site down. These types of problems can also be very difficult to find. Imagine if you had several pages of code and somewhere in there you had one missing semi-colon. Sometimes it could be an extra space at the wrong time or the lack of a space when one was needed. When coding, it is essential to follow proper coding protocols. The smallest error can have very large consequences.

Proper Testing

Proper testing is important. When writing code, it is always a good idea to do proper testing of that code. You want to make sure you get all the bugs out or as many of them as you can. On large projects, you may not get them all but with proper testing you can filter out most of them. Different scripts, functions or plugins may interact with each other in a way that causes problems. You really can’t tell until you test it.

Checking for Bugs

After all your testing is done and you finally go live, you have to check again to see what bugs are still in your code. Hopefully there will be no bugs left to pull down the site after testing. However in larger projects, there will probably still be some bugs that you just don’t catch until the project goes live. These you will have to find and work out. Proper testing will catch the vast majority of bugs in a project, and can even catch all of them if testing protocols are stringent or the project is small. There are usually production time-lines that dictate how much time may be spent on the coding and the testing, so there are tradeoffs on where your time is spent. It is important that coding projects allow the proper amount of time for both sections, because the testing is as important as the coding itself.

Testing Environments

When doing larger projects, it is normal procedure to do so in a test environment. A separate domain or sub-domain created just as a work space for the project makes the testing much easier and more comprehensive. Then once everything is working well, you just transfer the work environment to the actual domain site and go live. Or you can go to your registrar and change the IP address of your site to point to the new site. Either way will work

You want well written, succinct code that is well commented. Then is is essential to have a thorough testing of that code. When one small error can take a whole site down, it is vitally important to catch that error before it can do that. When that doesn’t happen and you do have a site go down, it is vital that you find the problem and get the site back up as fast as possible.

– Robert Hunt, Search Engine Technical Coordinator