Jan 20

Why I often prefer Prototype too

Ajax, Tech, Web Frameworks with tags: 9 Comments »

protofun

Picture via Dunechaser

I still get asked “what Ajax framework should I use?” frequently indeed. I think that people feel that with my Ajaxian postings I have seen every framework in the world and will have a magic feel for things.

I dread these questions, as context is king for making the decision, and “feel” is a major part of it too. The various frameworks have in many ways come closer together over the years, so making the choice is harder, but also maybe not as big a deal as it once was.

That being said, I really enjoyed Glenn Vanderburg talk about why he prefers Prototype to jQuery. This is the kind of subject that is asking for trouble and foaming at the mouth from people on various camps. Glenn has the kind of nature, wisdom, and touch that makes it hard to think that way. He gives thoughtful points and isn’t trying to cause a stir.

These days, without any real context (e.g. skills on the team, what the project does) I kinda think:

  • jQuery is fantastic for taking a website and making it dynamic. Easy. elegant. Beautiful. If I was a designer doing a rich site I would stop here.
  • Dojo is fantastic for building a large scale application that will do a lot, and end up with a ton of JavaScript. Everything you need will be found there. This isn’t to say that Dojo can’t be used on the small anymore. The new core is small and fast and good.

Prototype, for me, fits in between these worlds. It is small enough to feel small (not a huge library to learn) yet large enough that I don’t jump out into creating a lot of my own code.

On a recent jQuery project that grew fairly big and I found myself surprised that the core didn’t have certain methods and features. Much of it was small things (one example I remember is array utilities). I would find myself looking around for plugins, wondering which ones are good, and generally having a little bit of a tough time. Then there is a the type system. For something that isn’t strapping on a bit of code to the web site, I actually like Class.extend and the like. With jQuery I would use Traits or Base or something which is fine…. but not just there in the same way.

I get used to myArray.last() and having the convenience methods available to me directly on the objects, even if the puritan in me feels a little strange. Just as Ruby “felt right” to me. Prototype does too (duh, since its heritage). A blend of purity and pragmatism. More often than not Prototype surprises me “oh, wow, it has that function already!” On another recent project that got converted to Prototype, I was able to delete a LOT of code. Utility classes went away. Libraries went away. There is nothing better than the feeling of deleting code. Am I right? :)

So, I agree with Glenn. For me, Prototype is the right balance for many of my projects. I still enjoy playing and using others when the project calls for them, and I am ignoring the huge number of other great frameworks (YUI, GWT, MooTools, Ext, SproutCore, Cappucino, man I could go on forever here).

Jan 19

Frustrating User Experiences: Remember what I say Wordpress!

Tech, UI / UX with tags: 4 Comments »

Wordpress 2.7 is such a breath of fresh air. The admin interface feels great and they fixed so many small things that used to drive me nuts.

One of these items was the file uploader. Here is Wordpress 2.6:

wp26

My use case is that I use the full size image 99.99% of the time. I never want to link to the image itself in the hyperlink. However, the admin interface tries to force me down that path EVERY darn time. I would find myself hacking up the Wordpress code to give me what I want, and then when I upgrade I had to do it all over again. Grr.

Then I upgraded to Wordpress 2.7 and got:

wp27

It remembers. Imagine that! Kudos to the Wordpress team.

Jan 02

Loving Ubiquity; Extending the Web in 2009

Ajax, Tech, Web Browsing 4 Comments »

I have a project that deals with JavaScript commands that anyone can author, so I decided it would be smart to take more time looking and integrating with Ubiquity which recently got another beautiful upgrade.

Ubiquity really is the “other” command line of the Web (the URL bar being the first one). It gives me Quicksilver like access, but also has huge improvements: Writing plugins is simple JavaScript, and you can subscribe to commands from other people. This is huge. A social command-line!

There is a built in tinyurl command, but I use tr.im one these days, so I quickly wrote one:

CmdUtils.CreateCommand({
  name: "trimurl",
  homepage: "http://almaer.com/firefox/commands/",
  author: { name: "Dion Almaer", email: "dion@almaer.com"},
  license: "ASL",
  description: "Sends your URL to tr.im instead of tiny url",
  help: "Just type in the URL!",
  takes: {"url to shorten": noun_arb_text},
  modifiers: {"as": noun_arb_text},
 
  preview: "Replaces the inputted URL with a Tr.im URL.",
  execute: function(urlToShorten, mods) {
    var baseUrl = "http://tr.im/api/trim_url.json";
    var params = "?url=" + urlToShorten.text;
 
    var custom  = mods["as"].text;
    if (custom) {
      params += "&custom=" + custom;
    }
    jQuery.getJSON(baseUrl + params, function(data) {
      CmdUtils.copyToClipboard(data.url);
    })
  }
});

This chap uses modifiers to allow me to pass in a custom url.

