Archive for the ‘Java Script’ Category

Incentives for code contribution

Wednesday, February 4th, 2009

On our framework team, we are looking into ways to encourage contributions from our users. Often our users will all need to solve the same problem and if we can work with the users to package their solution in a flexible way, other users can benifit. This means that we will need to set some code standards and work closely with the user to make sure that the code is of high quality and follows conventions of the framework. 

A member of our team came across an internal article from a developer who needed to solve the same problem and had an interesting proposal. This proposal suggested that these contributions could be solicited easier if there was a community established that works to spread the word about contributing and provides incentives for the user’s effort. The user would be rewarded with some sort of a paper certificate at a public ceremony. After giving this some thought, I think this article makes some good points about community management, but falls short in the incentive. Awards programs seem to always be the default incentive idea in proposals to motivate communities but with so many out there, so few chances to win, the (lets be honest) low value of the prize, and the time that would need to be put into selecting a winner. Not to mention that this takes peoples focus off of the passion for their craft and puts it on a pointless contest. I don’t think it is a good option. 

I think we should take the advice about community management and look at other successful community managers around us. One that comes to mind is Yelp. They were able to get real hipsters in real cities to write reviews for them; FOR FREE. These are quality reviews. Their success can be attributed to their Elite Member program. If you write enough highly rated reviews to where the community manager takes notice, you get to be part of an exclusive club. This club has a special mail list and events at posh lounges and restaurants. 

If I were to translate this model too our contribution cause, I would recommend that we start a program where a user could get the prestigious designation of a Framework contributer. They would have to have proven their skill by contributed one piece of code and shown an ability to support their code in the community. Call me optimistic but I think there are a lot of people that are passionate about what they do and we could use that passion as an incentive.

Instance Manager Object

Sunday, January 25th, 2009

I have been using a new pattern for managing instances of JavaScript widgets in applications. I define a widget as any component in an app that is JavaScript enhanced. This could be anything from a DataTable to a button.

In the YUI 2X idiom of interface development, you would create a namespace for a section of your application. All of your instances, constructors, and various other junk would live in the scope of this namespace. My instance manager pattern would slightly change this in that constructed instances of widgets would be stored in a Instance Manager object. This object would be constructed as a member of any namespace that would be home to an instance of a widget. All of these instances would be kept in a sub-object of the Instance Manager which would be known as the “map” object.

The Instance Manager object would have 3 more methods:

  • get
  • set
  • delete

“set” method
The “set” method that can be used to add an instance to the “map” object. Passing the constructor as an argument instead of passing an instance will delay the instantiation until the first time the instance id is called from the “get” method this is known as lazy loading.

“get” method
The “get” method that can be used to return an instance from the map object by passing its key as an argument.

“delete” method
The “delete” method will remove the instance from the map object by passing its key as an argument.

The point of this pattern is to create a consistent way to create and get instances of widgets. This is especially useful for use with the Unobtrusive JavaScript pattern because code written to look for special markup conventions on page load can be generalized