Skip to content

What does triple-equals mean?

Many developers have their favorite programming languages, often to the point of religious fervor (case in point the C# vs VB.NET debates amongst Microsoft developers). I’ve never been one to be too religious about the language I use – I always like to choose what’s best for the job at hand (and anyway C# is WAY better than VB.NET ;-)).

I’ve used lots of different languages over my career and even though I’m quite partial to the tools I use every day like C# and SQL I’ve always been particularly fond of scripting languages, specifically the programming language of the open web: JavaScript. The instant feedback you get with JavaScript (and any scripting language actually) is a joy when programming. Yes – it’s not as structured as other languages and does lend itself to some general hackery (often brought on by each browser having a slightly different interpretation of the “standards”) but it’s very powerful, very flexible and genuinely a joy to use (at which point in the last 2 paragraphs did I signal myself as a geek?).Even though I love programming in JavaScript, I believe one of the most important decisions any web development team has to make is what JavaScript library they’ll choose. I know some of you will have a tendency to build your own but in almost all cases if you’re building our own you’re doing it wrong. Just look at Protoype or JQuery or YUI or Dojo or MooTools and you’ll understand a lot of continuous effort goes into these libraries and all the hard stuff (including those annoying browser inconsistencies) are abstracted away so you can get on with the important job of building your application.

I usually separate libraries into 2 categories:

  • core libraries (like Prototype) extend the language, deal with browser quirks, allow for an unobtrusive event model, deal with JavaScript’s notorious scoping issues, clean the floors (some web geek out there will get that joke) and lots more
  • widget libraries (like Script.aculo.us) extend the core library, tend to be based more around web controls and user interface components and depend on the core library to enable it to do cool stuff

At Xero we chose ExtJS. ExtJS started life as a widget library extending (hence the name) the Yahoo User Interface (YUI) core, however over time it’s grown into one of the best standalone libraries available (combining both widgets and a robust core library into one). While most libraries tend to be open-source, ExtJS is one of the only libraries with a commercial license (though they’ve recently changed their tune on that with the release of ExtJS 3.0 Core with an MIT free software license). The fact it’s commercial wasn’t a factor for us – it’s the quality of the library that won out over it’s rivals. It’s quite beautifully built, and even though it had some quirks and does require a learning curve to understand those quirks, it’s extremely powerful and allows for the creation of some quite stunning user interfaces. I recommend giving ExtJS a look (even if you currently use another library it’s designed to sit on top of other core libraries if you prefer them (such as YUI, Prototype and JQuery) so you can just use it when you need it).

Xero Grid

Widgets based on or extending ExtJS are baked into our user interface – the invoice grid is an example of our custom implementation of the ExtJS grid control. Obviously we had our own requirements, but the programming model is so good it was very easy to extend and incorporate our touches to their existing control. ExtJS is very easy to style giving us complete control of the look and feel of their controls so that it fits within our own tight design guidelines.

Another example of ExtJS is our new Help Center. The entire user interface of Help Center is completely built using JavaScript with ExtJS at it’s heart and is a great advertisement for the power of ExtJS in building functional cross-browser user interfaces. ExtJS works on the concept of panels – in Help Center we have custom panels, tab panels, tree panels, grid panels, windowed panels, custom panels – all built at runtime and receiving content through Ajax calls to the server side.

Help Centre

Working on an application like Xero gives the team here a lot of scope for playing with different technologies and applying them to complex interface problems (usually brought on by our design team). Fortunately for me I absolutely love trying to solve them.

Triple Equals

Oh – and triple equals (i.e., ===) in JavaScript is basically an absolute truth (equals in value and equals in type). For example: try this in Firebug: 0 == false, 0 === false – first one returns true and the second one returns false.

 

Read more about Developers

 

10 comments

[...] suggested in my last post the user interface for the new Help Center is built entirely in ExtJS sitting over an ASP.NET MVC [...]

alex
24 April 2009 #

is that for the actual go.xero website only, cause the marketing one has references to protaculous and jquery, or do you just use a mixture of frameworks all round

Craig Walker
24 April 2009 #

We actually do use a mixture of frameworks (we started with Prototype in the app before moving to Ext and still reference the library for legacy assets), but I was talking about go.xero.com and help.xero.com.

Adam
25 April 2009 #

Ahh yes, strict equality.

Here’s a related one for you then: this should take you back to comp-sci 101.

if(2 == 1 == 0) {
console.log(“All things being equal…”);
}

Nathan
28 April 2009 #

Adam,

In 2==1==0, 2==1 is evaluated first and the result is false. As in JavaScript 0 is considered as false therefore false==false. The above expression will always return true.

Good comment, really got me thinking.

Andrew
28 April 2009 #

Thanks for the interesting article. What do you use on the server to process your AJAX requests from ExtJS – e.g. HTTP handler, webservice, etc? Interested to hear your recommendations.

Craig Walker
28 April 2009 #

@Andrew

Tough question – it depends on what server side technologies you’re using.

For help.xero.com we’ve got an ASP.NET MVC back-end so all the calls are made to restful interfaces returning JSON objects. Essentially I’m using the MVC site as a restful web service. Within the application we use an HTTP handler which marshals calls through to objects based on attributes. Both approaches return .NET objects that are then serialized to JSON before being returned in the response.

I have also played with ExtJS over a WCF web service (again returning JSON) – WCF is a bit of a pain but there are plugins to ExtJS that make it easier.

One of the keys to any kind of AJAX web application is to forget the X part – whatever server side technology and approach you use you should always be returning JSON as it uses less data across the wire and is faster for JavaScript to parse. Having said that AJAJ doesn’t sound quite as cool as AJAX (and doesn’t it have to have an X in the acronym to be Web 2.0?)

Craig

Andrew
28 April 2009 #

Thanks for your feedback Craig (sorry I should have mentioned that we use ASP.NET). Definitely agree with your comments regarding JSON. We’ve been looking at spicing up some of our user interfaces for a while now and I’ve always thought Xero is a great example of what can be achieved with Javascript and AJAX.

Cheers,
Andrew

Erik Allik
26 June 2009 #

Just curiosity, but has .NET and ASP.NET proven to be a good choice for you? Which parts/features/advantages that .NET has have really paid off for you?

online software
23 March 2011 #

I am .net web developer and wants to say you thanks! for your information carry on…………….

Add your comment





We welcome all feedback but prefer a real name and email address.