gooLego: Google’s software building blocks

Google Inc.
Image via Wikipedia

Over the past few years, Google has open sourced several projects that provide some commonly used building blocks in any large software project. Some of them I was aware of since when they were launched (like protobufs), while others I discovered only recently. I couldn’t find any location where all the projects were listed together and combing through Google Code looking for them was painful, so I’m putting together a list myself. Hope some of you find it useful.

  • protobufs: Platform agnostic messages. Critical for any distributed system. Note that protobufs only provide message serialization/deserialization (for various languages). An important missing piece is an RPC framework built on top of them. There are several projects attempting to build one using protobufs, but none of them are robust or mature enough for production use.
  • style guide: The importance of a style guide is probably understated. It is not about what is the “right” style — it is about consistency. While people may have different opinions, if everyone follows the same style, the code becomes much more readable and maintainable. Google maintains style guides for C++ and Python.
  • config flags: Another important building block for all command line programs.
  • logging: Self-evident. Google’s logging library supports various log levels and other useful macros.
  • core dumper: A very nifty library — it allows you to dump core from within a running application. Extremely useful for debugging production systems.
  • perftools: An extremely useful library for measuring and monitoring performance of programs. By simply linking against perftools, your application gets a much better malloc, heap checking, visual CPU profile of various routines (via graphviz), visualization of memory usage etc.
  • googlemock: A framework to quickly build mock objects — useful for testing.
  • googletest: Google’s C++ unit testing framework, built on top of xUnit. Integrates well with googlemock.

Of course, this is not an exhaustive list. There are numerous other open source projects from Google, some of them probably much more bigger and visible than the ones listed above — such as Wave, Go, GWT etc. If there’s a project that is a software building block that I missed out, do chime in the comments below.

Enhanced by Zemanta

Reconsidering Vim

NOTE: This post is not about the editor war — so please don’t try to start one either.

First, some background. Lets just say that I lost my editor virginity to Vim. It was a brief, but violent introduction — the modal editing was too unfamiliar, the learning curve too steep. After dabbling with a few other conventional editors (such as KWrite), I settled upon Emacs (XEmacs actually, but thats another story).

For the next three years, I tweaked my .emacs file, fiddled around with settings and plugins and modes, played games and browsed the web, checked my email and newsgroups, all within the comfortable confines of Emacs. But I was getting wary of the long startup times and (at that time) the inability to use the same interface and features in console mode (such as over SSH) as in GUI mode. It was time to move on.

I rediscovered Vim around 6 years ago. I started with a clean slate. As the saying goes, Emacs is an operating system that also happens to have an editor in it. The relatively more focused feature set of Vim was refreshing in comparison. I loved that I could work in GUI mode, save my session, go back home and resume my session in a terminal over SSH, which the exact same interface and keybindings. I quickly became very productive with Vim, and over the years have honed my plugins, settings and color themes to just how I like them.

But recently, I’ve been thinking about this again, and I might just reconsider Vim. I highly recommend reading these two blog posts to better understand where I’m coming from:

Don’t get me wrong — I think Vim still has a lot to offer. But, I can not deny that Vim is not what I would call a “forward looking editor.” Here’s why:

  • Development community: the Emacs development community is a lot more open and vibrant right now than the Vim community. Part of this has to do with the BDFL model in Vim. Bram Moolenar has done a tremendous job in bringing Vim to the stage where it is. People can and have forked Vim in the past. But for one reason or another, Vim has stayed Vim, and its development trajectory has been slow and incremental.
  • Source code: Vim’s source code is not clean. At all. I just briefly skimmed over the source tree for Emacs 23, and it looks a lot more understandable and well structured.
  • Architecture: Vim 7 finally got spell check. But the spell check does not use any of the existing tools or formats. Vim has its own scripting language, with its own interpreter, grammer and data structures. Why not just use one of the many wonderful programming languages out there? Yes, there are interfaces to allow writing Vim code in Python, Ruby, Perl etc. But why reinvent the wheel all over again?

When Bram Moolenaar — the lead developer of Vim –  joined Google, I had hoped that Vim would generate a lot more interest and enthusiasm. But so far, it hasn’t changed much.

And so, in the next few weeks, I’m going to take another look at Vim as well as Emacs. I’ll try to do an objective evaluation of where the editors stand today, where I perceive they are headed. I hope to make my decision on whether to move away from Vim or not by the end of this year.

Reblog this post [with Zemanta]

easyJet blues

EasyJet
Image via Wikipedia

Over the past few years, the domestic airlines industry in the US has seen a steady decline. Faced with the recession, they have been devising ever new ways of squeezing money out of unsuspecting customers. There are a few exceptions (such as Southwest), but by far, flying is usually not a very pleasant experience for me.

Little did I know that European “budget” airlines are, in fact, even worse than their American counterparts. I recently had the misfortune of traveling on one such airline — easyJet. There was nothing easy about the experience, and if it is up to me, I will never ever travel on easyJet again.

First, let me provide some context. We were planning to do a break journey in Europe on our way to India. In the past, we have always carried two checked bags and one hand bag per person for India trips, for obvious reasons (such a long journey, may be once in a year — you just end up carrying a lot of stuff. Even more importantly, you end up bringing back a lot of things!). Unfortunately, just a few days before we were scheduled to fly, American Airlines decided to start charging a $50 fee for the second checked bag on flights to Europe/India. This actually was not that big of a problem, since we had one flight on easyJet and they already had similar restrictions in place.

Actually, I find easyJet’s baggage policy extremely strange. Here are some salient features (emphasis mine):

  • Every item of standard checked (‘hold’) baggage will incur a fee.
  • Payment of the fee provides you with an aggregate allowance of 20kg across all pieces of hold baggage which may only be increased by payment of excess weight charges.
  • Where checked-in hold baggage exceeds 20kgs in weight (subject to the above rule), each passenger will pay an excess baggage charge per kg.

Finally the fateful day arrived for our easyJet flight. At the check in counter, the gate agent weighed our “hold” bags (1 per person). Since we had been deliberately careful about packing, they were both less than 20kg each so did not pose a problem.

Next came the hand luggage. Now, in prior communication with easyJet, I had been told that easyJet did not impose any weight restrictions on the hand bags, as long as they fit in the overhead bins. To quote the website (emphasis mine):

Save where the limits set locally are more restrictive, passengers are permitted one standard piece of hand baggage to a volume limit of 55x40x20cm (including wheels and pockets) (“Standard Hand Baggage”). It must fit without force into the gauges provided at check-in or departure gates. No weight restriction applies within reasonable limits — i.e. a passenger must be able to place the piece of luggage safely in the overhead storage bins without assistance.

I have traveled extensively with the hand bags that we had and never ever had any problems with any airlines. I’m convinced that our gate agent was determined to give us grief, by the rude manner in which she dealt with us, her hostile attitude and body language. In any case, she asked us to show that our hand bags “fit without force” into the bin. Unfortunately our hand bags were shaped more like bags and less like suitcases (which is what the bin was designed for), so they did not fit comfortably, but they did fit.

I tried to explain the agent that we never had problems with the bags before, that they were empty on the top so looked bigger than they actually were. Furthermore, we were in transit to an international destination, and had no issues in the first leg of our flight (on American Airlines). But the gate agent was simply not ready to listen — it was almost as if she had made up her mind to spoil our morning.

Arguing with her was frustrating since it was not really a dialogue. I might as well have been talking to a wall. She would not listen to reason, or show any compassion. Worried that we might miss our flight, in a moment of panic, I decided to just pay whatever fee was required, and get on with it. Big mistake. As it turns out, easyJet not only charges for the number of checked bags, but after 20kg, there is a per-kg excess baggage charge, which needless to add, is exhorbitant. Long story short, we ended up paying a ridiculous fee for our hand luggage.

To add insult to injury, while waiting in the gate area for boarding to begin, I counted at least two dozen passengers whose hand bags were at least as big as ours, if not bigger. There were bags in all shapes and sizes, and several which could not have fit into the bins no matter what. I spoke again to the ground staff and they deferred saying that we had to discuss it with the airlines. It turns out discussing anything with easyJet is not easy either — they don’t have offices at most airports they serve, finding a phone number on their website was a challenge, the online customer support was basically just boiler plate responses.

It was an extremely frustrating and disappointing experience. I was extremely angry at that time and had thought I’d take this up with easyJet as soon as I got back. But just thinking of the time and energy it would take just to get to speak to some human at easyJet who would actually try to listen and understand our situation is disheartening. At least, I’ve learnt my lesson.

Reblog this post [with Zemanta]