Posts Tagged html

Google CSE article

I just finished the Google CSE article I started a couple of weeks back. It was an interesting project, mostly due to the fact that I have never worked with the Google search API before and it was enjoyable to learn something new.

Hopefully you find it useful. When I was putting the code together, I found there to be a distinct lack of articles or documentation on the Custom Search Engines. Hopefully this helps someone. Then again, Google will probably EOL the JS CSE API in the next few months and I will have written the article for my own benefit. Ah well..

Check it out here

, , ,

No Comments

These are not the same

I have been coding for over a decade now and one thing about other coders has never ceased to annoy me. In defense of my rant, I present two snippets of HTML code, see if you can pick out the difference and the source of my exasperation, I’ll leave it up to you to make the determination as to which is the good and which is bad:

<div id="content">
    <div id="content-wrapper">
        <h1 class="layout-indent">Page Title</h1>
 
        <div class="separator thick-separator">
            <div class="thick-separator-cap thick-separator-left-cap">
                &nbsp;
            </div>
 
            <div class="thick-separator-cap thick-separator-right-cap">
                &nbsp;
            </div>
        </div>
 
        <div class="layout-indent">
            <div class="yui3-g">
                <div class="yui3-u-1-3">
                    <a href="#" class="link action-link ">Filler Text....<br />
			<img class="link-arrow" src="img.png" alt="" />
		    </a>
                    <div class="clear">
                        &nbsp;
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<div id="content"><div id="content-wrapper">
<h1 class="layout-indent">Page Title</h1>
<div class="separator thick-separator">
<div class="thick-separator-cap thick-separator-left-cap">
&nbsp;</div>
<div class="thick-separator-cap thick-separator-right-cap">
&nbsp;</div></div><div class="layout-indent">
<div class="yui3-g"><div class="yui3-u-1-3">
<a href="#" class="link action-link ">Filler Text....
<br /><img class="link-arrow" 
src="img.png" alt="" /></a>
<div class="clear">&nbsp;
</div></div></div></div></div></div>

The structure of these snippets is identical, they probably layout the same between browsers too. I guarantee you that if anyone ever had to make a change, the first one would be far and away easier to change. So why do people still insist on editing spaghetti code? This isn’t just an HTML issue, it happens in every coding language I have ever encountered. I just want to say to people, “Would it kill you to use the tab and enter key from time to time?”, its as if not indenting their code will somehow make them work faster. “Look boss, I saved 2.78 seconds last week, by not formatting my code!!” In my opinion it really shows that someone [programmer] has pride in their work if they spend the extra few minutes documenting and formatting their code.

,

No Comments