Programming land


Map Tile Provider Switch

CloudMade recently announced their will no longer support the free tier which I used to display running races I participate to. I thus moved all traces to using MapQuest tiles instead. There is so few traffic on the blog that I am way below their rate limits.

Thanks to the way I displayed them with the my own plugin using Leaflet in Octopress, I was just changing tile source and credits in my _config.yml:

leaflet_tile_attrib: Tiles Courtesy of <a href="" target="_blank">MapQuest</a> <img src="">

SVG Sprites

Chris Coyier posted an article on CSS-tricks about using SVG sprites and the <use> tag to replace icon fonts.

I am a big fan of SVG, and I actually used the same technique for slides of a recent conference I talked at to build slides with consistent assets. I defined my base shapes in a SVG with only <defs> in the <head> of the slideshow and then reused them in all schemas with no copy paste. Making a change to a shape is reflected at everyplace it is used with zero change.

NodeJS Conference 2014 in Brescia

Had a chance to give a talk with Fabrice Matrat at NodeJS conference, Brescia about a library built on our spare time about synchronizing data between a web application and its backing server. The library has its dedicated website. I was invited to do the talk a second time in Sophia-Antipolis Javscript user group.

Slides can be found here, and follow the base text used. This is not an exact transcript of the conference but is the breadcrumb. This is not meant to be an exact transcript of the talk but rather a sort of guide.

Monster Version Control Repository

Two articles accounting for having a single version control repository retained my attention, one is from Facebook and the other from Google.

In the case of Facebook, they explain the rational is for being able to smoothly refactor code in atomic ways. It makes it manageable to impact two different parts of the project because one does not need to modify at one place then go to the other, upgrade the dependency and do the other change. Just do the change in both and commit.

For Google the rationale of the article is more around integration testing. If one developer commits code in a shared library and that breaks a depending product, then the build for this commit will fail in minutes, not a dependent build a few days later.

I Hate Maps

I am very annoyed by a common usage of Java Map it is not made for. Maps are here to represent a dictionary from keys to values, but it is often used to store unstructured content in place of a standard object.

Map<String, String> dog = person.getDog();
dog.put("name", "Foo");

The general reasoning is that a map makes it more extensible, but it makes it hard to validate the object right at modification time. In the example one would likely include some validate method inside the person object:

Method Chaining Return Values

I personally like to use method chaining and fluent interfaces and think these are great patterns, but in Java then tend to be implemented with a return this and that annoys me. It is generally assumed that methods modify the curent instance and return it, as highlighted in Wikipedia’s articles for method chaining:

possibly the current object itself

and fluent interface:

self-referential, where the new context is equivalent to the last context

This is also stressed in StringBuilder’s javadoc for all append methods:

Returns: a reference to this object.