on Apr 27th, 2010Interviews Schminterviews

In the last three weeks, I have panel interviewed about 3 people and have reviewed about 4 others in their interview process. I must say, I am surprised at the level of technical skill most of these candidates exhibit during the interviews. People with lot more years of experience than me go dumb founded when asked trivial questions. I handled interviews for  developer positions and have found it extremely difficult to spot talented people.  There are some, who are really talented,  but cannot express themselves. And then, there are people, who don’t know shit, but act all Chuck Norris on the interviewers. Are you really determined to find talented people? Then here is what you do. Here are some things that you might like to read as well.

  • The Resume: Oh! this one is tricky. Instant brownie points if the resume is LaTex generated. Reason? Well any person who has worked with LaTex would have had to do it for authoring a paper. Any person who understands the effort and rigor involved in authoring papers surely deserves points.   I like a resume to be simple, short and precise. A 7 page resume isn’t something that I am interested in seeing.  Two or three pages at most.  Here is what I look in a resume: The objective should not look copy pasted and should be something original. I also like to see hyperlinks on a resume; I would definitely like to explore a little more about the stuff that you mentioned in brief. It builds curiosity and that’s good. And no, I don’t care if you won the second place in your high school bharatnatyam competition or if you organized your college fest.
  • My first question would be the fizz buzz question. The question loosely reads as follows: “ Your task is to print numbers from 1 to n. For every multiple of 3, instead of the number you print fizz and for every multiple of 5 buzz, and for every multiple of 3 and 5, you print fizz buzz“.  Take any language that you comfortable with and solve this problem. This is like a tard filter which will let me not waste my time with posers. You will be surprised at the number of people who fumble doing this.
  • I wont really care if you have worked with JMS, XML, J2ME, AJAX, SSRS, SSIS, JSB, WCS, JSTL, HTML, DHTML, XHTML, MOSS, SOAP, BO, WPF or any other such acronym. These are just technological deltas which you will eventually have to use. My question will always be as to why did you use such a thing. What were the benefits and such.
  • If you are interviewing for the role of a developer who works on web technologies, get your basic HTML, JS and CSS right. Brush up on some HTML5, learn about the different security models of browsers, cross site scripting etc And please, for gods sake, know what the boundaries of a web application are. I am sure to throw in the ” Can you connect to a android phone using Javascript” question and I don’t expect the answer to be YES.
  • I have always felt writing programs is always about algorithmic aptitude, intelligent manipulation and handling of data and optimization. So there will be one question in each one of these topics, at least. Make sure you know your data structures really well. I have heard answers about hashmaps being stored sequentially, binary search time complexity being O(n), hashtable complexity being O(n) and so on. According to me programming is all about data structures and making conscious and intelligent choices about them. Also, knowing how to solve a problem is not an end to a problem. See how you can optimize your solution. I am sure to ask an optimization question.
  • Design : If the position is for a senior developer, I will surely ask an Object Oriented Design question and on conceptual modeling of data. If you don’t know normalization , ACID properties of data , then read up. Its used in the real world and if you cannot model a student-library database, you seriously have to consider an alternate career.
  • Off beat:  I am always pushing to see if a developer is passionate about his or her work. I am sure to ask the person, “What according to you is the best project you have done and why do you think its awesome?”. This you should answer for at least 5 minutes and should do so passionately.
  • Contributions to Open Source is definitely a plus. Even if you released a project that no one other than you downloaded and used, its better to put that in your resume to earn brownie points.
  • If I have the time and the resources, I would encourage another round of coding. In their favorite language and IDE, but without being connected to the internet. Or I would love to give them pre written buggy code that they should help me debug. That’s more of a hands on approach and it helps in a couple of ways.
  • 1. Most dev’s like to write code and would not like to read pre-existing code. Most of the times though, its not possible to keep writing new code, you will have to look at old code and debug it.
  • 2. A developer good at debugging is always an asset to a teaam.

Well, this mostly what I tend to do in an interview. If you have more interviewer/interviewee specific points, questions, share them with me.

on Jan 5th, 2010Extending jQuery validation plugin – custom validation

