However, some errors are not so easy to track down because they are not syntax errors (i.e. 'illegal' code'); our code just doesn't work as planned. These errors are somewhat trickier to locate, and can take hours to resolve. Even more annoyingly, we can spend an age looking for such errors, only for another coder to glance over our shoulder, and immediately spot the problem! Sometimes a bit of luck may have been involved, but more often than not, it's experience that can assist in locating certain types of error.
The purpose of this article is to discuss refactoring, or rearranging code, to make it easy to read, and to assist in eliminating or (more realistically, reducing) the introduction of errors into our code.