Archive for July, 2008

Goodbye .clearfix, old friend.

Thursday, July 17th, 2008

You all know the old ‘floated elements inside a container cause the container to collapse’ problem?

Well, up until recently, I’d always just called on an old friend, .clearfix, and he’d sorted it out for me. I met .clearfix three or four years ago, and hardly a project has gone by since where I haven’t required his services. You know, I didn’t really ask him how he did it; he’d just quietly go about his job as I directed him, much like Michael Clayton, but without the gambling problem.

But yesterday, when I asked him to help out a colleague for me, little did I know I’d given him his last assignment.

Something happened early this morning – completely coincidentally. A little bird (or rather a tweet) came by and told me that, despite the fact Blueprint CSS uses .clearfix, .clearfix was no longer the way to go. And to be honest, it was almost a relief; the reason I’d never really asked .clearfix how he did his work was that deep down I knew that he was really a hack, and that if I just turned a blind (or ignorant) eye, then I could just pretend like everything was okay and we could all just carry on getting work done.

.clearfix is indeed inelegant, and really is a hack. And would you believe that the alternative solution is not so tricky…
Using overflow: auto; (or overflow: hidden;) on the container with a width will sort it all out for you.
Rather than explain it all here, I’ll just link to a few articles that have already put further effort into describing this:

So, farewell, .clearfix, you’ve served us well.
…and thank you, MB, for the enlightenment.

World’s first ten iPhone 3G owners

Thursday, July 10th, 2008

Queued outside Vodafone’s Queen St, Auckland, store.

Hi John and Ben!

Vodafone New Zealand release iPhone pricing and details

Tuesday, July 8th, 2008

See the Vodafone New Zealand website.

And wow, the reaction has been nothing less than scathing across the board! I think I saw perhaps one positive tweet, but otherwise there was lots of wailing and gnashing of teeth.

Cost to purchase an iPhone outright:
8GB: $979NZD = $740USD
16GB: $1129NZD = $853USD

Ouch. More detailed pricing and plans are here.

While Vodafone spokeman Kursten Shalfoon says the data prices are sharp by New Zealand standards (and in all honesty, he’s probably right), that’s only because NZ is still behind the rest of the world when it comes to mobile (and fixed line) pricing/performance.
To be fair, a smaller market and fewer market competitors (or as some would say, a monopoly) has dictated this, but people were really expecting something more inline with US pricing.

Ars Technica have a table of global pricing
. While the NZ prices haven’t been added yet, it’s clear that NZ is the most expensive market by a long shot.

The ASP.NET MVC framework

Monday, July 7th, 2008

Jake Scott commented on my previous post and drew my attention to the ASP.NET MVC framework.

Now that Jake mentions it, I do recall hearing something about an ASP.NET MVC framework a while ago.

While this looks like a great step in the right direction, there are already MVC application development frameworks around that can easily produce great front-end code; Ruby on Rails, Django, Cake, just to name a few.

I guess the question isn’t so much ‘why does ASP .NET produce such poor web front-ends?’, but probably something more along the lines of ‘why is the ASP .NET platform chosen to build these sites over other seemingly more suitable platforms or frameworks?’ or even, ‘why are these sites built with a complete disregard for good front-end coding practices?’.

It’s one thing to have the right tools at your disposal, but it’s another to know which tools are the most appropriate for the task at hand, and secondly, how best to use your chosen tools.

Does developing in .aspx produce bloated code?

Friday, July 4th, 2008

This started out as a comment in response to Robbie’s question on my previous post, but thought I’d turn it into another post:

So is it that they are written in aspx which makes them bloated?.

Well, I guess that’s what I’m kinda implying.

Building in the .NET framework with the Visual Studio IDE tends to mean that lots of components and snippets are provided for you. So by default you get things like having all your page content wrapped in a <form> element and you get the lovely __VIEWSTATE hidden input field and stuff like that.

I think that there can be a tendency amongst back-end developers, i.e. .NET, Java developers, to produce something that works well technically, and then take the PSDs that the designer gave them and put them on the front, so you’ve got something that looks like it’s supposed to, and works kinda like it’s supposed to, but with the interface between the front- and back-ends being very ugly, slow, and inefficient. Of course this has an often considerable negative effect for the end user.

While this may be a generalisation, I’ve experienced it first-hand, with developers who struggle to understand, or at least show some care, about good clean lightweight, semantic front-end code that performs well in the browser.
When you’re developing with .NET in an IDE like Visual Studio, you have to put in a bit more effort to get that good code.

Developing in .NET doesn’t necessarily produce bloated code, but I think if you took a look at the average .NET (.aspx) site, I think you’ll find greater code-bloat than in your average hand-crafted-in-TextMate code.

Web site performance

Thursday, July 3rd, 2008

Last week I read Steve Souders’ High Performance Web Sites. While I already have a fairly good understanding of site performance, having completed a fairly extensive performance analysis of tvnz.co.nz a few years ago and being familiar with Yahoo!’s YSlow plug-in for Joe Hewitt’s Firebug plug-in for Firefox, it was good to get into a bit more detail.

But lately, I’ve come across a few sites that have made me cringe; a colleague pointed out a couple of Swiss ones: migros.ch, and gate24.ch, and I came across the new upandgo.co.nz site on newsites.co.nz.

Let’s look at some stats, with vodafone.co.nz (my old gig) thrown into the mix:

Site YSlow score HTTP requests
(unprimed cache)
Size
(kB, unprimed cache)
Size
(kB, primed cache)
gate24.ch F (40) 55 501 49
migros.ch F (39) 85 996 134
upandgo.co.nz F (35) 77 748 284
vodafone.co.nz B (88) 41 195 23

The first three sites are ASPX sites, with bloated, invalid, (W3C) table-based markup, and what appears to be no performance tuning whatsoever. Sure, they are visually heavier than vodafone.co.nz, but being visually heavier doesn’t necessarily equate to looking better, and more often the end-user benefits of the visual components are offset by the performance overhead they introduce.

So, if you’re a web developer and you don’t use, or know of, Firebug and YSlow, stop what you’re doing right now and get familiar with them. Chris Pederick’s Web Developer toolbar for Firefox is also invaluable.

Learn about ETags, far future Expires headers, gzip, script placement, semantic markup, reducing the number of HTTP requests.

These are all vital factors in presenting a great website.
Figure out what you can do to make your site lighter, faster, and more search engine-friendly.