Scaling and Tools Diversity: Google vs. Facebook

Steve Yegge in one of his posts talks about Google’s policy of standardizing on the use of only a few programming languages. He mentions how he, as a guy interested in different languages, was at first annoyed by that fact, but later came to realize it was the only sensible way of building systems as scalable as theirs have to be.

In what seems to contradict that view, in Facebook’s recent discussion of the decisions they had to make when designing Facebook Chat, they mention choosing Erlang because, well, it was made to do distributed, realtime systems with… message passing. Can’t get a better fit for a Chat project than that.

To make that code interface with their existing codebase, they used Thrift, their free software “framework for scalable cross-language services development”, whose white paper begins with the strong remark:

“In our implementation of these services [Facebook], various programming lan-
guages have been selected to optimize for the right combination of performance, ease and speed of development, availability of existing libraries, etc. By and large, Facebook’s engineering culture has tended towards choosing the best tools and implementations available over standardizing on any one programming language and begrudgingly accepting its inherent limitations.

Now, of course Google and Facebook have very different needs (crawling, storing, rating and indexing the whole web on a regular basis must be a bit more challenging than showing user profiles — even if it’s showing many of them, many many times a day), and playing safe has surely worked out well for Google so far. But sometimes that requires reimplementing Ruby on Rails in Javascript just to suite a company requirement.

It’s good to see there is a place in the monster-traffic world for programming language enthusiasts :)

Power-Set Method For Ruby Hash

# The Array power set is stolen from http://snippets.dzone.com/posts/show/3524
class Array
  # Returns the "power set" for this Array. This means that an array with all
  # subsets of the array's elements will be returned.
  def power_set
    # the power set line is stolen from http://johncarrino.net/blog/2006/08/11/powerset-in-ruby/
    inject([[]]){|c,y|r=[];c.each{|i|r<<i;r<<i+[y]};r}
  end
end

class Hash
  def power_set
    # Returns the "power set" for this Hash. This means that a array with hashes of all
    # subsets of the hash's (key => value) pairs will be returned.
    # Example:
    # >> {:feedback_type=>"", :language_code=>"", :comment=>""}.power_set
    #
    # [{}, {:comment=>""}, {:language_code=>""}, {:language_code=>"", :comment=>""}, {:feedback_type=>""}, {:feedback_type=>"", :comment=>""}, {:feedback_type=>"", :language_code=>""}, {:feedback_type=>"", :language_code=>"", :comment=>""}]

    hash_to_array = self.to_a
    array_power_set = hash_to_array.power_set
    hash_power_set = array_power_set.collect { |pairs| pairs.inject({}) { |hash,pair| hash[pair[0]] = pair[1]; hash } }
    hash_power_set
  end
end

Pushed into design?

Here I was, cruising through Agile Web Development with Rails in the hope of finally wetting my toes in the web coding sea, thankful that it looked more and more like i’d have to do little to no design (html/css always freaked me out) when, suddenly, I bump into this essay from Getting Real saying I should design the interface first.

It even quotes some guy saying how awesome it was that when he was to build his web app he got all the html/css done first and how much that helped him.

I think I really don’t have this gift of making things pretty. I mean, I thought that I’d flip another page and find out that Rails beautifies things for me and all I have to do is enter the code. Can’t one just code and be left alone?

Alright, I can make paper sketches of things but, really, doing graphical design looks like somuchwork.

Posted in Uncategorized. Tags: , , . 1 Comment »

New report says: employees like to do extra, dirty work

Call me a masochist.

But for the past two days I’ve been in ecstasy at work for having gotten the wonderful chance of laboriously cleaning up after someone else’s mess. It’s not even my fault, it’s a lot more work, I have to painstakingly go through dirty and ugly code, but I’m LOVING it! I’m the employers’ dream-worker!!

I’m not real serious about that dramatic opening, though, so I’ll explain.

That huge load of junk was getting in MY way. All those gazillion redundant, ill-commented, ill-defined, sorry excuses for classes were making my absolute LOVE for work drop to a shameful procrastination spree. And now I finally got the chance to make it nice and clean and elegant and pleasant.

So here’s a tip to employers and managers out there. Don’t just give your awesome tech guys something cool to work on. Give them the power to clean up the trash they find along the way. They’ll stay hours after work and they’ll love it! And after cleaning up they’ll work with a lot more passion on whatever it is they had to do.

Posted in Uncategorized. Tags: , , , . Leave a Comment »

Method juggling with Ruby

Some amazing things Ruby lets you do.

Just recently found out you can actually yank a method from one object, shove it into another one and call it regularly like it had been there all along.

The details are at: http://www.ruby-doc.org/core/classes/UnboundMethod.html

Can’t think of any practical use for it right now, but it might just be one of those things you never thought you needed because you never thought you could.

Posted in Uncategorized. Tags: , , . Leave a Comment »

Learning Ruby (poignantly)

Since I started reading about web applications, next generation web, Web 2.0 or whatever you want to call it, I’ve been itching to get my hands dirty, go on and do something myself.

(When I say “do something” I mean getting a hang of the technological aspects involved in its implementation because, although the rest of the concept – social software, writeable web and all – interests me greatly, I’m sure not up for starting something up right now)

Bad thing is, I have no talent for design and my coding skills stop at some basic-level college C. And as I haven’t really decided to become a full-blown web developer all of a sudden, I think diving into HTML, CSS, Javascript, XML and all that would be a little too much to learn just to start playing around.

Then Ruby came to mind.

From what I’ve heard, Ruby is at once a great language for system administration – like Perl – and has that nifty Ruby on Rails framework for developing web software. And since I’m a loving Linux user and might get a kick out of getting a bit more into the server admin business, writing scripts and all, I thought I might get a good start at both (server admin and web dev) by learning Ruby.

That’s when I found this great, wacky and surprisingly fun tutorial: Why’s (Poignant) Guide to Ruby.

Ok, if you already know the basics of any other programming languages some things might feel a bit patronizing. And if you’re in a rush to learn it all very quick you’ll find it a bit dragging and miss the fun. But it’s sure a very entertaining read, it’s free (as in beer and speech), and besides giving you a good laugh (with cartoon foxes), it also actually teaches you the language.