Thoughts on programming, web development and design.

Circuit Board

Month: November 2011

Refactoring Your Website

Computer with codeWhy refactor a web site? You don’t always have the time to redesign your website from the ground up. Your web site uses outdated HTML and web technologies, loads slowly and needs search engine optimization. Today’s web sites need to load fast, display on multiple browsers and mobile devices and utilize current web standards. A slow loading web site means that your visitors will not wait for your site to load.

Refactoring means changing your web site’s structure to make it easier to read, maintain and provide the user with a better experience. It gives you a chance to fix that one issue that bugs you about the web site.

What items should you look for?

  • Outdated HTML As more developers use HTML5, you’ll want to remove HTML tags that are no longer in use. Tags like <center> and <font> are not depreciated in HTML 4. In HTML5, tags like <blink> and <marque> are also depreciated.
  • Unnecessary code When you have code embedded in your site, you need to determine whether or not it really belongs there. As browsers and HTML changes, old hacks can be removed because the browsers now support a technique that originally required you to create the hack.
  • Embedded styles Styles embedded in HTML tags make it difficult to change the look of your site. If you want to create a new look, you have to edit all of the embedded styles. By moving the styles to an external CSS file, you can change the look of your site more easily.
  • JavaScript When a browser encounters JavaScript, it stops to handle it before loading the rest of the website. You want to evaluate each piece of JavaScript on your site. Does it need to be there? Can you use CSS or another technique that works better? Should you move it to the bottom of the web page so that the page can load faster?

You don’t need to take care of all problems at once. Even a small change like moving JavaScript code to the bottom of the web page can improve the overall experience for your visitors.

Testing Websites: Locally or on a Subdomain

Computer CodingWhether you use a CMS or build a site from scratch, you need to test it. You need to make certain that the front-end and back-end work. A website that doesn’t work is worse than not having one at all.

How can you test a website that you are developing? You have two options. Test the website on a local web server or on a subdomain of a website you currently own.

What are the advantages and disadvantages of a testing on a local web server?

The advantages of testing on a local web server are:

  • You can test sites offline. When you don’t have access to the Internet, you can still test the website. You’ll be able to verify how the front-end and back-end work.
  • Your changes won’t affect the live (production) website. Any changes that you make will only affect your local copy of the site. Your customers can still use the web site without any issues.
  • You can have as many web sites as you have space for. If you need to test multiple web site, you can place as many as you need on your server.
  • You don’t have to pay hosting fees to host your test site.

The disadvantages are:

  • You have to maintain the server. You’ll need to learn how to edit Apache or IIS files.
  • You may have differences that affect the performance of the site between your local server and your hosting server.

What are the advantages and disadvantages of a subdomain?

The advantages are:

  • Test your site on the same hosting server as your live site.
  • Your hosting company takes care of the web server. When you run into web server problems, you can call them for help.
  • Your visitors will go to the main web site. Any changes you make on a test domain won’t affect your customers experience on the live (production web site).

The disadvantages of a subdomain are:

  • You need to edit .htaccess to prevent Google and others from seeing the site. If you don’t, then the search engines will find the test site. You only want completed web sites to be found by the search engines.
  • You have to be online to test and make changes. If your internet connection goes down, you can’t continue working on your website.

Which one should you choose?
Every web development project is different. Each client may have different needs. Some people may not want to see a web site until complete. Others may want to see it as you progress through the building of the web site. You need to choose the one that fits how you work and what your client needs.

Related Article

Install Your Own Web Server

Whether you want to test new web designs, plugins to a CMS or web apps, you will need a web server. XAMPP allows you to install Apache, PHP, Perl, MySql and more. This video by jimmyrcom guides you through the installation process on Windows.

If needed you can also get a version for Linux or MacOS.

Powered by WordPress & Theme by Anders Norén