Hello! I'm Angela, and this is my scripts archive, where I store anything from little scriptlets to bigger web applications. All scripts are available via linkware, which means: it's free! All I ask is a link back from you. :)

FF: Website optimization

Entry posted on 2008-08-29 12:00 pm

One of the things I’ve realized when I started working for Yahoo! is the importance and “interesting-ness” of website performance optimization. In an industry where things can get repetitive (how many <p> tags can you code in one day?), the challenges brought about by ensuring a website is properly optimized in terms of performance and page load is welcome and quite engrossing.

With high-speed Internet, a lot of times we tend to forget about the size of the files we put up on the Internet on our websites, much less worry about how long someone takes to load our website. It’s easy to forget, but when you’re on a crappy dialup or using your mobile phone as a model (er, like me while transitioning houses!), or you’re, say, a trouble-checker for one of the fanlisting networks out there, the wait for websites to load can take its toll, and feel painful on the pocket.

Two reasons why optimizing websites — even if you’re not Yahoo! — are:

  1. You keep visitors longer, because the wait time is less, and people like things faster than you can chug them out. It’s all about instant gratification these days.
  2. You save on bandwidth! Something smaller by even 10kb can mean megs or gigs of bandwidth savings in the long run. If you pay for hosting and you have a fairly popular website, this is a big deal.

A lot of this work is done on the frontend side of things. After all, once the server has cobbled together the page, the bulk of serving the page code and objects rely on the user’s connection. The HTML code is just one part of what’s served out to people, but images, stylesheets and other media are downloaded all after the source is available. And these are the things that users see and perceive. The image below shows around a third of Firebug’s Network tab on one of my websites:

Building and serving out the page takes up only 715ms. But the rest of the objects on the page are then loaded, and I end up with a 4.08-second load time. That isn’t so bad, but all the rest of the objects on that page form the bulk of the load time that users have to endure. If we save a few milliseconds from each object, overall we can get a snappier load time for the whole page.

In The Psychology of Web Performance, Andrew King highlight a few interesting results of bloated load times, in case you’re still not convinced:

  • Google found that moving from a 10-result page loading in 0.4 seconds to a 30-result page loading in 0.9 seconds decreased traffic and ad revenues by 20% (Linden 2006).

  • Tests at Amazon revealed similar results: every 100 MS increase in load time of Amazon.com decreased sales by 1% (Kohavi and Longbotham 2007).

Over the next Frontend Fridays, I’ll talk a little more about some ways to optimize frontend performance. I’ll mostly be going through the rules Yahoo! has published, but I will probably cherry-pick and talk about the ones I like most, the ones I like doing. Stay tuned :)

FF: Another look at skinning websites

Entry posted on 2008-08-22 12:00 pm

I’ve always liked themes and website skins, the type where visitors can change the look of a website using a switcher. I even made a script for it. I think they’re a fabulous tool for making a website interactive, and giving users the power of choosing how they want to experience the website in question. This is most useful and prevalent in forums and boards, where users are many and varied: some prefer reading in dark environments, and some prefer lighter ones.

But of late I’ve been thinking that theming and skinning websites isn’t all that great, especially viewed in certain conditions. To clarify: I’m talking about a theme or skin being more than a color-only difference between themes/skins.

I realized that one of the drawbacks for me is the false sense of “interactivity” in the website. Understand, the websites I’ve skinned are all smallish fansites and fanlistings, containing minimal updates. Skinning has become one of the most popular “interactive” features of a fanlisting. Unfortunately, it’s lulled me into feeling that it’s “enough”. Which is a bad place to be for anyone who owns a website. More content and other forms of interactivity should be the focus; there are plenty of other ways to do that.

It’s lulled me into keeping old layouts around. I’m ashamed to say a couple of them are half-assed layouts that are there because the more skins there are, the nicer the website is! And, why skin a website when you only have two skins? So keep them all and give the users choice. Uhm, wrong tactic there. Skin retirement should be done semi-regularly, to keep layouts fresh and up-to-date.

I also can’t help but feel that there has to be some brand dilution there somewhere, unless skinning is carefully managed, of course. You have a subset of users using one skin, another subset using another, and unless these skins are quite similar (like the really nifty Day/Night skins I’ve seen crop up recently) the users of skin 1 will tend to approach the website differently from users of skin 2. Websites who’ll have these problems will probably be few and far between, but I can’t help but feel that this is a valid concern.

