Sep 11

CommonJS: Bridging client and server, and why JavaScript desperately needs first class modules

JavaScript, Tech 4 Comments »

millenium bridge

(function(require, exports) {
  "use strict";
  // ...
  exports.x = 21;
}).apply({}, typeof require === 'function' ? [require, exports] :
               [function(g){return function(id){return g[id];};}(this._modules = this._modules || {}),
                this._modules['example/foo'] = {}]);

Ouch. This is one of many variants of boilerplate hacks that folks are using to get CommonJS modules playing nicely with browsers. The CommonJS list has been sparked by the question of client vs. server, and how to deal with the two worlds.

First, “Mark Miller has posted a recommendation on the TC39 wiki for CommonJS module boilerplate that permits modules to be crafted for use as <script>”.

And, then we have Kris Zyp’s proposal for an asynchronous module definition “based on the ideas from Transport/C and recent changes discussed.”

There seem to by two high order bits:

What is the focus of CommonJS?

The project started as “ServerJS”, and many server side JS folks started discussions. However, then other browser JS lib folk got into the mix. Folks who deeply care about module systems for the client as well as the server.

There are varying degrees of interop here. On the one hand folks want to be able to have the work that “makes Foo a module” work in both contexts. But further down we run into issues like: how does legacy code work? Do you have to wrap it? How? And finally, the browser needs to be able to load code asynchronously whereas the server doesn’t have the same issue.

Node is taking off like wild fire. Should Ryan be stopping to think about the browser? Does he really care? Or is he more focused on making a great event driven server environment that uses JavaScript?

What common libraries should we be creating as part of the “SDK” of JavaScript so to speak?

How do we hack on support :/

When we get into the “how” it gets messy quick. Messy can be hand-waved away if you assume that everyone will be using build tools and the like, but a ground swell of comments have been about the developer ergonomics of working on projects. How is it to debug and write applications? Do you get the basics: correct line numbers, no need to run builds all the time, etc? And then there is the performance aspect of the final production code.

All of this has just shown me how desperately we need a first class concept of a module beyond the client-esque “script” and function wrappers. Could you imagine showing the apply() code from above to a Java programmer? “Erm, you can’t just import?”

ES4 tried to give us programming units, packages, and namespaces. How about ES.next giving us one simple system to get us out of this CommonJS mess?

Sep 07

How is your Time Porfolio? Staying Healthy and Sane in Tech

Personal, Tech 2 Comments »

time spiral

I really enjoyed reading Alex discuss staying healthy at a startup and his quest for balance.

I am going through a similar journey myself, and it isn’t easy! I seem to be going through a cycle (often recursively) of:

  • Measure
  • Plan
  • Execute.

I don’t have a lot to offer the space. There are a ton of books on the subject, and I am far from a master, but here are thoughts that I have been having as I watch my own progress:

Measure

I have a tendency to jump into things and want to fix everything at once. In this case, I normally sit down and write out a new process and charge off on that path. This time around, I tried to start with measurement. What is the realistic starting point that you find yourself in? To keep it simple, I would track where I am spending time (you can do so in your calendar, in notes, whatever). It is hard to hold off judgement as you see the reality of your time portfolio start to time through. The act of tracking time will quickly have you a little shocked at where your time goes. Draw out an ideal time portfolio before hand, and see how it compares (not just for work, but everything in your life. You are only one person :).

A friend was talking to me about J.D. Rockfeller and how he measured his businesses. He discussed how most businesses don’t measure anything. Some measure where they are. Better ones measure trajectory, Great ones measure their acceleration.

I now try to have that in the back of my head when I think about measuring goals. For example, the dollars that you have in the bank is interesting, but to plan, how much better is it to know how it has been growing, and how FAST it has been growing.

Plan

I really liked this segment of Alex’s post:

I’ve found that time management has little to do with “lifehacks” and how you manage your email inbox and more to do with prioritization, saying “no” to people, and clearly communicating the expectations you have for yourself and others.

Yes! It isn’t about gimmicks.

