Follow this blog Administration + Create my blog

Yoshioka.js - Javascript MVVM Framework

Posts with “#toulouse.js” — 2 posts

Toulouse JS #3

Mercredi 23 Janvier, j'ai fait ma première présentation en public pour parler de javascript à mes confrères toulousains. J'ai cherché à partager l'expérience que nous avons gagné lors du développement du back office d'Overblog Kiwi sous forme d'application javascript en MVC.

Beaucoup de trac face à 80 personnes, comme vous pouvez le constater, des oublis, une expression pas terrible… mais ça a plu ! Je recommencerais très problablement l'expérience dès que possible. J'aimerais évengéliser les codeurs toulousains à YUI3.



Yesterday, I was to a javascript developers conference in Toulouse and I saw a presentation of Ember.js and Backbone.js. Two frameworks I don't know a lot about, and I can compare with Yoshioka. And all that I listened reinforced the fact that the choices I made for the architecture of my framework were not so stupid.



Ember.js is the new name of Sproutcore 2.0. I didn't know and it is very interesting because Sproutcore was the seed in my mind that helped me build Yoshioka. Here's the story.

In 2010, a new real MVC framework is announced, from Apple! Sproutcore. I jumped on it to discover the Grail I was waiting for. Sproutcore was made with a ruby server which live build project files to javascripts loaded on your browser. It provides a MVC pattern and a sort of ORM to communicate with the server. But the bad side was it was very very inspired from Objective-C Cocoa framework from Apple which is very difficult to comprehend. So I gave up quickly, but keeping in mind to retry it quickly.

Then, some months later, YUI3 published some MVC modules in experimental state. This modules was very easiest to use when you have habbit to work with YUI, so I started to work with it immediately. And then, I decided to apply all the great ideas I learn from Sproutcore into YUI3 MVC : live compilation, separation of template files, localizations, fixtures, etc.

Bad sides

The bad sides of this framework is the Cocoa approach and the very closed framework. It is very difficult not to walk into the path. That was the feeling I had 3 years ago and it was the same thing that told Raphaël Rougeron who was talking about Ember.js. With Yoshioka and YUI, you are free and invited to rewrite the wheel every time you need it. I love rewriting the wheel because the wheels never fit perfectly for what I want.

Another bad point is a memory leak. I used to have similar issues on Yoshioka with dynamical locales. Ember comes with a cool feature wich is able to update a variable into a template without full re-render it. It's the same behavior I chose for locales : an element (a span for Yoshioka) with an ID, and an observer which update the value of the node when the attribute of the model change. The problem is this node and observers are very difficult to clean and they are never free to be removed by garbage collector. With a workaround in the way Yoshioka locales are updated, I gain some hundred MBits of RAM. Overblog was able to occupy 600MB of RAM with a eavy use of the app. Now, it rarely jumps over 150MB. Raphaël talked about 2Go of memory on their apps.



Then, Jean-Christophe Queval talk about Backbone.js. I have not a lot to say about it because Barebones is the inspiration of YUI3 MVC modules. So it must be cool :)

But as he said, Backbone is more a toolbox than a framework. YUI3 will give the same design pattern with all the foundations of their framework and all the free available modules. It would be very easier to quickly create a web app compatible with suckin'browsers.


Finally, Cyrille Bogaert showed us a demo of a web video game using web socket to make multi players sync their positions in a game. This demo gave me an idea for trying improving performances on Overblog. I hope I will have some time to experiment the replacement of Ajax JSON-RPC by a theorically very quicker web socket between client and server wich will directly communicate with internal API by using Thrift.

Fork me on GitHub