August 6, 2008

Refactoring, refactoring… Documenting, documenting…

Posted in GSoC tagged , , at 4:12 pm by fadinlight

(This post has been published after the original date)

During the last week, I’ve managed to learn and beginning to use Dojo packaging features. So I’ve started splitting my cmyk.js file into model and controller chunks, exporting all functions that refers to models into different Dojo class files. After some little issues with relative paths, and after learning how variable and function scope works in Dojo classes, now it works!

I was starting to get worried, because JSDoc Toolkit seemed not to work in my PC at all, founding no suitable solution in the Net. Even switching from open-jdk to sun-jdk didn’t help. But, even in an unlucky period like this, sometimes a little bit of luck comes out… yesterday JSDoc Toolkit version 2.0.2 has been released… and all begun to work very very smoothly!

I’ve had some issues to let JSDoc Toolkit document properly Dojo classes, but, in the end, I’ve managed to let it work, even if it documents some functions as statics even if they’re not, and even if I needed to create some .js mock files just to document the various namespaces of the packages. Probably there could be a way to do all better, but I think I’ve to defer this research. ๐Ÿ™‚

July 30, 2008

The bus factor

Posted in GSoC tagged , , , , at 12:05 am by fadinlight

(This post has been published after the original date)

After talking with Frederik, also regarding what’s happened during the last days (and what’s happening now, and what will happen), we decided to change the scope of the project, aiming at a full refactoring and documenting of all that I’ve done. This has been chosen to reduce Osmarender frontend’s “bus factor” (in my case, the “sheep factor” ™! ๐Ÿ™‚ ). I’m agree on doing this, also because, to have a proper handling of the rule section (as it is very complicated), IMO a better data model is needed.

What’s Osmarender Frontend now

Now Osmarender Frontend is split into two JavaScript files: cmyk.js and osmarender_frontend.js. cmyk.js file is the osmarender’s rule handling library, while osmarender_frontend.js is the gui (sometimes they’re not really separate, to be honest). As I was a very newbie on using Dojo when I’ve started the project, I wasn’t using any Dojo feature at all. At the end, I was very reluctant on using it. Then, after I’ve done a total revision of the GUI, I’ve started to know Dojo better, and I see it would be a proper choice to use its features, beside for the GUI, also for the CMYK (“Customize Maps: Your Key”, or “Cmyk Maps Your Kingdom”) rules handling library itself, using only Dojo core features. Better, using Dojo’s scopeMap feature, I can distribute a fixed version of dojo with the library that doesn’t break anything if, sometimes in the future, another dojo version will be used when calling the library.

What Osmarender Frontend will be

Why Dojo is so attractive? Here I need to speak frankly: I don’t want to reinvent the wheel. If dojo can take care of browser quirks, class declaring/handling, package structuring (the thing I was missing the most!), i18n, querying the DOM, dynamic loading of panels, etc… well, why shouldn’t I use it? ๐Ÿ™‚

Beyond that, as Frederik asked, I’m going to start documenting the code, so I need to use JSDoc Toolkit. Furthermore, even if not really asked for, I want, at least, to refactor the library while using an unit test framework like JSUnit.

So, next steps:

  • Learn how to use Dojo packaging features
  • Learn JSDoc Toolkit
  • Learn how to use JSDoc Toolkit with Dojo
  • Start doing some documentation to test my knowledge of JSDoc Toolkit
  • Learn JSUnit
  • Learn how to use JSUnit
  • Start doing some unit testing to test my knowledge ofย  JSUnit
  • Start code refactoring

In the meantime, Simone Cortesi is coming to my summer house here in Montesilvano on August 4, while doing his sort of “Summer Italian OSM Tour“, to get in touch with the community all over Italy!