2013.03.05

Mout & Modularity

Discussions about modularity are recurrent. Some people say that each function should be a separate module/file/package; others say that methods should be contained by a package and grouped by similarity/concerns; and there is still a 3rd group that thinks that a single namespace is the way to go. I will try to explain the design decisions that influenced the creation and current structure of moutjs and why single function packages are not always the best solution.

Read more…


2012.12.20

My jQuery Wish List

Haters gonna hate but I’ve been delaying for too long to write this one. Since the jQuery team is working to get the version 2.0 out of the door and Christmas is coming it might be a good time to talk about it. Please don’t add comments like “use framework/library X instead!”, the question here is not about which framework/library is better but about things that I think could be improved.

I know that jQuery 2.0 will have the same API as 1.9, this wishlist would be for a future version of jQuery that doesn’t need to be backwards compatible (call it jQuery Harmony or jQuery 3.0 if you will).

Read more…


2012.12.07

esformatter & rocambole

Yesterday I pushed 2 new projects to github, was unsure if I was going to do it since maintaining opensource projects can demand a lot of time but heck, I’m looking for contributors and they can be useful to more people, so why not?

I used editors/IDEs that had a good code formatter for a while and ever since I started doing more JavaScript development I missed a code formatter as powerful/flexible as FDT. I know WebStorm has a very good support for JavaScript but nowadays I’m a Vim user and it’s really hard to make the switch. I wish I could have the same amount of settings on a command-line tool, that way it could be hooked into multiple text editors (Vim, Emacs, SublimeText, Cloud9, etc…), have an external configuration file (so it could be shared between team members) and used to batch-process files. Being written in JavaScript would also be a plus (so it could be used inside the browser and have more contributors).

Read more…


2012.12.03

Why I favor while loops

I remember that my first contact with programming loops was through the for statement and I used it almost exclusively for many years. I’ll explain why I’ve been favoring while loops over for loops in the past couple years. Beware that this is only my personal preference and the reasoning behind it are very subjective. Use what works better for you.

TL;DR: while is less verbose and more clear in many cases.

Read more…


2012.11.09

Avoiding the this keyword on jQuery related code

jQuery implements some nice abstractions for DOM manipulation and browser events, removing a lot of crossbrowser issues and making it easier to accomplish non-trivial tasks. - it also has drawbacks and some poor design decisions, but I will leave that for another post. Maybe one day I will write my jQuery 2.0 wishlist… - Today I will explain why I usually avoid using the magic this keyword inside event handlers and inside most methods that manipulates jQuery collections.

Read more…