Monday, February 01, 2016

VI - Part 1


The topic of IDE vs plain editor has been beaten to death elsewhere. Here, I’ll talk about why I personally went for Vim.

At a certain point of time in my career, I found myself working on a J2EE application (to use paypal to do billing for a e-commerce site) and a website driven by ASP .Net (a kind of a personality test) simultaneously. I had gotten into these projects because well, I wanted to try something new and people were paying me to get this work done for them. At this point I had no understanding of web application development, the MVC model or any of those things, having been a C programmer.

I used Eclipse for the first and Visual Studio for the second. 

MS Visual Studio made it dead easy to slap together a basic MVC site, with the same basic process you use to create a standard Windows application, and has enough in there to take you all the way through to deployment.

Eclipse and J2EE was a harder bridge to cross for me. I had missed the whole ‘Enterprise Java’ bus, was unfamiliar with the J2EE or with eclipse for that matter. I had studied some Java in college but that was it. With liberal help from google, I was able to import the application in and start writing code. I actually completed this one successfully as well.

Here was the problem (from my perspective). Even though I was able to code, and in the case of the ASP .Net project, actually take the project from start to deployment, I never actually understood how any of this actually worked. The IDEs do an excellent job of protecting you from the details. With some creative keyboard mashing and googling, you can pretty much figure out whatever you need to do to make things “work”. In the case of the J2EE project, for example, my responsibility ended when I could make it work on my local setup. The actual deployment into production was handled by someone else. 

This was very troubling for me. I like to know what’s going on. It is not that I mistrusted my teammates or anything, but I feel out-of-place if I don’t understand how things work.

When I got my next job, I decided that I would not use any IDE of any sort, and do all of my coding with a basic text editor. 
The deployment and development environment in the next job was linux, so I chose VI. So, my “IDE” was vi and grep :)

There was a definite element of luck here;
- I had gotten in on the project right at the beginning, which meant that I didn’t have to understand a massive amount of existing code. A good IDE is awesome for that. 
- I was in a group that let me do this. There was no set of standard tools.
- The project I was working on did not preclude this. If we had been developing, say, a ASP .Net application, I would have been hard-pressed to do my development without MSVS, for example.
- The coding was in python. I had never written code in python before. So, it helped me make a clean break.

So, what did I expect, and what happened
1. It was easier than I had expected. After a while, you don’t rely on auto-complete anymore. You just get used to typing what you need to type. That said, not having autocomplete can get a bit annoying. If it’s code that you have not seen in a while, not knowing the method names means you need to shift up and down through the code, for example.
2. I did not memorize the python language nearly as well as I had expected I would. I had hoped for example, that I would remember the class method names and parameters of most standard python libraries. Turns out I did not. It was all “cached” in my brain. When I was in the middle of intense coding periods, I would remember it and then I would forget. 
3. I got really good at knowing the general outline of most of the code, including code that was not mine. This was invaluable when something broke in production and I had to figure out what was broken. 
4. It improved my logging. With a good IDE, one gets used to using the debugger to figure out code flow and errors. Without an IDE, every time I wrote code, I was forced to think ‘how the hell will I know if this breaks’.
5. I really did feel like I understood how things worked. This was partly because of python. It really let me change a little bit of code, try it out, change something else etc. The turn-around-time to figuring out if the fix would work is a lot shorter. In addition, since I felt like I knew how the code was laid out ‘in the file system’ as it were, I felt a lot more confident making changes and testing the code even if it was not mine.

So, what’s next.
I am again in a place where I need to absorb large amounts code. It is time to rely on something more than just grep :)
The options that I am exploring are :
- Vim as IDE (there are some really interesting vim plugins that I have been trying out)
- Emacs maybe? I had used it in grad school been away from it oh so many years now.
- Actual IDE as IDE (time to join the rest of the world)