The following said that there will be a url following, and you can optionally say “as customname”:

  takes: {"url to shorten": noun_arb_text},
  modifiers: {"as": noun_arb_text},

I couldn’t find a way to just add to the takes hash, as it would be nice to say:

  takes: {"url to shorten": noun_arb_text, custom: noun_optional_text },

After using Ubiquity for some time now, I am really impressed with how the team is accelerating, and I see this as a great way to extend the Web, and Firefox in 2009.

I find myself in a funny place with the key combos for bringing up Ubiquity and Quicksilver in my mind. I am using Quicksilver less and less (e.g. won’t use it to search the Web or do anything with email) and Ubiquity more and more. As the Open Web takes over the desktop (another prediction;) then Ubiquity will gain usage for me.

Atul has released a preview of Ubiquity 0.2 which has a new architecture and a new Locked-Down Feed Plugin (LDFP).

Dec 31

window.resize firing frequency in browsers

Ajax, Tech, Web Browsing 11 Comments »

I was playing with a Web application that did interesting redrawing of the layout (e.g. needed to do JavaScript magic in the onresize event).

I noticed that in Firefox the event took a fair time to fire. Joel Webber (of GWT fame) has also found this and said:

“Firefox and Opera do this wierd thing where they only fire resize events when you let go of the mouse button, or every second or so while dragging. It’s really irritating because there’s no way to get a “real” resize event, and it makes your ui look crappy when it goes through intermediate wrong-sized states.

I’ve always assumed this was to cover up layout performance issues. WebKit and IE fire resize events immediately.”

I wonder if the layout issue is correct, and if so, it would be nice to be able to somehow say to the browser “yup, I am in control of layout so please fire faster” or maybe by defining onresize you are saying that.

With decorators/annotations you would say:

@FireFrequency(ms=10) window.onresize = function() {
  // ....
}

Turns out that Ben was being a good citizen and in going to file a bug, found a couple out there.

Dec 31

Not just social history, actual information from Twitter

Security, Tech with tags: 12 Comments »
<html>
<head>
<script>
 
document.write("This page should show you your twitter info if you're logged in. (If you see a login box make sure you're logged into Twitter)<br/><br/>");
 
// forgive the document.write ugliness
function orly(data)
{
document.write("Your username is "+data[0]['user']['screen_name']+"<br>");
document.write("Your real name is "+data[0]['user']['name']);
 
}
</script>
<script src="http://twitter.com/statuses/user_timeline.json?count=1&callback=orly"></script>
 
</head>
<body>
 
</body>
</html>

What is that is all it took to grab your username and even real name out of Twitter? Try it, it works.

Yowser?!

(via Bill Zeller)

Dec 30

F**k That; Love The Tool You’re With

Tech with tags: , 4 Comments »

Dave Thomas gave a great keynote talk at RubyConf this year titled F**k Ruby (where the term was for Fork ;).

Dave is a very enjoyable presenter to listen too. He always has some of the British humour that I am of course partial too.

I loved how he managed to use the Scottish term Tath:

The luxuriant grass growing about the droppings of cattle in a pasture.

His talk is embedded at the end of this post. The Ruby stuff was very interesting and great, but what stuck with me was the early talk about loving the tool that you work with every day.

As programmers (Dave always titles himself as “programmer”) Dave talks about how we get a blank sheet daily, and if we don’t love the tool that we get to use to make the creation that day, then we will not do the best that we can, and it will show in our work.

I can totally relate to that. Sometimes we may think “use any tool as long as you create somethin useful.” Stick with Java even if you fancy doing something with Rails/Django/… because it is the safe choice.

If you are having fun and loving your tools then you will create (or adapt, which could simply be with config, plugins, or whatever) something so much better. Of course, as I now run a developer tools lab with Ben I don’t think of “tool” as just a programming language, but much more. Your entire environment. The items in the box.

As 2009 rolls around, I can’t wait to create some tools that I love. Something that makes me excited to start building something new. And not only for myself, but hopefully for some of the Web community.

Happy new year, and let’s listen to Dave:

Dec 22

Using the crowd to tell us about browser responsiveness

Google, Mozila, Tech 12 Comments »

addons

A lot of people are talking about the interview with John Lilly that discusses the relationship between Mozilla and Google.

People like to paint think black and white. Either Mozilla is Google’s poodle (Mozilla is to Google as Tony Blair was to George Bush) or there is a falling out and they hate each other.

Of course, the answer is grey as John points out. From my standpoint, focusing on the Open Web, I see more areas to collaborate on than to fight over. When I was at Google I knew that the Open Web was very important to the long term future. Now I am at Mozilla, the same is true. At the micro level there will be differences, but at the macro-level there is alignment.

Switching gears a little, I have had some folks talk to me about responsiveness issues with Firefox 3. I have had a fantastic experience, and currently I run Mozilla nightlies / Minefield / Shiretoka (3.1.*) and WebKit nightlies side by side. I am very happy with the shape that Minefield is in.

Of course, the issue with the extension mechanism with Firefox is that you get a window to the entire world (which has also been a reason that lead to amazing add-ons). Since this is the case a bad add-on can do a lot.

Chrome does a good job showing you basic info about a tab (memory etc). What if we did that and more for add-ons. Give me top for the browser.

Now, this is a lot of engineering away, so can we use the crowd to help out?

What if we created an add-on that would track responsiveness information and send it back (anonymously) to the cloud (say, to Weave). We could use math to work out probable culprits and could even ship that information back to the people using the add-on. Thus, you would then find out that FooAddOn seems to be a culprit that slows down the browser. Maybe it could be called Vacinate-addon.

What do you think?

Dec 16

Learning from Tech Luminaries

Tech with tags: No Comments »

techlum

Chatting to smart people at conferences, and in meetings, got Ben and I thinking about doing an interview show that would allow us to take some time to learn from luminaries in our industry.

We have many shows that talk about technical issues, but what about getting to know the people a little more, what makes them tick, and what brought them to this point?

There is an interviewer named Michael Parkinson who is the best in the business. In the US when Brad Pitt comes on Leno, you learn that he has a new movie, and Leno cracks some jokes.

In the UK when Brad Pitt comes on Parky, you actually get to know the guy, and some fun stories. Parky lets the interviewer talk. He makes them at home and they actually talk to you.

This is what I want to see come out of Tech Luminaries. There are a lot of interesting characters in tech, so let’s listen to their stories.

First up is Brendan Eich. We did this interview back in 2007 before we had any idea that we would be joining Mozilla, which gives the interview an interesting lens.

Brendan is incredibly sharp and is a fun guy to let ramble on about many topics. We have a couple more old ones in the can, and will start doing some new ones, including in video form.

Download the MP3 directly, and you can subscribe via iTunes.

Who would you like to see interviewed?

Dec 15

Still sexist in the valley? Marissa shows that to be true

Tech with tags: 4 Comments »

Valleywag writes about how she “married down”.

Why is that? They claim that he “buys and manages apartments for rich people, a business he somewhat brazenly dubs “private equity.” His business is called “Montara Capital Partners,” which makes him sound like a venture capitalist. He is also a lawyer, sort of, which is definitely several rungs down Silicon Valley’s social ladder.”

Doesn’t that sound so terrible? Mothers are known not to be proud of a child becoming a lawyer :/

This is so obviously sexist. If you turn it around, have you even seen the press talking about how Businessman X has married down because his fiance isn’t as successful as him. No. We never see that. No one expects that a mate do the same thing, or match themselves in the amount of money they make.

It is hard enough to find someone to spend your life with. If Marissa found someone flipping burgers at McDonalds, and they loved each other, congrats. Let along this chap who seems pretty successful to me too.

All this being said, you have to say that he has done quite well. Attractive, rich, powerful. Good luck to them!

And, it is much nicer to read these kind of articles on Marissa.

Dec 14

Deja vu: Still wary of Facebook

Facebook, Tech with tags: 8 Comments »

Facebook Uploads

Sorry, we cannot support uploads sent via email. Upload photos from your iPhone with our free application, Facebook for iPhone:

http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=284882215&mt=8

This is the message that I now get when I try to use the Facebook feature of emailing photos to my account. For a long time, I have emailed an alias on my domain which forwards on to both Flickr and Facebook, get to get photo into both places at once.

My blog brings in these photos from Facebook using Fotobook. Now I can longer use this workflow. Instead, Facebook wants me to stop using the “open” import mechanism of SMTP, and instead wants to force me into the mobile walled garden of the Facebook app on the iPhone. Now, don’t get me wrong, the Facebook iPhone app is fantastically produced by Joe Hewitt, and I have no beef with it at all. I just don’t like being forced into one workflow which will then only work with that one provider. Facebook, by taking away a feature, changed the entire game.

Open protocols give us the ability to develop our own patterns, and tweak the implementation over time. When blogger (and others) allowed us to abstract the implementation behind DNS records, it felt better (as well as being able to export the data out).

Facebook Connect

There are advantages to the walled garden though. I have been really worried about seeing Facebook Connect buttons shown up around the Web. The UX for FB Connect is very nice indeed, which is why I was so worried. The majority of people won’t choose the Open platform purely because “they should”. Open needs to compete on its own rite.

This is why I was so pleased to see Open Connect:

We need to do this quickly, as people will only put “one” of these on, and it should be the open meta platform.

I think that there is a place for the browser to help out here too, as I have mentioned before. If you login to the browser once, and we agree on the protocols, the browser can do the handshake for us. A great UI….. none at all.

Time to “make the Web better” instead of how Facebook tries to “make a better Web”.