Head

Form

Lower Head

EBLOG

E-Marketing Performance Blog

To Code By Hand or Not to Code By Hand

As an SEO, code bloat is one of the things I best enjoy fixing. I can’t say why for sure, since I’m not particularly great at coding. It’s probably just my own love of taking things and simplifying them.

I’m not a hand-coder of HTML. I couldn’t write a page from scratch if I needed to. But I know enough about HTML to be able to work with it. I love Dreamweaver because of the dual visual/code interface. I can make changes in either/both. Many pure coders and SEOs don’t like programs such as DW because of the code bloat that it tends to ad, and for that reason I’m in agreement with them. But DW comes in handy when you can’t work exclusively with raw code, but I can edit large sections of raw code without the visual interface0. DW just helps me a long at times.

Any program that generates your code for you, whether it’s HTML, PHP, JavaScript, or anything else, is bound to create a good amount of junk code. Take a look at this code that I found while looking at a site the other day:


< script LANGUAGE="JavaScript" >
function galeria() {
window.open('galeria/index.html','','toolbar=no,location=no,
directories=no,status=no,menubar=no,scrollbars=no,
resizable=no,width=550,height=320,left=100,top=100');
}

< /script >

< script LANGUAGE="JavaScript" >
function galeriageneral() {
window.open('galeria_general/index.html','','toolbar=no,
location=no,directories=no,status=no,menubar=no,
scrollbars=no,resizable=no,width=550,height=320,left=100,
top=100');
}
< /script >

< script LANGUAGE="JavaScript" >
function marina_layout() {
window.open('layout/marina_layout.htm','','toolbar=no,
location=no,directories=no,status=no,menubar=no,
scrollbars=no,resizable=no,width=472,height=378,
left=100,top=100');
}
< /script >

< script LANGUAGE="JavaScript" >
function maps() {
window.open('maps.htm','','toolbar=no,location=no,
directories=no,status=no,menubar=no,scrollbars=no,
resizable=no,width=730,height=469,left=25,top=25');
}
< /script >

< script LANGUAGE="JavaScript" >
function uno() {
window.open('plans/01.htm','','toolbar=no,location=no,
directories=no,status=no,menubar=no,scrollbars=no,
resizable=no,width=518,height=652,left=5,top=5');
}
< /script >

< script LANGUAGE="JavaScript" >
function dos() {
window.open('plans/02.htm','','toolbar=no,location=no,
directories=no,status=no,menubar=no,scrollbars=no,
resizable=no,width=518,height=652,left=5,top=5');
}
< /script >

< script LANGUAGE="JavaScript" >
function tres() {
window.open('plans/03.htm','','toolbar=no,location=no,
directories=no,status=no,menubar=no,scrollbars=no,
resizable=no,width=518,height=652,left=5,top=5');
}
< /script >

< script LANGUAGE="JavaScript" >
function cuatro() {
window.open('plans/04.htm','','toolbar=no,location=no,
directories=no,status=no,menubar=no,scrollbars=no,
resizable=no,width=518,height=652,left=5,top=5');
}
< /script >

< script LANGUAGE="JavaScript" >
function cinco() {
window.open('plans/05.htm','','toolbar=no,location=no,
directories=no,status=no,menubar=no,scrollbars=no,
resizable=no,width=518,height=652,left=5,top=5');
}
< /script >

< script LANGUAGE="JavaScript" >
function lagoonuno() {
window.open('plans/lagoon_01.htm','','toolbar=no,location=no,
directories=no,status=no,menubar=no,scrollbars=no,
resizable=no,width=518,height=652,left=5,top=5');
}
< /script >

< script LANGUAGE="JavaScript" >
function lagoondos() {
window.open('plans/lagoon_02.htm','','toolbar=no,location=no,
directories=no,status=no,menubar=no,scrollbars=no,
resizable=no,width=518,height=652,left=5,top=5');
}
< /script >

< script LANGUAGE="JavaScript" >
function lagoontres() {
window.open('plans/lagoon_03.htm','','toolbar=no,location=no,
directories=no,status=no,menubar=no,scrollbars=no,
resizable=no,width=518,height=652,left=5,top=5');
}
< /script >

< script LANGUAGE="JavaScript" >
function lagoon_layout() {
window.open('layout/lagoon_layout.htm','','toolbar=no,
location=no,directories=no,status=no,menubar=no,
scrollbars=no,resizable=no,width=472,height=378,left=100,top=100');
}
< /script >

< script LANGUAGE="JavaScript" >
function comingsoon() {
window.open(’comingsoon.htm’,'’,'toolbar=no,location=no,
directories=no,status=no,menubar=no,scrollbars=no,
resizable=no,width=550,height=320,left=100,top=100?);
}
< /script >

< script LANGUAGE="JavaScript" >
function beach_layout() {
window.open(’layout/beach_layout.htm’,'’,'toolbar=no,
location=no,directories=no,status=no,menubar=no,
scrollbars=no,resizable=no,width=472,height=378,
left=100,top=100?);
}
< /script >

< script LANGUAGE="JavaScript" >
function beachuno() {
window.open(’plans/beach_01.htm’,'’,'toolbar=no,
location=no,directories=no,status=no,menubar=no,
scrollbars=no,resizable=no,width=518,height=652,
left=5,top=5?);
}
< /script >

< script LANGUAGE="JavaScript" >
function beachdos() {
window.open(’plans/beach_02.htm’,'’,'toolbar=no,
location=no,directories=no,status=no,menubar=no,
scrollbars=no,resizable=no,width=518,height=652,
left=5,top=5?);
}
< /script >

< script LANGUAGE="JavaScript" >
function beachtres() {
window.open(’plans/beach_03.htm’,'’,'toolbar=no,
location=no,directories=no,status=no,menubar=no,
scrollbars=no,resizable=no,width=518,height=652,
left=5,top=5?);
}

< /script >

I’m no JavaScript programmer but I gotta think there is a much better way to do this. Oh, wait. I got it:


< script LANGUAGE="JavaScript" >
function galeria() {
window.open('galeria/index.html','','toolbar=no,location=no,
directories=no,status=no,menubar=no,scrollbars=no,
resizable=no,width=550,height=320,left=100,top=100');
}
function galeriageneral() {
window.open('galeria_general/index.html','','toolbar=no,
location=no,directories=no,status=no,menubar=no,
scrollbars=no,resizable=no,width=550,height=320,left=100,
top=100');
}
function marina_layout() {
window.open('layout/marina_layout.htm','','toolbar=no,
location=no,directories=no,status=no,menubar=no,
scrollbars=no,resizable=no,width=472,height=378,
left=100,top=100');
}
function maps() {
window.open('maps.htm','','toolbar=no,location=no,
directories=no,status=no,menubar=no,scrollbars=no,
resizable=no,width=730,height=469,left=25,top=25');
}
function uno() {
window.open('plans/01.htm','','toolbar=no,location=no,
directories=no,status=no,menubar=no,scrollbars=no,
resizable=no,width=518,height=652,left=5,top=5');
}
function dos() {
window.open('plans/02.htm','','toolbar=no,location=no,
directories=no,status=no,menubar=no,scrollbars=no,
resizable=no,width=518,height=652,left=5,top=5');
}
function tres() {
window.open('plans/03.htm','','toolbar=no,location=no,
directories=no,status=no,menubar=no,scrollbars=no,
resizable=no,width=518,height=652,left=5,top=5');
}
function cuatro() {
window.open('plans/04.htm','','toolbar=no,location=no,
directories=no,status=no,menubar=no,scrollbars=no,
resizable=no,width=518,height=652,left=5,top=5');
}
function cinco() {
window.open('plans/05.htm','','toolbar=no,location=no,
directories=no,status=no,menubar=no,scrollbars=no,
resizable=no,width=518,height=652,left=5,top=5');
}
function lagoonuno() {
window.open('plans/lagoon_01.htm','','toolbar=no,location=no,
directories=no,status=no,menubar=no,scrollbars=no,
resizable=no,width=518,height=652,left=5,top=5');
}
function lagoondos() {
window.open('plans/lagoon_02.htm','','toolbar=no,location=no,
directories=no,status=no,menubar=no,scrollbars=no,
resizable=no,width=518,height=652,left=5,top=5');
}
function lagoontres() {
window.open('plans/lagoon_03.htm','','toolbar=no,location=no,
directories=no,status=no,menubar=no,scrollbars=no,
resizable=no,width=518,height=652,left=5,top=5');
}
function lagoon_layout() {
window.open('layout/lagoon_layout.htm','','toolbar=no,
location=no,directories=no,status=no,menubar=no,
scrollbars=no,resizable=no,width=472,height=378,left=100,top=100');
}
function comingsoon() {
window.open(’comingsoon.htm’,'’,'toolbar=no,location=no,
directories=no,status=no,menubar=no,scrollbars=no,
resizable=no,width=550,height=320,left=100,top=100?);
}
function beach_layout() {
window.open(’layout/beach_layout.htm’,'’,'toolbar=no,
location=no,directories=no,status=no,menubar=no,
scrollbars=no,resizable=no,width=472,height=378,
left=100,top=100?);
}
function beachuno() {
window.open(’plans/beach_01.htm’,'’,'toolbar=no,
location=no,directories=no,status=no,menubar=no,
scrollbars=no,resizable=no,width=518,height=652,
left=5,top=5?);
}
function beachdos() {
window.open(’plans/beach_02.htm’,'’,'toolbar=no,
location=no,directories=no,status=no,menubar=no,
scrollbars=no,resizable=no,width=518,height=652,
left=5,top=5?);
}
function beachtres() {
window.open(’plans/beach_03.htm’,'’,'toolbar=no,
location=no,directories=no,status=no,menubar=no,
scrollbars=no,resizable=no,width=518,height=652,
left=5,top=5?);
}
< /script >

Reduction in code bloat: 18%

Now, take that and place it into an external JavaScript file and you have over a 95% reduction in unneccessary on-page code related to this script. This is a clear example on why you should largely be able code yourself rather than rely on software to do it for you.

One Response to To Code By Hand or Not to Code By Hand