Thursday, May 14, 2015

Interview question from hell: "Which text editor do you use?"

About 200,000 years ago - it's not really important when it was - I was in an interview somewhere... also not important where.

And at one point they asked me "which text editor do you use?"


This was apparently a part of the company conversation: "Which text editor?"


----------------


Some other place which I remember quite well, I was asked to "fix my tab settings in my editor" because my code didn't look like everyone else's.

I think I looked at it for about an hour... got a confused feeling "what's there to fix?" and gave up.  And then for the rest of my career at that company I felt deeply guilty that my code's tabs were wrong, and I didn't know how to fix my editor to comply with everyone else's code.


-----------------


"What drives this conversation?"

Well I'm glad you asked.  It just so happens it seems to be driven by merge conflicts which aren't ignoring white space.

And my own personal sloppiness.  You see, I can read a file and mostly ignore the white-space, and somehow my brain parses all that and says "yep that will compile fine" and go my merry way without even a thought given to correcting all the spacing.  But not everyone can do that - or even _should_ do that.


------------------


So I'm trying to come up with a solution.

One solution is to mandate company-wide "everyone shall use whatever editor the star performer coder is using" and then every year after the star performer quits to go work for Google - you can pick a new editor that everyone has to switch to.

This just might be the way to go.


-------------------


But the alternative I'm really wondering about is to let everyone use whatever editor they like - and have an automated process upon check-in which does something like this:

1) Remove all the whitespace in the code
2) Run a "prettify" algorithm that adds spaces or tabs
3) If it added spaces, convert them to tabs


4) Never code in Python...  :)  (sorry...  for Python I think you are stuck mandating a specific editor).


--------------------


Git has check-in hooks that can run automated processes like this, to guarantee whatever sins the editor committed, they will all be erased and the code in the repository will be consistent.  That way any merges between branches won't have any changes that are purely white-space.

git merge -Xignore-space-change would also fix this.