I find that a lot of people have a quick look at “GTD” and think all they need to do is write down tasks that need to be done. The core principles go beyond that and discuss much more. I have fallen into the “what am I doing today”-only trap. What happens when I am planning in the weeds only is that I keep putting one foot in front of the other quickly, but if you don’t look up, you find yourself in the wrong place when you eventually do!

The plans that I am trying to make now have different levels to them. I have the high level goals, and then closer objectives with tasks falling out that can get me baby steps to my goals. Family Wealth is a book that has you think about family planning in a very different way, and time span. Think: 100 years, not 20 years. I have found that if I can articulate and have long term goals well thought out, then when I come down the stack and do more near term plans, I can measure them against the big picture. There are other side effects too. I can be more tolerant to tasks or things that would bug me, as I know that the act of participation or completion are getting me closer to goals.

Execute

Habbit. I have a simple process that I keep tweaking (test a new process, measure! Don’t try to start with The Right Process). I have the process written down simply, and every week has me visit the process and go through the motions:

  • what are my big picture goals, what metrics to I have, how am I doing?
  • Now, what needs to happen this week? How can those be measured?
  • Finally, what needs to happen today. At this point I insert the short daily planning process.

This is my new kata. This gives me repeatability.

It has also shown me a lot. For example, we all know that too many meetings are a pain. When you start to measure, you realise that meetings can be Pure Evil! :)

Earlier, I tweeted this: “MEETINGS: A way for someone to get their priorities pushed on your TODO list.”

Suddenly all of those great plans for the day that you made, that are traceable to higher level goals, are thrown out of the window. This is where you have to get brutal and say “no”. You have to block out time on your calendar to map to your goals. Whatever it takes. If you have to give people time allocations that everyone can spend on a meeting, so be it. WHAT EVER IT TAKES.

Hard work

As a developer, I often look to tools to solve problems. Is there a way to create a new social platform to make this all easier? I do think that better tools in the arsenal could help, but these issues seem to come down to putting the time in and making a habbit. If you put the time in and want to make a difference, you can use post its or Notepad and be effective. If you don’t put the time in, you can use “The 7 habits of highly awesome people social game dynamic money making web 2.0 dot com” tool and fail.

May we all reach out highest goals. Are you going in the right direction?

Sep 02

Onerous terms

Apple, Facebook, Tech 4 Comments »

Steve Jobs on Ping and Facebook:

Facebook wanted “onerous terms that we could not agree to.”

but when I read this, in another time I was reading about other Onerous silly terms:

carmack onerous terms

Aug 31

Node is our turtle shell; Node.js now powers services on webOS

JavaScript, Mobile, Open Source, Palm, Tech, webOS with tags: 3 Comments »

ryannode

At our last Palm Developer Day, Ben and I discussed future APIs for webOS including “JavaScript services” as a way to write code that runs on the other side of the device service bus using JavaScript.

If you think about it, node delivers a services platform for the cloud, so is there a way that we could work together? We got together with Ryan Dahl of Node to try this out, and it turns out that node works fantastically well on a mobile device! Major kudos should go to the V8 team for creating a great VM and to Ryan for writing efficient code that scaled down from the cloud to the device.

Today we announce that node is part of webOS 2.0:

The popular Node.js runtime environment is built into webOS 2.0, which means that you can now develop not just webOS apps but also services in JavaScript. The active Node ecosystem is on hand to provide community support and a rapidly growing library of modules that you can use in your webOS services.

Besides powering the new Synergy APIs, JavaScript services strengthen webOS’s support for background processing and add new capabilities—like low-level networking, file system access, and binary data processing—to the web technology stack.

I am really excited about this move for us. The node community is top class. I get to see this time and time again, most recently over the weekend and this week as I judge the node knockout. There is magic in the air with Node. It feels like the Rails days. I remember being so happy to jump to Rails and get away from the heavy world of Enterprise Java. It was a breath of fresh air to not have to argue with folks about every piece of the stack. “What about JSF with HiveMind and Commons-Logging and ….” Argh! Too. Much. Choice. And, a logging abstraction above Log4J was hilarious :)

