How NOT to code 2

How NOT to code was a popular post, so I’ve decided to make another one. Unfortunately, both of the hard drives on my computer erased themselves without warning so I have been delayed. I am thankful, however, that most of the files that were on my computer are also stored somewhere else.


A few tips before I start:

  • Never use one of those page editors to make a website. I have never seen one that is XHTML compliant.
  • Don’t type color 1f into a command prompt. Or maybe you should. It’s fun to make your command prompt look like the blue screen of death.
  • Speaking of the blue screen of death, BSoD is not a game. And it’s not pronounced buh-sawd. Better yet, just don’t pronounce it at all.
  • Don’t chmod the directories on any website to drwx—— (700). It’s not fun when nobody can get to your site.
  • Don’t kill chickens with a crystal bow. We all know that summoning was a money drainer, but you’re just making it worse.
  • Don’t say anything from Runescape to a Russian. I’m not going to explain this one in interest of time.

Let’s start now.

Don’t Use Default HTTP Error Pages

I can’t count the number of times that a website has given me an HTTP error page. It’s not pretty. It’s just a white page with a blob of text that tells you that basically, you killed the site. The default error pages don’t look good, aren’t XHTML compliant, give the end user the feeling that they created a problem, and almost never fit into the site.

You can easily fix this. Just make a normal html or php1 page and add the following line to your .htaccess file at the root of the site:

ErrorDocument 404 /errors/404.html

This will set the error document for an HTTP 404 error (not found) to the /errors/404.html page. For example, if your site is at www.example.com, your page will show up as if it was the page at http://www.example.com/errors/404.html

1Server-side scripting languages should not be used with 500 errors.

Don’t test things on your actual site.

It’s just stupid. Writers don’t publish a book every time they write a page, you shouldn’t either.

It makes it a lot easier to just have something like XAMPP. All you need to do is open localhost in your internet browser, just as you normally would with your site, and you can test it out before you make an embarrassing mistake on your actual site.

Google ads need to be moderated

First of all, nobody likes to see ads for certain things. I’m not going into detail about that. You need to get these ads off your site, along with the ads for your competitors.

Secondly, if you have more than one ad unit on a page, it might be a good idea to cut down on the ads. If someone goes to your site and sees three adsense units when they first load the page, you’re bound to lose a lot of visitors to your site. Another thing about putting ads on your site: If someone sees bright ads on a dark site, it’s going to stand out. Too much. Keep the ads blending in.

Keep the pages small

Each page on a website should be kept below a quarter of a megabyte (including the images and other media). This way, a 56kbps modem (dialup) can load a page in about 5 seconds.

“Under Construction”

Honestly, if your site is under construction, we still might want to see it. Don’t even buy a domain name until you’re at least 75% of the way done coding your website. If a page is under construction, don’t link to it. We don’t want to see a page that tells us nothing.