JQuery validation plugin has saved me hours of development time on projects. It contains definitions for most validation tasks that you would need, including AJAX based validations. But if you have to do anything more than the ordinary, you have extend the library yourself. Here’s an example of an extension I wrote :

Functionality : I want to capture the twitter handle of a user on a form. Most users will enthusiastically enter the entire URL like http://twitter.com/itsmeritesh, some will leave out the http:// and enter the rest. I wanted to validate that the username was a single word, didn’t contain parts of a URL (mainly slashes) and didn’t mind it being empty.

 // HTML Code
// <form name="myform"> 
// <input type="text" id="twitterUrl"> <label for="twitterUrl" />
 
function isEmpty(Val)
	{
	    if(Val.length==0) return true;
	      for(var i=0; i< Val.length; i++)
	      {
	            if( " \t\n".indexOf( Val.charAt(i)) == -1 ) 
	            return false;
	      }
	       return true;
	}
 
 jQuery.validator.addMethod("handleOnly", function(value) {
		 if(isEmpty(value)) return true;
 
		 if ((value.split(" ").length == 1) && (value.search('/')==-1))
			  return true;
		 else
			 return false;	  
	}, "Please specify only one word");
 
$(document).ready(function(){
    $("#myform").validate({
    	rules: {		
    		twitterUrl : {  handleOnly: true }
                 }
      messages: {
		twitterUrl: { handleOnly : "Only your twitter handle " }
               }
         }); 
  });

handleOnly is a new extension written by using the jQuery.validator.addMethod() method. The rule then specifies whether the return from the function must be true or false, in my case its true. The message is displayed when the condition is not met by the value.

on Dec 19th, 2009Bookmarklets are as bad as software on a CD

Bookmarklets are funny pieces of software. Even though its primarily used in the web browser, mainly to perform small nifty tasks, its one resource that you have no control over after its deployed. Unlike Mozilla addon’s that prompt for an update, general websites which update when refreshed, bookmarklets are almost as archaic as delivering software over a CD. Lets take an example of a badly designed bookmarklet: The example below is the Press This bookmarklet distributed by wordpress initially. ( I have changed some of the values of course)

1
2
3
4
5
6
7
8
javascript:
   if(navigator.userAgent.indexOf('Safari')%20&gt;=%200)
    {
         Q=getSelection();
   }else{
    Q=document.selection?document.selection.createRange().text:document.getSelection();
  }
   location.href='http://wordpress.php?username=blah&amp;text='+encodeURIComponent(Q)+'&amp;popupurl='+encodeURIComponent(location.href);

You will see that this is calling a RESTful implementation of some service with query parameters and the whole code is stored and rendered from inside the bookmarklet. Lets leave the security aspects of this implementation aside, that will require another post in itself. Such a bookmark is a nightmare waiting to happen. Imagine the trouble you would face if you changed the implementation tomorrow. You will have to write to ensure backward compatibility or take the user to a page where he/she can upgrade to the newest version of the bookmarklet. This is a bad way of delivering software.

Ideally, the bookmarklet in accordance with a shortcut/bookmark must mainly be a pointer to the actual web resource. Even for trivial bookmarklets, make sure you follow this design principle because you might want to do something different or more advanced later on. I am sure you have come across situations where you realized the bookmarklet you wrote didn’t work on a browser like Opera or Safari. It may be too late to correct it later on if people have already installed it on their browsers.

Lets now take a bookmarklet that loads the code to be executed from a script on the web. This is now the preferred means of deploying bookmarklets as it puts the control back into the hands of the web developer. This example is from the Friendfeed bookmarklet that lets you share things on FriendFeed.

1
2
3
4
5
6
7
 javascript:void((function()
  {
    var%20e=document.createElement('script');
    e.setAttribute('type','text/javascript');
    e.setAttribute('src','http://someserver.com/bookmarkletcode.js');
   document.body.appendChild(e)
  })())

All this bookmarklet does is to append a new script tag in your html page and assigns the source to the bookmarklet source. The difference now is that there is no code on the client side that is tied to an implementation. You can change the code in the bookmarkletcode.js as and when you feel necessary and be assured that the people using your bookmarklet will always use the latest version.