Node is low level, yet simple. It is more like Sinatra than Rails. The event-based opinions keep you in good stead, and with cloud solutions such as Heroku and no.de you have great deployment stories, unlike Rails back in the day.

If you check out the modules that are growing daily, and the fun real-time hacks from the knockout you will get a good feel for node.

It feels great to have webOS as the first mobile device that embeds node. With db8 we offer a JSON store than can sync to the cloud (e.g. sync with CouchDB). This stack is starting to look pretty great.

Aug 31

App Stores: Showing users the value of Farmers Markets compared to Wal-mart

Mobile, Mozila, Open Source, Tech with tags: 1 Comment »

applesfarmersmarket

I remember growing up walking past grocers and butchers, and having my Mum stop by to get fresh meat and veg on a daily basis. I look back fondly on that experience, as I contrast it to the later years of mega-stores. When I came back to England for a year stint, a few years back, I was shocked to see that Tesco didn’t just sell food anymore, but had branched out to credit cards and gas and lots of crazy things.

The local stores have been wedged out.

On Sunday, I took my kids to the farmers market (happens most weekends), which is what had me think back to the local stores from my own childhood.

I worry about the food chain these days.

Another sector that I think about is app economies and app stores. I have talked about what an open marketplace could be and Pascal Finette of Mozilla Labs has been doing a lot of thinking in this area.

Fast forward a few months, and we see a new project in a very early stage. Vapour (github repo has been removed) is the Mozilla Labs project that is “An experiment around an Open Web App Store.” I am excited about the project for two reasons:

  • Mozilla is uniquely positioned to deliver a marketplace that focuses on very different values than other companies
  • I see check-ins from two amazing people: Michael Hanson (who did the amazing work around “people”) and Lloyd Hilaiel (who recently joined Mozilla. I tried to hire him there years back, and he waiting for me to leave. Hmm :)

Also, I got to hang with the OpenAppMkt chaps at the Node Knockout get together last night. They have only just begun, and think they will do some great things.

I evangelize the farmers market. I market it. I try to sell it.

I think of the Mozilla effort as the farmers market of app stores. The values are different. It isn’t just about values though, it will be about product. Many folk go to the farmers market because the goods are better. It is incredibly hard to compete with the likes of Walmart. They squeeze the market and force their vendors in a race to the bottom around price. This is the trick that Walmart can play. They can hold on to: “Look, we are giving everyone cheap goods!” It doesn’t matter what they do with China, or how they treat workers. Surely it is all for good if we can get things cheap right?

The same is happening with the major app stores. These platforms sell consumers with a fantastic user experience and looking after their users. No viruses. No “bad stuff”. Clean. They offer true value, but there is always a cost.

The app markets are as strong as wal-mart. I am excited to see new endeavors that change the game and deliver great user value, while also giving great freedom.

Aug 23

Twitter, Relationships, and more

Tech 1 Comment »

Big Tweeter

Twitter isn’t your audience. It’s your community. It’s easy to tell the difference: The guy on stage at the concert is in front of his audience. The people in the stands are in their community. When the concert is over the audience vanishes but the community continues; with or without the man on stage.

The above quote was from hidden frequency, in a response to Leo Laporte’s Buzz Kill piece that discussed his feelings after he realized that his microblogging status updates weren’t getting through…. and no one had been telling him.

It is easy to see that. A lot of people are watching the river of updates in their Twitter client, and if someone stops throwing their own rocks in the river, you may not notice, and instead you will be checking out other rocks. As I often say if I find a bug in my code…. “no, that is a feature!”

I have created a balance with my followers so there is almost always something of value in my stream these days. I have found that I don’t use RSS readers anymore, as by the time I open them, I have already read the good stuff as friends have talked about it.

The HF considers my usage as a problem, but there isn’t one way to use Twitter or any social network. Users find crazy ways to surprise you with the ways they use their services. The beauty of Twitter (and other services) with lists, is that you can enjoy multiple usage patterns. I can watch the entire river hit me hard, or I can go off and read only close friends….. or only updates from web devs, or whatever hat I want to wear right then. It is the beginning of The River (which is much more than Twitter).

