Web Programming Theory

Warning, this is a nerdy post. Moreso than normal even.
As I was visiting a site this morning that was having problems and spitting out random PHP error messages, I was reminded that I wanted to write up something about web programming. No I’m not going to name the site, but they should know better. And this is not a post bashing PHP, because like many things PHP can be used for good as well as evil.
During one of our web redesigns at ONElist , a couple of our very smart engineers developed a new templating system, called CS/HDF, named after the two types of files that are involved. Later, Dave Jeske and Brandon Long wrote an open-source version of CS/HDF, called Clearsilver. It’s an excellent implementation, and it’s what we use for Bloglines.
I won’t go into explaining how Clearsilver works; the web site’s got some pretty good docs in that regard. But I want to mention the design philosophy of the system. Basically, Clearsilver forces the developer to seperate application logic from the presentation layer. What does that mean? Before Clearsilver is given the chance to build a web page, all variables required for building that web page are populated. Once Clearsilver takes over, no additional data is input, no database calls are made, nothing. By the time that Clearsilver is processing the page, the application knows whether it was able to fetch all the data and whether there were any errors in processing it.
How is this good? A couple of reasons. First, since the display layer is already extracted, it’s very easy to redesign the look of or internationalize the web site. No need to worry about messing up any application logic while editing templates. Also, there will never be any mysterious error messages showing up in the middle of the page whenever something fails. By the time the template is processed you know for certain whether you have all the information you need to display the page. That makes it easier to craft error dialogs. Ever been surfing a web site, and you see half the page come up, and then wait 30 seconds for the rest of the page to complete? That happens when the data required for the web page is fetched after the page has started to display. That makes it much more difficult to craft good error dialogs. If I want the look of the page to completely change if there’s an error, I can’t do that if I find out about the error after half the page has already been sent to the client web browser.
Again, I’m not bashing PHP. I believe you can program in this style using PHP as well, but it’s not enforced. The language is not important (although Clearsilver is very good and deserves more recognition). The seperation of application logic from display is what matters.


I’m confused by something I’m seeing with Technorati. If I search on http://www.bloglines.com, it says that there are ‘1106 inbound blogs’. So then I go to the Top 100 listing, Bloglines doesn’t show up. If I’m reading things corrected, we should appear at about number 64, right after Gawker. But we’re nowhere. Strange. Maybe I’m misunderstanding something?

Thoughts on Orkut

Everyone else is talking about Orkut so I figured I’d add my two cents. I played with it a bit this morning. The interface is ok, but I’m surprised they didn’t go for more of a ‘Google-like’ look. I think that would have served them better. I was very surprised to see them using Microsoft ASP. I’m not terribly familiar with Microsoft’s web hosting solutions, so I won’t comment on the technical merrits. But it’s really surprising that Google would be willing to put up with the cost of a Microsoft based service. Imagine all the licenses needed as the service scales up. Google believes in throwing tons of small servers at a problem; imagine if each required a paid copy of Windows.
As of this evening, it looks like they’ve taken the service down due to scaling problems. I did notice a few slow page loads this morning. I don’t wish scaling problems on anyone. Success is good, but not being able to handle the traffic is an experience you never want to have to go through a second time. A database/registration driven system, like Orkut or Bloglines, is a very different animal to architect than a search service like Google. Fun to do, but very challenging.

My New Phone

So, like apparently everyone else, I got a Treo 600 yesterday. I only upgrade phones every 4-5 years, so this is a big deal (my last phone was a Nokia 6120). I’m with AT&T Wireless, and finding and purchasing the phone was very difficult. Most stores in the SF Bay Area haven’t gotten them yet, or the few that have received a shipment sold out quickly. I got the last one from the Santa Clara store.
The form factor is great, the keyword is very workable, the sound quality is a huge improvement over my last phone. The speakerphone even seems to work ok. I love the fact that I can ssh into machines at work from this little device. You wouldn’t want to code an app with it, but it’s a good safety net.
The downside is that, as it’s a GSM phone, the coverage is almost non-existent in my house. I have found a couple of places where it works. Luckily one of those places is upstairs within hearing distance of our bedroom, so midnight pages won’t go unheard. I have 30 days to decide whether there is enough coverage at home to keep the phone. I really want to keep this thing, but the lack of coverage might be a deal-breaker.