Monday, December 7, 2009

Australia Post requires the www?

It has been like this as long as I can remember:

post.com.au <- doesn't resolve
www.post.com.au
<- resolves

How could this go unnoticed for so long by such a huge company with such a good (short) domain name?

Wednesday, November 25, 2009

Toolin' around with web applications

I'm currently on holidays. My job around the house for yesterday was to replace the hinges on the pool fence that had rusted. According to Laurie Lawrence, pool fences should be auto closing - Kids alive do the five!

Anyway I spent almost two hours on this task over two separate days trying to install the hinges. The problem was, I was trying to use the screws that came with the hinges which were clearly not designed for use with a metal gate.

My toolkit looked like this:
- Wood screws
- Cordless drill
- Drill bits
- Screwdrivers

But I still had a lot of trouble getting these darned screws to go in. So instead I tracked down an extension cord and pulled out a corded drill, thinking that the underpowered cordless drill wasn't do me any favours.

The added power of the corded drill certainly made things faster, but ultimately didn't help me succeed. I would either destroy the threads on the screws or end up drilling a hole that was too big for the screws.

Finally I got hold of some screws designed for metal, and the whole job was done properly in literally less than five minutes.

The lesson that was reinforced to me is that using a whole bunch of good tools doesn't come anywhere near the efficiency of choosing the one correct tool for the job.

I get this feeling when writing web applications too. For a basic Java Enterprise Web App, I typically choose a set of technologies like this:

- A templating language (e.g. Freemarker, Velocity)
- Javascript
- HTML
- A Javascript framework (e.g. jQuery, Prototype)
- Some sort of Widget Library (e.g. jQueryUI, Scriptaculous)
- CSS
- Spring MVC

This list is extremely abbreviated of course, as anyone involved with Java Web Development will know. The entire list of technologies is probably triple or quadruple that length.

But these are the core technologies used to display a web page. What bothers me is that the first FIVE of these end up in one file! I end up using 5 tools to accomplish the single goal of displaying the web page.

This is incredibly difficult to read and understand, especially considering that the technologies are fundamentally different. Some of the code is evaluated on the server side, and some on the client side, some before the page loads and some after the page loads, and yet the code is all mashed up together. Code generating code that generates code that generates code for multiple browsera to interpret.

Even though this approach works, it still feels like I'm trying to use woodscrews in a metal gate.

Server side templating seems like the wrong way to do things. I think we need to focus more on client side development toolkits - RESTful services and some better Javascript and Ajax Tools could completely replace our current web frameworks, but I just don't think the tools exist yet. Maybe the entire MVC model could be pushed down into javascript on the client side. Or maybe we could have some better abstractions or DSLs for browser control beyond HTML and javascript.

Tuesday, November 17, 2009

Dumb analogies in the news

This just in:


IBM has created the world's largest business computing "cloud" capable of holding the equivalent of 250 billion iTunes songs.
...
If that amount of information were in the form of text stuffed into four-drawer file cabinets, there would be enough of them to ring the planet, according to IBM.


Are those analogies really useful? Does IBM really think we are impressed by such a nonsensical comparison?

I enjoyed x646d63's take on it:


Storage capacity: 250 billion iTunes songs
Computing capacity: 800M Chimp-Mensa Candidates
Physical size of network: 300,000 slightly above average elephant toes
Electric consumption: 3.6M 60Hz gerbil wheels

Monday, November 2, 2009

It's funny cause it's true

“The problem with object-oriented languages is they’ve got all this implicit environment that they carry around with them. You wanted a banana but what you got was a gorilla holding the banana and the entire jungle.”—Joe Armstrong

Monday, October 26, 2009

Dependency Injection Makes Your Code Worse

Read my article which explains why, and feel free to comment:

http://java.dzone.com/articles/dependency-injection-makes

Sunday, October 11, 2009

understanding monads - thanks to jQuery

In my previous post I wrote about jQuery:

...if you simply wrap the "this" keyword with $(), it magically somehow becomes a jQuery object...


I was taking a short break from watching Bathurst and googling monads again... when I came across this great blog post. It turns out that the magical things I love about jQuery are a monad!

I feel like I'm a little bit closer to understanding monads now, and I'm happy to have a name to describe the magic I was using without knowing what it was.

Go Lowndesy!

Wednesday, October 7, 2009

jQuery - using "this" in a .each() function

The "this" keyword can be used in two ways inside a jQuery callback function. If you use "this" in the callback below without putting the $() around it, you will get a reference to the HTML element selected by the $(".currency") class selector.

However, if you simply wrap the "this" keyword with $(), it magically somehow becomes a jQuery object, and you can use all the regular jQuery functions on it like .text() and .val()

$(".currency").each(function() {
$(this).text(formatCurrency($(this).text()));
});