YUILibrary - Open source JavaScript and CSS for building richly interactive software.
Fork YUI on GitHub
  [ 7 posts ]

Luke Smith

YUI Developer

  • Username: lsmith
  • Joined: Thu Aug 28, 2008 7:50 am
  • Posts: 237
  • Location: Sunnyvale
  • Twitter: ls_n
  • GitHub: lsmith
  • Gists: lsmith
  • IRC: ls_n
  • YUI Developer
  • Offline
  • Profile

YUI: Open Hours Wed July 14th

Post Posted: Tue Jul 06, 2010 10:59 am
+0-
The next YUI: Open Hours will be Wednesday the 14th. We're trying out this Wednesday thing in hopes of catching more folks in later time zones that would otherwise be hitting the pub going into the weekend :)

This time we're going to focus on a recurring theme for YUI community contributors that are just getting started building their own modules: How to build a Widget and how to build a Plugin in a YUI 3 way.

Anthony Pipkin, aka apipkin of #yui IRC channel fame, will be the guest, guiding us through his learnings over the last year and showing how to move from copying and pasting the YUI 3 documentation examples to feeling confident that you're making the right choices for how to approach a problem in a "YUI 3 way of thinking".

We'll take a look at two of his simpler Gallery modules, the Button Widget and the Node IO Plugin. He'll discuss what they looked like originally, versus today, and why they changed.

Then we'll play around a while, maybe build something from scratch based on what the folks on the call want to cover.

Matt Sweeney (Node, Selector, TabView, Grids, etc) and Satyen "the Guru" Desai (Widget, Plugin, Base, Attribute, etc) from the YUI team will also be on the call. So there will be best practices in the house.

For YUI 3 consumers that aren't (yet?) contributors, this call should still be valuable for understanding the thinking behind how YUI 3 widgets and plugins are built and what sort of patterns to expect from new YUI components. And no doubt there will be other great takeaways as always.

So add your 2 cents here for finer points that you want to discuss, or just get the conversation started early!

Anthony Pipkin

YUI Contributor

  • Username: apipkin
  • Joined: Tue Nov 10, 2009 9:34 am
  • Posts: 34
  • Location: Atlanta, GA
  • Twitter: apipkin
  • GitHub: apipkin
  • Gists: apipkin
  • IRC: apipkin
  • Offline
  • Profile

Re: YUI: Open Hours Wed July 14th

Post Posted: Tue Jul 06, 2010 11:11 am
+0-
I was thrilled when asked to show some of my stuff and I am hoping to bring something worth while to the table. But I'm looking at these things from being there and having done that, so please feel free to ask (lots and lots of) questions and we maybe we can make something new by the time time runs out. If there is something you know that you'd like to get some answers to, go ahead and reply to this post, and we will be sure to include them (and possible solutions) in the discussion.

Luke Smith

YUI Developer

  • Username: lsmith
  • Joined: Thu Aug 28, 2008 7:50 am
  • Posts: 237
  • Location: Sunnyvale
  • Twitter: ls_n
  • GitHub: lsmith
  • Gists: lsmith
  • IRC: ls_n
  • YUI Developer
  • Offline
  • Profile

Re: YUI: Open Hours Wed July 14th

Post Posted: Mon Jul 12, 2010 2:55 pm
+0-
I'm going to have to push out this Open Hours to next Wednesday. I'm running behind on some upstream code for code freeze Friday.

I've really been looking forward to this episode, too. Aw well, delayed is better than canceled.

Satyen Desai

YUI Developer

  • Username: sdesai
  • Joined: Tue Dec 09, 2008 4:17 pm
  • Posts: 249
  • YUI Developer
  • Offline
  • Profile

Re: YUI: Open Hours Wed July 14th

Post Posted: Mon Jul 12, 2010 3:02 pm
+0-
Consider it karma for this:

lsmith wrote:
Satyen "the Guru" Desai


Satyen "Not really the Guru" Desai

Anthony Pipkin

YUI Contributor

  • Username: apipkin
  • Joined: Tue Nov 10, 2009 9:34 am
  • Posts: 34
  • Location: Atlanta, GA
  • Twitter: apipkin
  • GitHub: apipkin
  • Gists: apipkin
  • IRC: apipkin
  • Offline
  • Profile

Re: YUI: Open Hours Wed July 14th

Post Posted: Mon Jul 12, 2010 4:55 pm
+0-
I'm looking forward to this, but an extra week will give me some more time to learn some new tricks. Thanks for the heads up Luke.

