The Fringe Benefits of Failure, and the Importance of Imagination by J.K. Rowling

I recently stumble upon this speech given by J.K. Rowling at Harvard. She talks about failures (her own) and how it helped her to become the one she is today.

One of the things that I took away with me is the importance of failure. Everybody is so focused on doing everything right, being the best and that failure cannot be an option. We are so afraid of messing up because we believe that doing so will be the end of the world.

However, failing is actually a big part of life and something we should not be afraid of.

Good judgment comes from experience, and experience comes from bad judgment. - Fred Brooks

So if you are trying to accomplish something, don’t be afraid if you will not make it the first time, because chances are that you probably will the second or third time around.

J.K. Rowling on Vimeo
Transcription and video on Hardvard Magazine

Adding Tiger Stripes to Tables with jQuery

I have been a Prototypejs fan for a long time, but I finally got around to work with jQuery and it is truly an amazing framework.

In the old days when I would want to add stripes to my tables (with a class named tiger), I would have done something like this.

Doing it old school

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
window.onload = function () {
    var i, n, tables, table, trs, tr;
    tables = document.getElementsByTagName("table");
    for (i = 0; (table = tables[i]); i++){
        if (/\btiger\b/.exec(table.className)){
            var tbodys = table.getElementsByTagName("tbody");
            if (tbodys.length == 1){
                trs = tbodys[0].getElementsByTagName("tr");
            }else{
                trs = table.getElementsByTagName("tr");
            }
            for (n = 0; (tr = trs[n]); n++){
                tr.className += (n % 2 == 0) ? " alternate" : "";
            }
        }
    }
}

With jQuery magic

1
2
3
$(document).ready(function() {
    $("table.tiger tr:even").addClass("alternate");
});

Pretty simple, right?

Clean Code by Robert C. Martin

The book wastes no time, so right form the start you are introduced to some basic, but important aspect of what quality code is all about.

It starts out with naming conventions, how to right comments, error handling, refactoring, Unit testing and lots more. So the book covers a lot of ground and if you are looking to improve you developer skills, then I highly recommend it.

Another good thing is that, it is very well written and contains a good balance between theory and practice.

How ever, if you have already read books like

Code Complete by Steve McConnell
Refactoring by Martin Fowler etc.
Test Driven Development by Kent Beck

Then you probably wont learn very much from Clean Code.

« Previous PageNext Page »