As announced in the WWW2006 conference and as part of the Press Release accompanying the publication of the Mobile Web Best Practices as a Candidate Recommendation, work has started on the development of an open-source Best Practices checker.
It is still at alpha release stage and hasn’t been properly reviewed by the Mobile Web Best Practices Working Group; meanwhile, developing it has been a lot of fun!
First, for once, I was able to code in Python; even though my skills in Python are still rough and my ratio PHP/Python line codes must be around 1/40, I would give all my PHP code for keeping Python code only. For mostly historical and logistical reasons, most of my day to day coding has been (and likely will continue to be) made in PHP, but PHP really looks like an ugly pig compared to the lightness and flexibility of Python. Really.
Secundly, I was able to work with unit-tests from the very beginning; I’m usually doing a lot of database-bound applications, which I find really cumbersome to unit-test; in this case, given that the code targets HTTP delivered content, designing and setting up unit tests was extremely easy, and proved similarly valuable: it’s hard to over-estimate the confidence you get in your code when you know it passes a series of well-defined tests.
Thirdly, while some of the code is really mobile-specific, a lot of it could be used a basis for a more general Web Best practices checker: it can make interesting remarks on form controls (e.g., check whether each control has a corresponding label), on images and their dimensions (e.g., whether the dimensions of the images are defined in the markup and whether they match the dimensions of the image itself), on auto-refreshing and markup-redirect pages, on the proper usage of HTML headings, on the usage of tables layout, etc. Codifying some of these well-known Web design issues in actual tests and code was sometimes challenging, but mostly very rewarding.
Finally, I got to use a nice set of very Webby technologies:
- first of all, the checker uses thoroughly caching for its HTTP requests, thanks to httplib2 which does most of the dirty work;
- given that the checker also does some markup validation, it relies on xmlproc catalog’s handling capabilities to skip any HTTP activity for known DTDs;
- a great chunk of the analysis made rely on SAX parsing; it was my first opportunity to use SAX in some real coding, and I have to say I found it quite pleasant to use
- some of the devil-lies-in-the-details tests for encoding and MIME-types needed careful comparison between the various specifications involved (HTML, HTTP, MIME-Types, CSS among others)
- I got a fairly nice logic/presentation separation through the use of templates; for (potential) compatibility with the Markup Validator, I used a Python implementation of Perl’s
There is still quite a lot of work to be done to make it more robust and more complete; in particular, I need to analyse CSS style sheets for testing some of the best practices: I was thrilled when I discovered cssutils – CSS Cascading Style Sheets library for Python, until I realized it doesn’t implement the most important CSS DOM interface I needed. I’m left with the option of either implementing it myself, or looking at using some other non-Python library (e.g. libcroco). I’m also hoping to use Mark Nottingham’s cacheability engine to implement the test for the Best Practice on caching, if I can get it to play well with the other modules.
But I’m already quite satisfied with all I learnt during this first phase, and the feedback I’ve been able to provide the Working Group based on this coding (which reminds me that I still have some rather thorny implementation feedback to send!).
The code is already available and there are some velleity of an installation document if anybody wants to play with it; if you want to contribute to the project, I very much welcome so; just drop me an email at
<firstname.lastname@example.org> to get in touch!