XMLpitstop.com   |  VBnetexpert.com   |  Community Credit  
 
 
Pitstop Search:  
in
 
Sign in | Join | Help
 
 
  Blog
    Home  
 
  Entries By Date
 
<May 2009>
SunMonTueWedThuFriSat
262728293012
3456789
10111213141516
17181920212223
24252627282930
31123456
 
 
  Blog Categories
   
 
  Archives
    December 2009 (2)  
    October 2009 (1)  
    September 2009 (1)  
    August 2009 (2)  
    July 2009 (2)  
    June 2009 (1)  
    May 2009 (1)  
    February 2009 (1)  
    December 2008 (1)  
    November 2008 (3)  
    September 2008 (3)  
    August 2008 (3)  
    June 2008 (4)  
    May 2008 (2)  
    April 2008 (3)  
    March 2008 (3)  
    February 2008 (5)  
    December 2007 (4)  
    November 2007 (1)  
    October 2007 (3)  
 
  Syndication
    RSS  
    Atom  
    Comments RSS  
  .NET Flea Market  
 

OMG, ur doin it wrong.

You know, when you think of a popular website, run by a pretty big company, you would expect that they would have a pretty good software development team.  If you think of the popularity of a website and how much impact poor code would have to their servers and how much impact a poor user experience would have to their customers, then it’s pretty clear, you need to have good code.

I don’t usually like to crap all over someone’s coding.  I will criticize and I think I am pretty good about being flexible about differences in coding styles.  But sometimes there is a case that is SO flagrantly bad, it has to be called out.  And the subject in this case is The Weather Channel.

I recently noticed that the interactive weather map page had changed.  And in this change, it stopped working in my browser of choice: Opera.  The specific problems that caused me to dive into the code (and subsequently begin projectile vomiting) were that it would freeze partway though the page load (hitting stop would display the remainder of the page) and that the map animation would only load the first two images and then freeze.  I never got to the point of troubleshooting them.

Let’s start with the stats that will knock you on your ass.  This page alone, just the HTML code, not the linked scripts, not the images, is 223k.  It is 5500 lines of code.  Can you fathom that?  An immensely popular web page being an incredible 223 kb in size.  Now can you imagine being the developer creating and maintaining a 5500-line web page?

So, I saved off the HTML code and loaded it in VS.  There was a slight problem with the Format Document function because of a misformatted tag (go figure).  VS was nice enough to tell me which line the issue was on, so I could fix it.  Awesome.  I spent about 30 minutes reading through the code up until about line 1500.  Then I thought I’d get some more basic stats.

The inline JavaScript consumes over 3600 lines of the source.  There were cases where the inline scripts were 520 lines, 423 lines, 400 lines, 300 lines and so on down.  Do you feel ill yet, I sure do.  The inline style sheets took up another 260 lines.

Next, the comments left in the code indicate there’s something not so top-notch going on.  A couple noteworthy samples: “Daniel Test for in the morning”, “Debugging Comments” “Combined html for optimization.” (oh, the irony) and the best one, “ADDED THIS CLOSING DIV BECAUSE IT WAS IN ORIGINAL CODE, CAN'T FIND MATCHING OPENING DIV”  I can see Daniel has his work cut out for him.

The part that makes me see red is that when you look at the 3600 lines of JavaScript, you learn that essentially you have been served “everything”.  The scripts look at the URL you are on and determine what to display and how to display it.  They look at the cookies and determine what ads to serve up (and damn is there a lot of ad code).  They contain huge blocks of HTML code depending on what section you are in.  For example, apparently, there is something called a “dashboard”, which is customized to whatever section you’re in.  There’s Business & Travel, Boat & Beach, Golf, and Schoolday.  Guess what?  you got served the HTML for all four dashboards, and your browser will determine which gets displayed!  Also, your browser figures out where you came from and displays special graphics depending on it, like if you came from Google or from Home Depot.  and if you come from Home Depot and there’s a storm, you get different graphics.

I don’t have a problem with most of that.  It’s clever and creative to vary the look at feel according to your partners and tie it in to the current weather.  But the base problem is: this can all be done on the server.  Looking at the URL, looking at the cookies, showing and hiding elements of the page based on those values.  It’s like code from 1990 – it’s not even ASP-grade code.  Even your typical ASP programmer would filter out the HTML for sections that aren’t relevant.

I just don’t get it.  It absolutely boggles the mind that a major web site could have a page that is so grossly inefficient as to possibly cripple the web servers that serve it.  And can you imagine the bandwidth costs?  The web page code specifically forces you to get all the linked scripts using what they term “cache-busting”.  I’m starting to feel ill again, so I’m going to stop now.

Published May 23 2009, 04:54 PM by anachostic
Filed under:
Comments

 

lvyani995 said:

shoes <a href="http://www.myshoesreview.com"> shoes </a>

shoes <a href="http://www.myshoesreview.com"> shoes </a>

Cheongsam <a href="www.myshoesreview.com/.../48"> Cheongsam </a>

Minimalist Wedding Dress <a href="www.myshoesreview.com/.../64"> Minimalist Wedding Dress </a>

fashion <a href="http://www.fashionreviewtoday.com"> fashion </a>

fashion <a href="http://www.fashionreviewtoday.com"> fashion </a>

Wedding Dress<a href="www.fashionreviewtoday.com/.../77"> Wedding Dress </a>

Short Hairstyles<a href="www.fashionreviewtoday.com/.../79"> Short Hairstyles </a>

June 6, 2010 10:35 PM

About anachostic

That's me. Seek and ye shall find.
 
 
Copyright © . All Rights Reserved.
Powered by Community Server (Commercial Edition), by Telligent Systems