Sunday, August 16, 2015

Best IDE in the World: IntelliJ IDEA


Man is a tool-using animal. Without tools he is nothing, with tools he is all.
Thomas Carlyle, Scottish philosopher, essayist, and historian.
Give me a lever, and a place to stand, and I will move the earth.
Archimedes of Syracuse, Greek mathematician, philosopher, scientist and engineer.
With pleasure, develop.
~ Jedi Master Yoda, commenting on the IntelliJ IDEA philosophy ;)


There's no doubt about it, we programmers swear by our tools; they give us the much-needed leverage to tackle and wrestle programming problems into submission. In particular, the programming tool that I have in mind is the Integrated Development Environment (IDE), which we programmers typically use predominantly use to craft solutions to programming problems. And as you'll probably agree, in many ways, large and small—as we master our IDE of choice—we get attuned to certain modes of thought in leveraging the IDE to slay wicked programming problems.

I'm reminded of a saying from Alan Perlis, the Yale computer scientist who happens to be the first recipient of the Turing Award—the equivalent of a Nobel prize in the universe that we programmers inhabit—when he observed that
A language that doesn't affect the way you think about programming, is not worth knowing.
I'm tempted to, and will go so far as to, paraphrase Perlis and say that
An IDE that doesn't affect the way you think about programming, is not worth knowing.
Trust me—especially so, after my having said earlier that we programmers swear by our tools—the perspective that I offer in this post will emphatically not be about glorifying some tools, while bashing other tools. Absolutely nothing of that sort!

My motivation here, simply, is twofold: (1) Share some insights into the ins and outs of the ground-breaking IDE that JetBrains' IntelliJ IDEA is, and (2) elaborate a bit on how it has made my daily programming life far more pleasant. The trusty Jedi Master Yoda—whose quote you saw atop this post, and whose enigmatically endearing picture you see right below —was definitely on to something profound when he uttered the memorable words, "With pleasure, develop" ;)


Ah, and here I'm glad to have remembered a point: I also hope that this discussion will serve to somewhat leaven the pattern of recent posts, several of which were decidedly theory-heavy, as I went about reflecting on the ins and outs of a score, and more, of books that have helped me grok, respectively, the landscape each of (1) the Scala programming language, (2) the Hadoop/Spark/Big Data landscape, and (3) the illustrious and rich Clojure/Lisp lineage.

From here onwards, to be frugal with words, I'll refer to the full-fledged name of the world's best IDE—which, of course, is JetBrains' IntelliJ IDEA—simply as IntelliJ, the latter actually being what we programmers commonly call it anyway ;)

With that, let's dive right into a rundown of what IntelliJ is especially good at, and I mean what it's spectacularly good at. But first, let's hear from a luminary of our programming world's firmament—here is legendary programmer-author, Robert “Uncle Bob” Martin, sharing his sentiments on IntelliJ, in his superb, not-to-be-missed book entitled The Clean Coder: A Code of Conduct for Professional Programmers (this being the sequel to his equally stellar book entitled Clean Code). Thus, in the section entitled "Tooling", in Appendix A of the former book, Uncle Bob notes that
I'm an IntelliJ user. I love it. I use it to write Java, Ruby, Clojure, Scala, JavaScript, and many others. This tool was written by programmers who understand what programmers need when writing code. Over the years, they have seldom disappointed me, and almost always please me. 
...code editing is no longer about lines and characters as much as it is about complex manipulations. Rather than thinking about the next few characters and lines you need to type, you think about the next few transformations you need to make. In short, the programming model is remarkably different and highly productive.
Amen. Precisely my sentiments that had informed an earlier remark, when I had noted—in paraphrasing Perlis, the Turing award-winning pioneer of programming languages—that "An IDE that doesn't affect the way you think about programming, is not worth knowing".

OK, let's also address up-front the best resources in book format, which attempt—in their own unique style, with their attendant strengths and weaknesses—to cover the vast capabilities of IntelliJ. This will tie in nicely with Java uber expert Joshua Bloch's answer to an interview question, which was posed to him by Peter Seibel, who had asked Bloch, "Do you believe you would really be more productive if you took a month to really learn IntelliJ inside out?"

But first, something on the best book resources that I had alluded to, earlier—these books are a welcome supplement to the excellent online documentation accompanying IntelliJ. They are, starting with the finest one leading this short list of IntelliJ books
  1. IntelliJ IDEA Essentials (Packt Publishing), by Jaroslaw Krochmalski—This book is geared toward the most recent version of IntelliJ. Plus it is reasonably substantial, and nicely distills the most important things you need to know about IntelliJ. I also appreciated the fact that it doesn't go on and on with the basics. It is geared toward those who want to become power users of IntelliJ.
  2. IntelliJ IDEA in Action (Manning), by Duane Fields—While this book excels at being substantial, it is, unfortunately, geared toward an old version of IntelliJ. It was published nine years ago, and covers version 5 of IntelliJ. Nonetheless, since the underlying concepts of IntelliJ remain unchanged, this book is a gold-mine of ideas to get you exploring the nooks and crannies of IntelliJ on your own.
  3. Getting Started with IntelliJ IDEA (Packt Publishing), by Hudson Orsine Assumpรงรฃo—Like the first book in this short list, this one is also geared toward the most recent version of IntelliJ. It is not substantial at all. But this will be an excellent book for someone who is completely new to IntelliJ. As its title suggests, it does cover the basics in detail, and does that quite well.