on Aug 7th, 2009Whats common between Free online ads and Open source

Disclaimer: I am not an Open Source hater. In fact, I am quite the opposite. I believe that for a innovative software marketplace to exist, there must be an equal mix of open and closed source softwares. This also borders on a project that I did on multiagent systems.

There are claims that Open Source will one day completely displace closed software. Same goes with free online advertising, sometimes also referred to as ad exchanges, where a person places an ad on his/her site and in turn gets his/her ad placed on somebody else’s site. There are claims that free online advertising will one day displace Google’s monopolistic hold on online advertising. Frankly I think most of these claims are exaggerated and baseless to a certain extent.

Am I the only one who has a problem with transactions that do not obey the traditional laws of Economics? The market, or as Adam Smith would say – the foundations of human society,  runs on the buy-sell model. When something is free, it means other non quantifiable commodities get traded, like goodwill and trust.  In such circumstances fairness is the biggest casualty. But is there really a model which can ensure fairness in these situations ?

Yes, there are plenty of trust based networks at play in our real life, but they all reach a saturation point. A typical game theoretic scenario, the person to defect first gets a very high payoff ; In a network, everyone else suffers. People will cheat, one way or another. Like I mentioned before, fairness becomes a higly debatable issue. Though, the categorical imperative bestows humans with decision making powers, it doesn’t state the thresholding for these decisions. The only final outcome of these networks is that one person is going to hit it big and make the others suffer.

Naturally the follow up question will be:  how does Open source survive? I explain this using results from game theory. In any homogeneous population, ie either a defecting or a co-operating , a small group of people,  co-operating with each other while defecting against the general consensus , always has the ability to hold their own and, in some cases, even win against the entire population. Examples of this are plenty in real life,  for ex: corruption or the mafia. So, as long as that small bunch of people stay loyal to each other, such networks will continue. Open Source, is slightly a more complex beast than I described it to be, but it broadly falls into the category I mentioned.

Incentive mechanisms like reputation points, virtual currency etc usually try and emulate a real world materialistic economy, but they are limited in their reach and appeal. Eventually, people loose the initiative to compete for these non materialistic resources. Besides, in a medium such as the internet, where identity itself is questionable, how will people trust each other. Has anyone ever wondered if those mails, which inform you of the billions you have won, were ever real? I guess not.

In conclusion,  I ask, is there some mechanism design or a strategy that can ensure fairness (provided its defined accurately) whilst ensuring the continuing growth of such trust based networks ?

on Jul 24th, 2009One Decade of Programming

Sometime around July 1999 was the time I wrote my first “Hello World” program.  Yes, its been 10 years since I started programming, and I dont mean L R L T of Logo. In fact, I wrote some BASIC code as early as 1995-96, but I will skip that for reasons beyond the scope of this post.

I remember liking programming for lots of reasons, but one which I particularly remember. Unlike the other subjects in school, like math or physics,  programming had no boundaries or a legacy to deal with. By legacy, I mean there were no equations, constraints and I didn’t have to reciprocate what some mathematician proved 400 years ago. I have always enjoyed freedom and programming gave me that freedom to express myself.  I guess, I can claim that most good programmers have taken up programming because it lets them play God or be creationists of some complex entity.