Hammad

  • Username: aSmartLondoner
  • Joined: Tue May 26, 2009 8:27 am
  • Posts: 38
  • Location: London, UK
  • Twitter: hammadtariq
  • Offline
  • Profile
Tags:

Re: YUI: Open Hours Wed July 14th

Post Posted: Wed Jul 21, 2010 8:11 am
+0-
I am thrilled by the subject, widgets are exactly something I am looking into and again yes, knowledge of best practices at least gives you the confidence to share your code.
Not hitting the pub hour but essentially the time when I am mostly underground, commuting back home here in London. :-)
Will try to catch you as soon as I get home, would need a UK telephone number if that can be arranged and for that call, is that a conference call? (sorry my first time ever to get into these things) would my skype work?

P.S Luke you got me here, this thread is for 14th July and linked from 21st July blog post: http://www.yuiblog.com/blog/2010/07/20/ ... july-21st/

Luke Smith

YUI Developer

  • Username: lsmith
  • Joined: Thu Aug 28, 2008 7:50 am
  • Posts: 237
  • Location: Sunnyvale
  • Twitter: ls_n
  • GitHub: lsmith
  • Gists: lsmith
  • IRC: ls_n
  • YUI Developer
  • Offline
  • Profile

Re: YUI: Open Hours Wed July 14th

Post Posted: Wed Jul 21, 2010 12:16 pm
+2-
Here are some takeaways that I jotted down during the call:

Upcoming in 3.2_
Was going to be a larger release, but was shortened to focus on the mobile experience. Still, full of updates and new features, like
* Transition module for css3 transitions to take advantage of hardware acceleration when available.
* More submodularization of code that previously forked internally based on which browser the user is in. So use('moduleA',...) might resolve to moduleA-ie.js or moduleA-webkit.js. This has size and performance implications (in a good way).
* History module is being replaced with a new lighter implementation
* Synthetic events can now be defined to support delegation
* Offline cache utility
* And finally, grids are back in YUI 3 with a new leaner approach using inline-block

I'm personally really excited about the new grids, and look forward to earlier adopter feedback.

There was a bit of explanation around the pattern
Code:
function MyPlugin() {
    MyPlugin.superclass.constructor.apply(this, arguments);
}
Y.extend(MyPlugin, Y.Plugin.Base, {...}, {...})


that was eventually obviated by
Code:
Y.Plugin.MyPlugin = Y.Base.create('myPlugin', Y.Plugin.Base, [], {...}, {...});


and Satyen mentioning that he will be creating a new method to avoid the odd empty array in there. I'm curious if folks think it would be valuable to document this explanation given the latter method is effectively the new recommended way to create subclasses.

Include @since (some version)
in your API docs (if you use YUI Doc) to denote new methods or attributes added after the initial module offering.

initializer (provided by Base) is where to put instance-construction-time code rather than in the constructor function itself. All instance attributes will be set up before initializer is executed.

this.publish( someEvent, { defaultFn: someBehavior } );
in the initializer facilitates an indirect method call to someBehavior, allowing implementers easy access to tweak the behavior of the code. So rather than

Code:
handleResponse: function (response) {
    this.get('host').insert(response, this.get('placement'));
}

which could only be modified by clobbering the handleResponse method or using Y.Do.before/after (read up on these, they're pretty cool, too).
Code:
handleReponse: function (response) {
    this.fire('success', { response: response });
}
_defSuccessFn: function (e) {
    this.get('host').insert(e.response, this.get('placement'));
}

would allow subscribers to the success event to modify the response text or take action before or after the content was applied to the host object.

And finally, a little code pattern that seems to be coming into vogue right now:
Code:
// original
function (foo) {
    if (!foo) {
        foo = "defaultValue";
    }
}

// before
function (foo) {
    foo = foo || "defaultValue";
    ...
}

// after
function (foo) {
    foo || (foo = "defaultValue");
    ...
}


This avoids an unnecessary assignment if foo is set coming into the function. It should be noted that jslint complains about this pattern and it compresses to 2 more characters than the "before" pattern. But it has the performance of the "original" pattern with 3 fewer characters. It's a bit idiomatic, though. It may become a common defaulting pattern, but probably for now it would be a good idea to include a code comment explaining that it's just applying a default value if not set (or otherwise falsey).
  [ 7 posts ]
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum