Refactoring is a term used in programming which refers to the process of taking a piece of code and rewriting it. The different here is that you aren’t re-writing that code in order to achieve a different end, rather you are re-writing it to do the same thing that it already can do. So what’s the catch?

Well while the code will still do the same thing after refactoring, the idea is that it will do the same thing more quickly and more efficiently. When programming a large program such as business to business software, this then allows the program to run on a machine while using up significantly less RAM and other power which means it runs faster on older machines and is less likely to crash or otherwise go wrong. At the same time refactoring can also help you to decrease your file size, and to make it run faster and be more compatible. For us SEO geeks, decreased file size and faster performance could result in few “returns to search engine results”, a major behavioral signal of relevancy to Google and other engines.

While a lot of refactoring goes on in software engineering and computer game programming however, it is significantly less common for website design. The reason for this is largely because people often don’t view website programming as ‘real’ programming as it is really just a series of indicators for how the page should be organized on the screen by the browser – there are fewer logic testers and less input/output.

Why Refactoring for Websites?

However this isn’t the case all of the time, and actually there are several examples where website coding is a lot larger and more complex than just that. For instance if you are making a website that has profiles, a forum, or a comments box then this will involve PHP and Java and instantly be far more like coding a piece of software.

However even for a website that still relies only on HTML and CSS there are ways and ways of programming so that it will be as fast and as efficient as possible. Faster load equals better user experience, which ultimately results in few bounce-back’s to Google and other SERPS, and potentially higher ranking over time.

If you have lots of pages with unnecessary code and annotations, and if you have programmed each page individually, then you’ll find your site is slow to load, that it taxes your bandwidth allowance heavily, and that you struggle to find your way around it when you come to make changes.

Some Examples

So how would you go about refactoring a website? Well one thing would be to reduce the size of each HTML file as much as possible which you can do easily with an include file and a CSS style sheet if you don’t already have them.

Meanwhile you might choose to use Ajax in order to dictate the order in which your page elements load, and to therefore create a better experience for the user. Thumbnails should be thumbnails and not just large images with the attributes dictated in the code which are slower to load.

For PHP and Java things become a lot more complicated. Tiny differences like using a Boolean (a ‘true or false’ variable) rather than an Integer (any whole number) can increase the speed of the software and reduce the memory expenditure minimally. Either way though, this is highly worth doing and will help you to end up with a website that is more stable, that will be more relevant going into the future and that you can easily find your way around and edit.

Content provided by John Russell, a part time blogger and webmaster at web hosting reviews blog. Recent review by him is on webhosting provided by bluehost with complete specifications/analysis.