Anyway, there are a lot of interesting and fun facts through these ten years and I shall pen some down.

  1. BASIC was my first programming language. PASCAL was probably my first compiled language.
  2. I wrote my first sorting routine ( an act I call, truly understanding the programming abstraction) sometime during Jan 2000.
  3. I got my first computer in 2001. AMD Athlon 1.7 GHz with 256 MB Ram and 40 Gb harddisk . “OMG 40GB” , was my friends reaction.
  4. I disliked C early on, due to my PASCAL roots, but grew fond of it later on when I completed my first large scale project ( A linux text editor, which I proudly wanted to call, “Better than VI“). This is also where I wrote my first recursive functionality which resulted in people actually wanting to read and understand my code.
  5. My first exposure to Linux and OSS was in 2002, I think it was RedHat linux 7.1 with running Xwindows.
  6. I almost lost my entire project due to a floppy malfunction. USB’s were expensive and uncommon then. CD writers expensive.
  7. I learnt about data structures in 2002.  My lecturer, one of the few good ones, was kind enough to teach us the intuition behind data structures and write the implementations ourselves. Our other lecturers taught programming from a book and expected us to replicate the programs written in the book.
  8. I would like to thank  my data structures lecturer who spent hours helping me debug and correct programs. It was probably the first time I looked at code from an outside perspective and yes, I realized the importance of indenting code then and there. I have never not indented my code again. (Remember we are still in 2002).
  9. I learnt about OO during christmas vacations of 2002. Loved it. Loved the paradigm shift in the way I thought about programs
  10. My first OO program was one class with 50+ methods in it (Yup, there was nothing OO about it, but its a start)
  11. My first large scale OO project was building a Paint like utility using C++. I am still proud of this work because I learnt about programming abstractions and class reponsibilities here. I still remember writing my first button class which was fully reponsible for itself.
  12. I learnt PERL in 2004 and wrote my first web application. An online messaging, calendar and collaboration utility for friends and corporates. ( yes, this was my first social app). When I saw Myspace very soon after that ( MySpace was still pretty bare in terms of features then) the only difference I saw was that other people could see who my contacts(friends) were and network with them.
  13. When I first discovered databases (2003), I thought, “wow, somebody made my file I/O’s really easy”. It was also an amazement because I had thought of a unified file writing and reading mechanism to solve all my I/O woes. Problem was getting it to work with many languages. I couldn’t get my head around it and thats when I learnt about databases. Imagine my surprise and rejoice. The first database I used was Oracle and later MySQL ( it wasn’t even relational then). My database project earned me 100/100 in my finals.
  14. Compiler Design was one of my favorite subjects. I loved the fact that I could understand how they build programming languagues. Lex Yacc was probably the best thing that ever happened to programming. Prateeksha and I wrote the specifications for a shift reduce parser for C++. We used an A1 sized sheet of paper to write down the shift reduce matrix. After two full days writing the Shift Reduce rules, we realized we had messed up somewhere.
  15. I wrote a prototype of my CASE tool in 2004.  My proud entry to the world of .NET. I had my official copy of Visual Studio.NET 2003 and .NET 1.1 . This CASE tool would eventually become my fnal semester project and also enter Microsoft’s Imagine Cup. We reached the Nationals for the competition. I called it Dzine.
  16. Even though I had learnt java in 2004, I didnt use J2EE till late 2005. when I started writing simple J2EE apps. I also figured that javascript, that language I had used to validate my controls in HTML (in 2004) , had suddenly taken the world by storm. Everybody was talking about it. Web 2.0.
  17. I sat for two whole days to figure out how yahoo mail was autocompleting email addresses I typed. After two days and a whole lot of searching, I learnt about AJAX. I was already on Gmail by then and didnt really understand the underlying plumbing that was holding the application together.
  18. Within the next 4 months I put AJAX and J2EE together to work on Samparkh with Prateeksha. I wrote an online chat application using AJAX ( inspired by Meebo). Remember this was a time when firebug wasn’t around and I used a tool called Venkman, which I am sure many of you haven’t even heard of.
  19. Then, Grad school happened and so did Microsoft, and the list of wonderful projects that I did during the two years I spent there.
  20. Special mention to BigKahuna, which took almost two years to perfect and won the Google Product Engineering Competition 2009.

Am I a good programmer? I dont know. But, I will continue to remain a programmer. Most of my friends know that I dont take sides. By sides, I mean OSS v/s Closed source, Linux vs Windows , Google vs Yahoo, and this is because of the vast and varied experiences I have had with all these different entities during programming. They all have a special place in my heart and I cannot choose one over the other. Programming is changing fast, and all I can hope for is that that I dont wear out of ideas or skills to call myself a programmer in the years to come.

A list of all the wonderful projects that I have pursued over the years is available here.