With Twitter I definitely feel much more connected to the community. The fact that we are all equals on there is fantastic, and it is easy to jump from community to community. Someone new reaches out, and you instantly have a new friend. So, Leo, don’t run away…. the world is listening, they just also happen to have other people they are listening to, too.

Aug 21

JavaScript! The Doctor Is In.

Bespin, JavaScript, Mozila, Open Source, Tech No Comments »

thedoctors

Dimitris Vardoulakis has created a Doctor. A Doctor for JavaScript that does static analysis on your code to tease out the type information and more.

This is fantastic work, and is something that we were dreaming of when we first planned Bespin. What if the cloud was constantly analyzing your code and returning type metadata back to the clients that were accessing it? That metadata can be used for tasks such as code completion and documentation.

Give it a try to see what comes out the other end. The samples show you a lot, such as polymorphism:

function id(x) { return x;}
id(42);
id('hello, doctor!');
 
// returns
id : function(<number | string>)<number | string>

and prototypes:

function Rectangle(w, h) {
    this.w = w;
    this.h = h;
}
Rectangle.prototype.area = function() {
    return this.w * this.h;
};
var a = (new Rectangle(2, 3)).area();
 
// returns
Rectangle : function(number, number) → any
area : function() → number

and exceptions:

function findLargest(a) {
    if (a.length === 0) throw new Error('empty array');
    var max = a[0];
    for (var i = 1, l = a.length; i < l; i++)
        if (a[i] > max)
            max = a[i];
    return max;
}
function foo() {
    var a = [1,2,3];
    try {
        return findLargest(a);
    } catch (e) {
        return e.message;
    }
}
foo();
 
// returns
findLargest : function(Array[number]) → number
foo : function()<number | string>

and callbacks:

function call(f, x) { return f(x); }
function add1(n) { return n + 1; }
function truncate(s) { return s.substring(0, s.length - 1); }
var n = call(add1, 41);
var s = call(truncate, 'abcd');
 
// returns
call : function(<function(number) → number | function(string) → string>, <number | string>)<number | string>
add1 : function(number) → number
truncate : function(string) → string

Mike Shaver talked about the great work that is coming in JS land right now for Moz…. and it is showing. Can’t wait to see both Firefox and Bespin gain from this all!

Aug 16

Your users are pinching and spreading!; vector graphics matter even more now?

Tech 6 Comments »

Facebook page as a vector example

When you look at the image above, the rasterized graphics look like crap, and the type looks great. We now live in a world where pinch and zoom is changing how your Web application is viewed. In the past we had to deal with different screen sizes, and browsers started to get smarter with their “zoom” going beyond “font size++”, but it isn’t like todays feeling that your users are pinching you, and you don’t know how hard.

The folk behind SVG all cheer. Those who enjoy Raphael as it gives you a nice API to that world, have also shown you this goodness for awhile. In Inkscape we have even have a decent tool:

An Open Source vector graphics editor, with capabilities similar to Illustrator, CorelDraw, or Xara X, using the W3C standard Scalable Vector Graphics (SVG) file format.

Inkscape supports many advanced SVG features (markers, clones, alpha blending, etc.) and great care is taken in designing a streamlined interface. It is very easy to edit nodes, perform complex path operations, trace bitmaps and much more. We also aim to maintain a thriving user and developer community by using open, community-oriented development.

There is even a new tool. Leonardo is a new vector drawing tool by Josh (note: who works in Developer Relations with me at H/Palm):

Leonardo is an open source vector drawing program for the 21st century. It focuses on common tasks like mockups, sketches, and presentations with a clean and consistent user interface. It is designed to be augmented by internet webservices and plugins created in several scripting languages.

  • vector drawing with bezier curves and geometric primitives
  • reusable symbols stored in a sidebar
  • integrated creative commons Flickr search
  • building simple multi-page presentations
  • export to PNG, HTML, SVG, Email, and Twitter.

Do you think about vectors more these days?

Aug 05

Google Wave’s Goodbye

Google, Tech 2 Comments »

sydneywave

I remember talking to a friend who joined Google and the Wave (then Walkabout) teams in Sydney. He talked about how he was excited to push the Web in crazy new ways and that he was shocked at how far they had gone. He also said “but I have no idea if people will use this.”

