Well its my first post on the openRico blog, so let me introduce myself, I’m Ross Lawley, one of the developers, I joined the project late last summer - after the majority of its functionality had already been released.
I asked to join because I was using the library and hacking it to my own needs, and I thought “why not submit back? then my changes will be available in future editions”. The benefits of this have been bi-directional, I have improved some code and my code has been improved upon! So if you’re in the same situtation and want to help with openRico then contact us, submit bugs (and fixes if you got them
), write documentation, help others in the forums, etc.
Anyway, down to business, over at encytemedia, Justin Palmer has recently posted a great article describing another new feature of the Prototype library that we will see in Prototype 1.5. Its a good read so check it out! In summary, it means if you have an Element method that returns itself, you can chain functions together. Some of the best concepts are simple! This was one of the very appealing aspects of the JQuery library.
What does this mean for openRico? It means in the future we will be able to chain events together with less code, increasing the power of the library. For example, say I wanted to round the corners of myDemoDiv and then fade it - wouldn’t it be handy to apply it straight to the element like so:
$(‘myDemoDiv’).Round(’roundMeClass’).FadeTo(0.2, 500, 10);
It means less code but there may be problems in the future with namespace collisions with different libraries extending the Element object with the same method names. However, using a naming convention will prevent that.
That’s all good - but say you want to round and fade many elements on a page - and you don’t want to repeat the same code over and over. Another new addition to Prototype Selector magic comes to the rescue - here we are applying the round and fades to all divs with the roundAndFade class:
$$(‘div.roundAndFade).each(Element.Round(’roundMeClass’).FadeTo(0.2, 500, 10));
Again these style selectors have been around for a while, the Prototype based behaviour library gave us the power from an early stage, but all this does mean that openRico can inherit the benefits of the increasingly feature packed prototype.
I can’t say that the above code samples will be work in openRico2, but as development of openRico2 starts to move from conceptual ideas to prototypes, expect to see the latest Javascript techniques and goodness incorporated into the code base to ensure the codebase is clean, flexible and above all powerful.
I’ll leave it to Richard to blog about the future direction of openRico, all I’ll say its direction is based upon innovation rather then reinvention…