And as promised earlier, here is Joshua Bloch, answering a couple of interview questions regarding programming tools in general, and IntelliJ in particular—you can read the full interview with Bloch, as well as the interviews with a number of other programming luminaries, in the immensely enjoyable and replete-with-programming-insights book entitled Coders at Work: Reflections on the Craft of Programming (Apress), by Peter Seibel
Seibel: What are the tools you actually use to program? 
Bloch: I knew this was coming... The Emacs keystrokes are wired into my brain. And I tend to write smaller programs, libraries and so forth. So I do too much of my coding without modern tools. But I know that modern tools make you a lot more efficient. 
I do use IntelliJ for larger stuff, because the rest of my group uses it, but I'm not terribly proficient. It is impressive: I love the static analysis that these tools do for you. I had people from those tools—IntelliJ, Eclipse, NetBeans, and FindBugs—as chapter reviewers on Java Puzzlers, so many of the traps and pitfalls in that book are detected automatically by these tools. I think it's just great. 
Seibel: Do you believe you would really be more productive if you took a month to really learn IntelliJ inside out? 
Bloch: I do. Modern IDEs are great for large-scale refactoring. Something that Brian Goetz pointed out is that people write much cleaner code now because they do refactoring that they simply wouldn't have attempted before. They can pretty much count on these tools to propagate changes without changing the behavior of the code.
OK, by way of brief history, I'm a long-time, former Eclipse user, having used Eclipse for many years, all that while remaining sadly unaware of what IntelliJ has to offer. But when a former coworker at eBay introduced and turned me on to IntelliJ, it was love at first sight—I fell for IntelliJ, hook, line, and sinker, and have never since contemplated using any other IDE for my daily work ;)

Again, I totally respect and appreciate how different developers prefer different tools—one former coworker at Boston Scientific was a sort of monster of productivity, cranking out code using the venerable editor vi, which comes bundled with your standard UNIX distribution (As many of you may already know from your work in a UNIX environment, vi is about as bare bones an editor as you can imagine; I know just enough vi command to get around reasonably well for all my editing tasks at the UNIX command line). Anyhow, my former coworker's hands would fly across his keyboard in a blurred frenzy as he cranked out high-quality reams of code.

This is as good a segue as any to introduce the idea, which vi aficionado—and especially Emacs devotees, who are used to extending Emacs commands via the Lisp dialect called Elisp—will appreciate: Much as the amazing folks at JetBrains (makers of IntelliJ) note on this very topic of IntelliJ being  a keyboard-centric IDE
IntelliJ IDEA is a keyboard-centric IDE. Most of the actions (navigation, refactoring, debugging, etc.) can be carried out without using a mouse, which lets dramatically increase coding speed. If you had used another IDE for a while and have memorized your favorite keyboard shortcuts, you can use them all in IntelliJ IDEA. 
IntelliJ IDEA completely suits your shortcut habits by supporting customizable key-maps. A key-map is a set of keyboard and mouse shortcuts that invoke different actions - menu commands, editor operations, etc. IntelliJ IDEA comes with a set of pre-configured key-maps.
In glancing at the settings for key-map configurability for the IntelliJ that's installed on my Macbook Pro, I see


Without going into the specifics of what IntelliJ offers to programmers during their work with some specific languages and frameworks—that would take up way too much space—I'll point out some (languages and frameworks) that are a pleasure to work with from the vantage point of IntelliJ. You can look up the cool new features that were made available in the latest version of IntelliJ (which is version 14, at the time of this writing). Meanwhile, I'll point out some languages and frameworks that are a pleasure to work with in IntelliJ. They include the following, in no particular order

  • Java
  • Spring
  • Hadoop
  • Spark
  • Scala
  • Clojure—Sharing here a pointer to an excellent blog (by Tomek Lipski) that I had found and used a while ago, which nicely and concisely covers everything you need for running and debugging Clojure code with IntelliJ, including interacting with the REPL inside IntelliJ; yes, you can have your cake and eat it, too :)
  • Storm
  • Node-js

Adding in the end that the world of possibilities in the programming world—in my mind, anyway—rests squarely upon these three fertile engines of creativity
  1. Open source software
  2. The complementing paradigms of object-orientation and functional programming
  3. IntelliJ