Google-haters will make fun of the fact that Wave hasn’t been a commercial success. “See! They are a 2 hit wonder! Search and Ads!” However, I think that Eric’s spin rings partly true. Google had the balls to do it. They let Lars and an awesome set of engineers take a run and rethinking the way that we communicate.

This is an incredibly hard proposition. Many people live in their email (I know, I know, the kids live in FB mail right?). I find myself loving a Gmail plugin whilst never getting into Wave. Incremental, evolutionary improvement often wins on the Web. The revolutions are hard, but that doesn’t mean that people should stop trying them… and Google has the $ and the need to scale their businesses.

Wave, as well as giving great demo, has brought a lot of cool technology into the commons. Other projects like Novell Pulse and the like are using it. When I was working on Bespin I really wanted to see a world in which Bespin could run on top of the operational transform abilities of Wave. Good things will come of Wave. The engineers have learned a ton, and that will go throughout the company to their other products. Making Gmail incrementally better will be huge. There is the large Google Buzz team making a run for social (a touch play when competitors have massive mindshare and user bases).

I also wonder about Etherpad. That great team shipped off to Sydney to join Wave. I love Etherpad. I still use it at typewith.me and at other clones when that goes down. The vision of Etherpad was smaller than Wave, but incredibly useful. I hope those guys land well. The entire Wave team is top drawer. They were ahead of the game this time around …. and timing is everything.

Aug 02

Rapportive: A fantastic social email service with fantastic service!

Tech with tags: , , 2 Comments »

rapportive

I can’t tell you how much I love Rapportive, the service that makes Gmail better by taking away the ads, and adding in useful information about the sender (teh social).

I have played with “social email” type plugins before, but they always tried to do too much, and rarely anything useful. Email is important to people. You tend to live in it. So, if you have an “add-on” the best thing to do is to quietly whisper useful information into the email users ear as they go about their business.

Once you install Rapportive, your email life instantly changes for the better. When I get an email from someone new I suddenly get a face to the name (via the profile picture), a feel for who they are (from their social updates), and more.

There are other fun side effects. I have had a few spammers de-cloaked for example. In general I feel like I have a leg up in a new conversation. Email feels different to me. I would hate to have it taken away…. which is a great sign.

The team behind Rapportive is equally awesome. They came from the great hacker dojo of Y Combinator, and other investors have come in behind that…. including Mr. Gmail himself.

The reason that I am actually writing this email though, is their service on behalf of their service.

There are a series of emails that I get that come from the same email. A lot of them fall into my “notifications” tag: Follows from Twitter, messages from Facebook, comments from Wordpress, plans from Plancast, etc.

rapportivetwitterfollow

Until recently, Rapportive hadn’t really done much for me there. Then, the team started to show information from the website of some of the companies behind these messages. I then reached out and said, what I really wanted was more meat that could be gleaned from the email. My use case was Twitter. When someone follows me, the more info I have on them, the more likely I am to follow them back. Twitter improved their template email a few weeks back (although for some reason it seems to have reverted for me recently?) but they don’t put in recent tweets from the person. I can see why: spammers would LOOOOOVE that feature. However, I would love to see it as I decide if I should reciprocate the follow! Rapportive could dip into the email content, parse out the fact that @foo has followed me, and show me their Tweets.

I don’t even think it was a full 24 hours later, and @rahulvohra their CEO, let me know that the feature was in place. I tested it…. and it was.

How about that for service.

ps. I love that Rapportive is an extensible platform. You can write “Rapplets” which are plugins for that right bar. E.g. load in Crunchbase information. I do find that some of these bug me when they say “Bob not found on …” when I would rather just not see anything.

I have a bunch of ideas for Rapplets, and after the great response from the team, I have every incentive to writeup thoughts on how to make the service better too. If you use Gmail, you should get this plugin.

pps. It is great timing for someone to build this service. We have had good ole microformats for awhile, and now with Web Finger integration here and there, let alone various services that key off of email, it is coming together that you can actually get a lot of good info based on just an email address.

Loading...