Best Books of 2011

Just like in 2010, 2009, 2008 and 2007, here goes the traditional book of the year post for 2011! This year my reading list included design, history, and lots of JavaScript.

Here goes the list, in a completely arbitrary order of personal preference:

“Design for Hackers” by David Kadavy

It all started, around August, with a conversation with Paul, my cousin from London, the founder of Zerofee; we were talking that while designers could easily find tutorials and documentation to learn about software development, it was much harder for developers to find material about design, at least to learn the basic concepts.

Somehow, David Kadavy must have heard us, and he came up the following month with this great book. I have recommended it to every one of my students since I read it; it is built like a computer book, with clear explanations, diagrams and lots of pictures; every concept is described in detail, including historical references and examples.

David provides a healthy introduction to design, going through subjects such as fonts, proportions, color theory, structure, grids, and much, much more.

I insist; this is a must read for any developer, particularly those who, like me, are self-taught and eager to expand their own possibilities.

“Steve Jobs”, by Walter Isaacson

The day Steve Jobs passed away I was in South Africa, giving some trainings in Johannesburg, precisely about iOS. I remember waking up, opening my copy of Echofon in my iPhone, and seeing lots of tweets with just an apple sign on them.

I said to myself, as I started to scroll downwards, that this was it. I sat on the edge of the bed, realizing that it was the end of a huge chapter for the computer industry.

That very same morning, I gave an introduction to iOS to some developers, and of course there was a special thing to that training. Somehow there was a legacy of the guy in every NSObject that we allocated in memory.

Later that same month, I went to the USA and landed in Newark. While waiting for my connecting flight, I was dragging my feet in the terminal, and the corner of my eye saw the book in the shelves of a bookstore.

I read it in about 5 days. There had not been a book that hook me as much as this one in ages.

I will not go as far as saying that this was the book of the year. I won’t add anything to what is already available online about it. It was, without any doubt, the most hyped book of the decade. And it is a surprisingly good one; not biased, very acid in some parts – I guess Jobs would not have liked reading some sections of it. I picture him throwing the book out of the window, outraged, while weeping at some chapters.

I admit, I’ve shed some tears in some parts. All in all, a very emotional piece, not to be missed.

“JavaScript Patterns”, by Stoyan Stefanov

2011 was the year of the mobile web. Not only because some analyst said so, but because the demand for mobile web solutions from companies has increased dramatically in one year. Also because the capabilities of smartphones have grown in such a way that today, web apps are a viable choice for consumers.

This means, by all standards, that JavaScript regains a preeminence on the web; longtime a language that was bashed and forgotten, JavaScript reappears in front of many developers as the instrument by which the mobile web becomes a reality.

This book is a perfect way to rediscover JavaScript; to forget the pain of the past, to see that it is a wonderful language that, as Crockford would say, was hugely misunderstood.

By the way, readers should have read Crockford’s “JavaScript: the Good Parts” before this book; Stefanov builds on top of that knowledge and provides the developer with a fresh bouquet of idioms and constructions that will be useful in every JavaScript project.

Finally, given the rise of Node.js in the past few years, reading it provides also with a solid background for the next wave of JavaScript frameworks hitting the market these days.

“Programming the Mobile Web”, by Maximiliano Firtman

Maximiliano is a genius. The guy has pulled the complete bible, the absolute reference, for everything that has to do with mobile web development. The book is a treasure of capabilities, comparisons, history, and nitty-gritty details about every possible mobile web browser in the planet.

How he does it, it’s his great mystery. After publishing this book, he came up with the great Mobile HTML5 site which, if you haven’t seen it yet, you should.

Even better, he’s argie like I am, and I’ve had the opportunity of inviting him to Zürich last year, to hear him talk about jQuery Mobile. Which reminds me of…

“jQuery Mobile: Up and Running”, again by Maximiliano Firtman

… his latest book; this time, Maximiliano tackled the hottest mobile framework of the moment. I’ve read the book in “early release” mode, prior to the final publication, and so far it looks very promising.

In this book, Maximiliano explains the core concepts of jQuery Mobile, the semantics and the capabilities of the framework, clearly explaining its strengths as well as its weaknesses.

I have learnt a lot about jQuery Mobile through this book, so I strongly recommend it to anyone interested in the subject.

“Mobile Design for iPhone and iPad”, by Smashing Magazine

A very nice and concise eBook by the great people of Smashing Magazine, with great tips and tricks about how to create UIs for the new generation of touchscreen devices. I’ve learnt a lot with this book.

“iPad at Work”, by Apple

Finally, a nice free eBook by Apple, very useful for explaining the iPad and its multiple capabilities to business people; I am personally seeing more and more iPads in enterprise contexts, so I think that this is an important (and small) title to read.