Yes, IntelliJ richly deserves to be on this extremely selective, august list; and yes, that's how much IntelliJ means to me, thinking here to all the inspiration it has given me over the years!

The first two engines in the preceding list are the media, as it were, available to the creative programmer, while—and using the programmer-as-artist metaphor—the third engine is the easel on which the programmer paints his masterpieces. So the march of programmers relentlessly moves forward, to the cadence of these engines of creativity...

And in the march of the IDEs (sic), the IntelliJ IDE—which is right up there in importance with the Ides of March—has clearly emerged as the front-runner in the power tools that give us programmers the leverage we need to tackle and wrestle programming problems into submission. 

Regarding the photo below of a book-lined corner of my house... Stay tuned for next weekend's post, especially if the selection in the eclectic books in the small stack—the one lying flat, sandwiched between the Rubik's Cube and the Towers of Hanoi puzzle—intrigues you in any way. Reflecting the eclectic nature of the stacked books, each of which I lovingly cherry-picked from my book-lined house, next weekend's post will be equally eclectic and, for a change, decidedly non-technical. Just saying ;)


4 comments:

  1. Indeed 3 cheers for IntelliJ! I am still being amazed by all the hidden features that are actually useful. Its true, once you go Jetbrains you can't go back.

    ReplyDelete
    Replies
    1. Yay, IntelliJ! I can totally resonate with your remark about how you're "still being amazed by all the hidden features that are actually useful"... You know, thinking to the wise adage, that "beauty is more than skin-deep" totally applies to IntelliJ—Starting with what meets the eye, for example the focus-enhancing Darcula theme, and then the seemingly endless features tucked away to be discovered as one's experience with IntelliJ grows :)

      I don't how they do it, but JetBrains keeps making IntelliJ better and better every single year. I'm sure you've looked at the inline debugging feature they added this year, with IntelliJ IDEA 14... And then they happened to also add, among other features:

      - the new built-in decompiler
      - the brand new Distraction Free Mode
      - new refactorings around the Call Hierarchy: Change Signature, Safe Delete Parameter, Make Method Static and Safe Delete, etc.

      And going back to the basics, I would’ve switched to IntelliJ, based only on its fantastic integration with Maven—So IntelliJ uses the actual Maven binary on your system and simply provides a UI for it. It does not provide extra features on top of it. Whatever you encode in your POM is what you get out of it. In other words, what you get from Maven via interacting through IntelliJ is the same as what you would get from the command line.

      Whereas Eclipse has the (in)famous M2E plugin. For dependency-management, Eclipse/M2E uses for some operations the Maven binary on your system, and for some other operations it uses the M2E plugin's dependency resolution logic (ouch). It tries to be smart and helpful. However, its attempt-to-be-smart costs you pulling your hair most of the time. Accordingly, you typically hear "well, it works when I do the Maven build on the command line" ;-)

      Thank goodness that IntelliJ is around to rescue us from such misadventures.

      Delete
  2. Yay indeed! I was a little scared when they went to a subscription only model, but they handled it nicely with the fallback licenses.

    Intellij even makes Javascript bearable with their amazing tools ;).

    ReplyDelete
    Replies
    1. - Hey, that is awesome! Always great to hear from a fellow fan of IntelliJ IDEA. We all just end up calling it simply IntelliJ, even though the IDEA idea is there, right? ;)

      - Yep, I know exactly what you're talking about: I, too, was a bit nervous when JetBrains (i.e. the vendor of IntelliJ) briefly switched to a subscription-only model. Right, agreed, it's to JetBrains' credit that they listened to community feedback, handled it nicely, bringing on the (perpetual) fallback licenses.

      - Absolutely, IntelliJ makes even JavaScript navigable with their amazing tools (WebStorm, which is a dedicated JavaScript IDE from JetBrains, or one can simply add the JavaScript plugin to IntelliJ, which is what I did). Ditto for Python (PyCharm, which is a dedicated Python IDE from JetBrains, or one can simply add the Python plugin to IntelliJ, which is what I did).

      - Did I mention that I've done at least a year and a half worth's of Python development using only IntelliJ? Nothing heavy-duty, only stuff like simply tapping into the Python API for ElasticSearch, fetching data from tables in the AWS cloud (DynamoDB instances), talking to an SMTP server, and that sort of thing; for heavy-duty programming, I turn to programming in Java and Scala in IntelliJ, which has outstanding support for programming in both languages, of course, or I may turn to Eclipse sometimes, if circumstances demand doing so...

      - Whichever workplace I've happened to be in, at any given time, I try to spread the IntelliJ meme, having seen just how phenomenally good an IDE it is!

      - Here, I can't help but think back to a saga where I played an instrumental role in getting IntelliJ approved (at a behemoth company, a former employer)... Luckily, I had my manager's and department director's unwavering support, and that's how we got it done and approved for use as an official IDE, alongside the old chestnut, Eclipse. The effort took no less than six months, but was worth it!

      Delete