I certainly feel that skinning is one aspect of website interactivity that one should take a look at when planning a website, but shouldn’t be taken lightly. It adds a bit more complexity to managing the website and the users of the website, but when done well, it’s a fun feature for visitors. I still can’t get over the Day/Night skins some websites use; if it would work for one of my websites, I’m soooo there! ;)

But for now, I’m steering clear of skinning until I’ve real reason to use it.

Yahoo! PH Developers’ Evening

Entry posted on 2008-08-19 2:02 pm

I flew home to the Philippines on Thursday for the Developers’ Evening with Yahoo! Philippines (which I blogged about here), and met quite a number of Philippine web developers and chatted up a couple of friends in the web industry.

Sharing the the Yahoo! Developer Network with RP developers - photo by Jem Seow

The event is basically a networking session with Philippine developers, with a bit of overview on what YDN is: a free resource for web developers that contains not just information, documentation, and tutorials on the various APIs Yahoo! has, but also a couple of tools and articles to help developers (like YUI <3).

There were lots of shop talk, which was definitely fun and a lot more of the same would be fabulous. :D I’ve never really attended networking sessions before, as I’m generally a bit of an introvert when it comes to approaching people and introducing myself, but the night went quite well and I had a great time. I hope everyone else who was part of it felt the same. :)

As I had a pretty busy week last week due to the event preparations and travel, I hadn’t been able to work on last week’s Frontend Friday! Sorry about that, but I promise I’ll have something this week, and will also prep for next week’s FF (I will be Internet-less next week (save for when I’m at the office) due to moving out!).

Frontend Friday: Too much AJAX

Entry posted on 2008-08-08 2:00 pm

Alex asked in last week’s Frontend Friday:

I just wanted to know how you decide how much AJAX is too much AJAX? You don’t seem to use much (if any) on this website.

It’s a good question, but the answer isn’t too straightforward: it will always depend on a large number of factors. For me, an indication of a developer/team getting too AJAX-happy would be when the site becomes unusable when JavaScript is turned off or isn’t working. For example,

  1. a website that loads all (or most) of its content via AJAX, therefore rendering the page content-less without JavaScript; or
  2. a website whose navigation is inaccessible without JavaScript.

JavaScript should enhance websites and applications, no doubt about that. Most, if not all, of the well-loved web apps of today are due to the snazzy-ness of AJAX. But we can’t always rely on JavaScript being present: even if users have it turned on, spotty connections and unexpected data returns can result in JavaScript being pretty much nonexistent. Progressive enhancement and/or graceful degradation should be important when working with JavaScript–whether or not you’re doing asynchronous calls or not.

However, like I said, the answer isn’t straightforward. Some applications really do rely on the existence of JavaScript, and for good reasons. Graceful degradation can be prohibitively difficult when you’re dealing with some specialized web applications, like mail: Yahoo! Mail and GMail come to mind. User interactions with both of these are so fine-tuned and uses a lot of convoluted interlocking parts, and degrading gracefully would be a pain. That’s why both apps have a no-JavaScript version as well (Mail Classic and Basic HTML view, respectively).

As for the second part of the question–no, Indiscripts doesn’t use any AJAX :) Mostly because I don’t see a need for it, or the “need” to use AJAX is lower than the time I have budgeted for designing and coding up my tech blog ;)

Frontend Friday: Got questions?

Entry posted on 2008-08-01 3:03 pm

For this week, I’m doing a free-for-all: if you have something you’re curious about in terms of HTML, CSS and JavaScript, post your question in the comments and I’ll cover your question in future Frontend Fridays. Nothing is “too simple”, so feel free to post questions (please try to keep clear of Enthusiast-only questions though! ;) ).

The reason for this (rather abrupt) post is that due to my rather freaky schedule this week (I’m moving by end of the month, and we’re hopefully signing a tenancy agreement this coming Monday, finally), I wasn’t able to prepare for this week’s Frontend Friday. I had a draft in the works but unfortunately, it needs more research than I have time for this week.

Let me know in the comments! :)