Best books of 2008

You might remember my beloved mantras: learning a new programming language and reading at least 6 relevant books every year. Following the 2007 edition, here’s the list of the 8 books I have enjoyed most in 2008, ordered by a purely subjective and absolutely irrational decreasing preference. I strongly recommend all of them!

Winner: Geekonomics: The Real Cost of Insecure Software by David Rice

Runner-up: The No Asshole Rule: Building a Civilized Workplace and Surviving One That Isn’t by Robert I. Sutton, PhD

And 6 more:

Continue reading

Playing with HTTP libraries

It’s fun to find out how to tackle the same task in different programming languages; in this case, it’s all about doing HTTP requests over a network: fortunately, there are networking libraries in virtually all major programming languages. In my current project, I’m generating wrappers easing the access to the core of the project itself, a RESTful API. This way, developers interested in using the API can just take a wrapper, include it in their projects, and start coding right away. No need to know this (relatively low-level) stuff; just use the API. The wrappers themselves are auto-generated from the API definition itself, but that’s another story ;)

Below there is a sample of the different ways I’ve found to do a network access to a remote server, using HTTP Basic Authentication and a couple of headers, in PHP, Ruby, Python, JavaScript, and even Objective-C! I’m even generating ActionScript 3.0 code, but I’m not a Flash coder :) So I’ll post the wrappers that work best at the moment, and in the future I’ll include other examples, particularly for .NET, C++ and Java.

In all the cases below, there is a “request” function or method that takes an HTTP verb (GET, POST, PUT, DELETE, etc), a URL (without the slash “/” at the beginning) and some parameter data, in the form of a dictionary. The function wraps the underlying libraries of each programming language, offering a simpler interface, and allowing for HTTP Basic Authentication (for HTTP Digest Authentication it would be much, much more complex!). There are synchronous (useful for server or command-line applications) and asynchronous versions (for GUI systems). Off to the code! Continue reading

Now this is ridiculous

Generics in JavaScript.

Who came up with this? Let’s put things in context: JavaScript is a dynamic language. It turns out that this characteristics deeply upsets many people, particularly those who prefer to rely on a compiler to check their code for them before running it. It turns out that these guys also have a hard time imagining their objects in memory, what do they look like, what they do, and so on, and for them ECMAScript 4 will bring types, that is, variables declared both with the var keyword and a special type declaration after the variable name. There is an illusion built around statically typed languages. I know it: I’ve already advocated them as the silver bullet that never existed. But I was wrong, and I admit it. Personally I think that dynamic languages are the future.

The problem with statically typed languages is that “collections” or “containers” of things should also be typed, because otherwise you spend a good deal of CPU time boxing and casting instances, because otherwise you might as well “put a cat in a dog collection” as one commenter put in the Ajaxian page above.

I am sorry but, in the case of JavaScript, the evolution of the current draft is becoming ridiculous, even after you throw in all your arguments about performance, IDE support and who knows what else:

[source:javascript] function reprimand(list:List.< +Employee>) { … } var writingTeam:List. = new List.(); reprimand(writingTeam); // no error if ECMAScript adopts this style of variance annotation [/source]

ActionScript 3 developers can already enjoy this “syntax sugar”. Ugh! Continue reading

That nice freedom of modifying software

One of the best learning tools I have found in my career is to take someone else’s code, and to modify it slightly to see what happens, to play with it, and eventually to release that code in this blog, or send it to the original author, fixing it somehow or adding some feature:

Continue reading

Argentina and the World Clock Dashboard Widget

As you might know, Argentina has changed its timezone today from GMT-4 GMT-3 to GMT-2; as a result, Apple’s World Clock dashboard widget does not (currently) show the correct time for our preferred tango+asado+soccer city.

This happens because the code of this widget calls the “TimeZoneInfo.currentTimeForTimeZone” method (line 582 of the World Clock.js file), which is provided by the runtime, and thus you have to wait until Apple provides a fix for it (please correct me if I’m wrong!).

Since Dashboard Widgets are JavaScript-based, I’ve copied it and created a new one with a small fix in lines 18 and 581 of the World Clock.js file, which makes it show the correct time for my birth city. Of course, this will change in March (when Buenos Aires falls back from GMT-2 to GMT-3) so you might want to fall back to the default World Clock widget when that happens (or when Apple fixes the time zone information in Mac OS X).

You can download the widget! As always, I’m not responsible of any problem it might bring to your system (in mine it works fine though!).

Before and after:

before.png after.png

This was effectively my first time dealing with Dashboard Widgets (something I wanted to do for some time…) I hope to create a real one soon!