Considering the change
Few days ago I was interviewing someone for an Scala position. The guy is some kind of a Haskell guru(he hasn’t decided if he will join our team yet. I hope he does). For the interview, I decided that we would work on a simple project, mostly to see his work/thinking flow in action and if we could work together. At some point he tells me: “I don’t believe in IDEs”, while setting up Sublime Text for Haskell. Well, that’s a really silly thing to say, in the line of “I don’t believe in cellphones.” But this is a really smart guy…
I liked an IDE because it can do:
- Step by step debugging
- Error highlighting
- Run individual unit tests
- Code completion
- Knowing the types of a long combination of functions
Step by step debugging is useful but it can be replaced with carefully placed logger.debug statements along the code. It is annoying, but I can endure it. Nevertheless, why should I?
I can detect errors as I write & save, by having SBT watching changes with > ~ compile. But again, why should I?
I can run individual tests from SBT. I can copy the name of the test and run the example(I use Specs2) and run it with testOnly, but then… yeah, why!?
The last two items of the list were the ones that made me change my mind. I will try not to use IntelliJ. I’m going Sublime Text 3 for a while, hopefully forever, only to move to another text editor, if a better one shows up.
I’ll keep IntelliJ for working on legacy code, since is better for code you don’t understand. Which takes me to why the last two bullets are the reason for the change.
When using an IDE, your code is “alive”
When working with an IDE, your code “speaks back”. If you make a mistake, it will tell you. If you write something really badly written, but correct, it will accept it, and will give you enough information about that poorly written code, so you can keep on going.
Humans are lazy, at least I am. We will accept any help we can get, as long we trust its source. And then we will create new stuff upon that help. To keep your code clean, understandable, is an important design choice. It is never easy for any non-trivial task. The IDE will help you to navigate your code, thus you can write code hard to navigate.
I didn’t just jumped off the IDE wagon, I did some back and forth between IntelliJ and Sublime Text, so I could feel the differences. The first thing I noted was that, when in Sublime Text, it felt like I was running with my hands tied behind my back. I understood the code, but at the same time, I wasn’t able to modified it, to do real work with it, at least not in a comfortable way.
I must say, this is not production code we are talking about. It is a work in progress,. I’m still trying to find the patterns for the API.
So I realized, I was counting on the IDE for helping me find the patterns on the types. That’s not wrong per se, but, in a bizarre way, it was making all too difficult. Instead of thinking about what I wanted, I was just throwing combinators at it and “hoping for the best”.
So my first step was, while still on IntelliJ, to disabled the error highlighting. It was annoying for a while, but my code quality improved really quickly. The solution that had been elusive for so long, was apparent almost instantly.
The code shouldn’t be “alive”, because it is not smart enough
Obviously the solution didn’t just showed up because I stopped using error highlighting. Rather, it was because I had to think better and more, and rewrite some portions of the code so the types were less strange, more intuitive, and as result, more correct.
That was what made me decide. I’m going full time on Sublime Text 3 from now on(it has “Go to definition”, which I think is really useful). For a long time I hadn’t really needed code completion. It was a nice help, but really unnecessary. What I thought I needed was the explanation of types from the IDE. Now my code is no longer alive. It is a set of algebraic laws, or so I hope, and nothing else. I do the work, I figure it out.
Maybe some day our IDEs will be smart enough to help us to write smart code. I don’t think we are there yet.
You can definitely write proper code with an IDE. What I’m saying is that the help can backfire, and do more harm than good. I say that we, humans, aren’t strong enough to not fall for the pernicious “help”.
So back to the “I don’t believe in IDEs” comment, even when it might make some sense, I still think is a silly sentence; but then, I think that anything that has the word “believe” in it, is silly.