SitePoint Sponsor

User Tag List

Results 1 to 12 of 12
  1. #1
    SitePoint Evangelist yowen's Avatar
    Join Date
    Feb 2004
    Location
    Michigan
    Posts
    442
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Disadvantages of "lazy coding"

    I have never thought about it but could my (possibly bad) habbit of lazy html writing adversely affect some aspect of my website?

    example
    Code:
    <img src="button.gif" width="80" height="15" border="0" alt="button">
    becomes
    Code:
    <img src=button.jpg border=0>
    Basicly I do this in a lot of my coding, because I dont care about validation, I care about speed, I want to see the result of my coding ASAP. Does this affect search engines or compatibility?

    ps. I do always code in the width if the image is larger because otherwise pages start loading in odd ways, but I see no disadvantages in skipping dimensions for small images.

    Everyone always talks about validation, lets talk about the disadvantages of not caring at all and if one doesn't care at all; should he or she?

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,228
    Mentioned
    194 Post(s)
    Tagged
    2 Thread(s)

    lazy coding

    Some browsers are good at "guessing" what something is supposed to be. When a page is valid the browser doesn't have to guess or render the page in quirks mode. Maybe your pages are faster to write, but they'll be slower to load. I guess if all you write is mark-up and you don't care how the pages look to different users you should probably be able to get by with lazy coding for the foreseeable future. But if you ever expand your skills you'll find that some languages are not quite so forgiving. IMHO it's better to discipline yourself and develop good style. You'll find that doing things right doesn't really take that much more time and will actually save you from spending time trying to figure out why something is awry (if you ever start to care, that is).

  3. #3
    Web Developer stickycarrots's Avatar
    Join Date
    Jul 2005
    Location
    Illinois State University
    Posts
    186
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I agree with Mittineague. Lazy coding just won't always do. If you're in a rush to see the result, code it short and then once you get the result you want, go back and do the add-ins.

    Alt tags are always a good thing to have

  4. #4
    SitePoint Evangelist yowen's Avatar
    Join Date
    Feb 2004
    Location
    Michigan
    Posts
    442
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Heh, I've coded php and css. I know they are unforgiving. But I figure for html there is hardly a browser out there these days that will have trouble?

  5. #5
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,228
    Mentioned
    194 Post(s)
    Tagged
    2 Thread(s)

    bots

    Quote Originally Posted by yowen
    hardly a browser out there these days that will have trouble?
    I don't know if the same can be said for the spider bots.

  6. #6
    SitePoint Evangelist yowen's Avatar
    Join Date
    Feb 2004
    Location
    Michigan
    Posts
    442
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ah, you're thinking they might have trouble. Anyone know this to be true? This would adversely affect your SEO (significantly)?

  7. #7
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Not including a text equivalent (the alt) attribute is definitely going to affect users who cannot see the image. Blind users, text browser users, dial-up users with images disabled, mobile phone users with images disabled, search engines, ...

    My attitude towards markup is diametrically different to yours. My credo is, 'if it's worth doing, it's worth doing well'. To each his/her own, though.
    Birnam wood is come to Dunsinane

  8. #8
    SitePoint Evangelist yowen's Avatar
    Join Date
    Feb 2004
    Location
    Michigan
    Posts
    442
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I dont do it much, and mainly during testing stages, I was curious about the implications, because I dont care a that much of something slips through.

    and... Since my websites are mostly scripts I do not generate most of the html.

    so the "alt" thing is important.

    what about other strings? like url's or table's?

  9. #9
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by yowen
    what about other strings? like url's or table's?
    What about them? URLs, like in href attributes, should always be quoted to be on the safe side, since they often contain characters that require quoting. (In XHTML, of course, all attribute values must be quoted.)

    If you're really 'lazy', you should have a standard CSS file that you link to from your HTML documents. That way you set up default rules for common things and won't have to sprinkle presentational attributes like border and cellspacing throughout your markup.

    Code:
    <table>
    is even shorter than
    Code:
    <table cellpadding=0 cellspacing=0 border=0>
    Birnam wood is come to Dunsinane

  10. #10
    SitePoint Addict
    Join Date
    Mar 2005
    Posts
    314
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You see, the problem with lazy coding is not being lazy at all. It's the approach you take along with the ideas you are willing to implement at that given time.

    Consider the following:

    1. Spend 1 hour creating re-usable form functions.
    2. Spend hundreds of hours, weeks and days re-coding the same form elements.

    The choice is yours

    Code:
    $do->form->text('name', 'value', 'size');
    $do->form->textarea('name', 'value', 'size');
    $do->form->checkbox('name', 'value', 'size', 'isgroup', 'groupname');
    $do->form->radio('name', 'value', 'size', 'isgroup', 'groupname');
    etc
    Regards,
    Peter

  11. #11
    doing my best to help c2uk's Avatar
    Join Date
    May 2005
    Location
    Cardiff
    Posts
    1,832
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Some good advice from Tommy.

    Here are a few more suggestions:

    1. create one general css sheet where you include all important tags with some prestyling. This one you can use now multiple times for your different websites. (Peter has some good advice there as well regarding reusable code!)

    2. I don't know which software you're using but I'm using Dreamweaver and in code view, Dreamweaver puts the quotes in it for me, I don't have to write closing tags and Dreamweaver also provides a selectable list for possible attributes in your tags - you need to try this out if you don't know what I'm talking about.

    In my case, this has sped up my simple code writing by about 25% if not more.

    One more thing, while title and alt attributes are not that important any more to search engines, you should still include them for your SEO (apart from the obvious accessibility issues of course.).
    Dan G
    Marketing Strategist & Consultant

  12. #12
    Carpe Diem = Fish of the Day fisherboy's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    488
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    One other little point. I've no idea what sort of layouts you use but....

    Entering img dimensions means the browser will render the page in its correct layout even before the images load. This lets the visitor start reading content comfortably without the page jumping around on them as each image is loaded.

    Cheers
    fisherboy
    Web Site Design


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •