Saturday, May 30, 2009

code reviews, standups, meetings and other ways to spend your work time

   Eveything else except for writing actual code...
   The biggest surprise for me when I had my first internship was how much time was spent doing everything else apart from writing actual code. When I moved on to a full time job, it only got worse. I can understand that a huge amount of time will be spent in requirements and design so that when you get to the actual code you know what you are doing and how.
   What I don't understand is the meetings madness. A prime example is code reviews. I held a code review this week and attended 3 or 4 more. The code review I held had two goals. 
   First, I wanted to get input regarding the code I wrote. I invited a really senior guy who has pretty much written the map reduce framework that I felt the least comfortable with using. His input was invaluable. He identified in a couple of minutes performance issues that I hadn't faced but could come down the road. 
   Secondly, I wanted to show to a junior hire what have I done and how. He is in the baby steps phase of writing map reduce code so he is not yet 101% into the map-combine-reduce mentality...
   From my point of view, the meeting was successful. I got my input and improved the performance and robustness of my code and the junior guy learned a ton from watching a 1 hour conversation and participating in it.
   Both guys had the actual code beforehand and pointers to the documentation of my code that explains what have I done, how and why.
   Then come all the other code reviews I attended this week. I attended both local code reviews and some with remote groups. In all of them, I had no code beforehand and no exact agenda. Agenda was sth like "code review for the gmail application" where gmail is of course millions of loc and we weren't going to review all this in an hour =) Really vague and not making much sense.
   In the meeting, we were going line to line over code without any kind of introduction for the big picture. The result was that all I got from these code reviews is a line by line low level understanding of the code and how to point out correct intendation ! This is not what I wanted to get out of it. 
   So why are code reviews so hard? What are the rules we need to establish for anyone who want to hold a code review meeting or even a meeting? Im not sure yet but hopefully one day I will....

Tuesday, May 26, 2009

writing code for the iphone

   Apart from writing mapreduce code, I like writing code for the iphone. I know it sounds totally incompatible, writing code for some distributed computing framework and for a really small handheld device but I really enjoy both of them...
   It might be because I started coding in GW-Basic back in the MS-DOS 3.3 era. I would write some code and the result was less than aesthetically appealing, but the fact that you had made sth by yourself, that you had the feeling of instructing this weird machine with the noisy fan what to do; that was amazing...
   Maybe the iphone reminds me of the constraints that we used to have in desktop programming. Nowadays developing for a desktop isn't that much about performance as it was some years or a decade ago. 
   You don't have coders writing things like Quake 3's Fast InvSqrt() ;) Or articles trying to find out who was the actual coder behind it:p Nowadays you have API's over API's, VM's, dynamic languages etcetc...
   The iphone is one of the last resorts for people who care about performance. About "The Art Of Computer Programming" rather than how to call a Foo foo = new Foo() and call the appropriate method for this foo object to do whatever needs to be done. In iphone programming you have to care about battery life. You have to care about memory consumption and you know that memory leaks will get your app killed sooner rather than later. You have to do tricks and custom tweak every little aspect of the UI for performance and battery life.
   I guess this post is getting too lengthy so I will stop here. I will write a followup post where I will talk about the actual experience of writing code for the iphone !

i hate pig

well, since i want to blog on mapreduce, I decided to spend some time for my second post about it. The title might be a bit misleading. I love the idea around PIG. PIG is a great abstraction around the Map Reduce framework and I'm lucky to have attended the class of one of the guys behind it. I'm talking of course about Chris Olston . 
However, there are several things I hate about pig:
  • Lazy evaluation. Actually the fact that there is only one mode. The lazy evaluation mode...:(
  • Errors that make no sense. "Can't cast bytearray into bytearray". Why would I want to turn an apple into an apple?!...Another one of my favorites is sth like "Internal error occured" and then a bunch of exceptions that point to the pig source code. no information in the error message and absolutely no indication of where did the error occur in the pig script.
  • kinda slow. Well this isn't a big deal any more, plus most of the times I prefer the fact that I get my sh*t done way faster and in a cleaner way than in Java or streaming in cpp/python but still it's kinda annoying when you end up with a workflow that you could easily save a couple of hours or a couple of nodes if it was faster =)
  • Adding in the previous argument **corner cases**...*sigh* I can't emphasize enough on this. In general, pig is not that much slower than writing in java map reduce for hadoop. But in some cases, you end up with a job that should take 5mins taking 105. I have a job that just finished that demonstrates exactly this "feature". 100 nodes, 105 minutes for some terabytes of data processing...
  • It's not complex enough. I guess it's because of the whole "pig philosophy" but it's still not complex enough. I find myself crawling through UDF's or writing my own to do sth that is really super simple in Java.
I know it looks like pure pig bashing but it's more of a hate-love relationship. I hate pig for all of these but once I write a script in a couple of hours that I know that it's super easy to maintain and document, I feel so much happiness that I just can't resist coming back to her...:)
And of course with that comes the fact that when you assign a heir to this code, it's really easy to explain to him how does the code work. Try explaining complex map reduce code to someone that has no clue about MR heh...!

no on prop8

Yeah I know, I should probably have a mapreduce post as my first one but then the title contains "and random stuff" =)
Well, I am witnessing a series of protests regarding uphelding prop 8 in the CA supreme court. I live in downtown SF so it's hard to miss them! 
I used to be undecided about this issue. I don't have any personal interest in the issue plus I can't vote anyway, however I want to be as politically active as possible, so I was at least thinking about it. On one hand "no on prop 8" has a set of really good argument. On the other hand "yes on prop 8" commercials around the time of elections were all about "teaching kids to be gay" and "allowing gay people to adopt kids". I dont really mind about the first one, plus it sounds ridiculous anyway. I would guess that prop 8 at worst would mean "teach kids to be whatever they want"...
Allowing homosexuals to adopt however, I dont know. It's a tough call....
However screw it, I think that equal rights are above all the other arguments and I am def supporting prop 8 for the past months. Today the protest did nothing else but reinstating my belief.
I hope that gays will manage to pass a new prop or convince the governor and state to allow once again the gay marriages.