Tuesday, July 06, 2010

Sacrificing some IDE capabilities

When discussing adopting Clojure or JRuby there are often heated discussions concerning the pros and cons of working with a language that has less IDE support. This blog entry will focus on the common concerns I hear.

I've never met anyone who has mastered Ruby or Clojure and had the opinion that they are more productive in Java. I think that's the best "proof" that the pros outweigh the cons.*

Other than that, things get complicated. The problem is, I understand where reluctant adopters are coming from. But, I just don't see any way to convince them to make the leap.

Many Java programmers do a bit of Ruby or Clojure and make a determination. I think their concerns are inflated by 3 factors: api/library fear, shallow understanding of powerful language features, and inability to optimize problem resolution.

A common concern is that learning a new language requires learning new libraries. Even though Java's libraries are available in Clojure or JRuby, both languages still have their own apis/libs to learn. In Java, you often use auto-completion. In Ruby and Clojure some auto-completion is available; however, it's often suspect. Few people use a Java REPL, so they don't understand how helpful/powerful a REPL is. In Clojure and Ruby, the REPL is often the most effective way to learn new apis/tools. Since most Java developers haven't experienced the value of the REPL, they exaggerate the overhead of learning apis/libs.

Writing idiomatic Java using Ruby or Clojure will produce painful and likely unmaintainable code. Writing idiomatic Ruby and Clojure often require understanding the powerful aspects of a language (metaprogramming, method_missing, macros, duck-typing). Understanding those aspects of a language can greatly change the design of a system. The result of mastering language features is often concise and significantly more maintainable code. However, if you aren't able to see the concise/maintainable version, you will picture a design that may likely be hard to manipulate without IDE support. Enter unnecessary concern and doubt.

Lastly, when things go wrong you need to know how to fix them. Fixing issues is often a mix of tweaking the language and mixing in a few tools. In Java it's often Ignore the noise in the stacktrace, Click a few links and open a few files, Drop in some break points or print lines or change a few tests. Getting to the source of the problem efficiently requires an IDE. In Clojure and Ruby I have those tools (since I do my Clojure and Ruby in IntelliJ), but I also have the REPLs. I know what noise to ignore. Even without those tools (when I used TextMate for Ruby), I know what patterns generally represent what issues. I can see the signal in the noise, and I have an additional tool (the REPL) to help me determine what is signal and what is noise.

However, if you don't know what is noise and what is signal, and (once again) you don't understand the value of a REPL then you exaggerate the cost of problem resolution.

Cosmin Stejerean recently mentioned "To me good IDE support for Clojure is very much like using training wheels on a bicycle."

That's almost true. I'll freely admit that I'd love some free refactoring. It would make me more productive. However, I'm already more productive so it's icing on the cake, not a reason to stop me from using the language.

Unfortunately, those training wheels are very much a deal-breaker to conservative adopters.

* I have recently heard of a few projects starting as Python and switching to Java, but I haven't ever done any Python, so I wont speculate as to why that happened.

6 comments:

  1. Anonymous1:14 PM

    If a project switched from Python to Java it probably was prototyped in Py and I guess outside forces forced Java on the project. As Python and Ruby are very similar all of the above would go for Python too.

    BTW, I've seen Java programmers using Javascript, boy what a mess ;)

    ReplyDelete
  2. So this is something that I've wrestled with for the past few years, but from a slightly different perspective. I've done more and more Django / Erlang programming over the past few years after spending a good % previously using .NET & C# in Visual Studio.NET.

    The biggest thing I miss from my VS.NET setup is fantastic navigation support that can be found in IntelliJs cousin, ReSharper. VS.NET is a suitable IDE, but combined with ReSharper, it's amazing at how well you can splunk a code base. Hell, just being able to place a cursor over something ( method, property, variable ) and do a 'find usings' is great. That, in addition to being able to open up any file, type or method using nothing but the keyboard, makes me long for a good IDE when I'm slogging to remember one of the 20 bundle shortcuts I need in TextMate.

    I've been searching for a replacement environment for more dynamic language programming. A lot of arguments I get against IDEs equate IDE == RAD / WYSIWYG tools, which is absurd.

    I am playing with PyCharm, hoping for the best though, since it's from JetBrains.

    ReplyDelete
  3. Anonymous8:12 PM

    What's a REPL?

    ReplyDelete
  4. Anonymous8:32 PM

    http://lmgtfy.com/?q=REPL

    Click the first link (Read-eval-print loop - Wikipedia, the free encyclopedia)

    ReplyDelete
  5. > In Ruby and Clojure some auto-completion is available; however, it's often suspect.

    Auto-completion in Clojure is actually only suspect when it comes to Java methods; completion for actual Clojure functions is easy to do with 100% accuracy.

    ReplyDelete
  6. interesting thoughts and analysis, thanks for the post. interesting to think about what's most important when thinking of what a next-gen ide would be like at the bare minimum... good food for thought...

    ReplyDelete

Note: Only a member of this blog may post a comment.