Over a million developers have joined DZone.

Default Line Numbers in Eclipse

· Java Zone

Discover how AppDynamics steps in to upgrade your performance game and prevent your enterprise from these top 10 Java performance problems, brought to you in partnership with AppDynamics.

I rediscovered an “IDE Hot Topic” yesterday: line numbers in the editor. For me, this rediscovery started with a Tweet:

@ashwhite:
To me the single thing that epitomizes the shittyness of Eclipse as an IDE is that line numbers are off by default. #fb

Hopefully my kids aren’t reading this (I don’t like them to see misspellings).

Frankly, I don’t get why this is a big deal. When I require line numbers, I turn them on. It’s just a preference. I don’t understand how anybody can be so passionate about the default state of something that can be so easily changed (turning on line numbers is as simple as enabling the option in the context menu from the left-gutter of the editor). Frankly, there’s lots of other areas for improvement in Eclipse (like word wrap, for example). Like many other things in life, however, just because I don’t understand it, it doesn’t mean that it’s wrong.

@waynebeaton:
I really don’t understand anything more than an infrequent need for line numbers in a code editor.

My response stirred up a few responses from some people for whom I have a great deal of respect. Clearly this is a bigger deal than I’m inclined to believe.

@rcjsuen:
@waynebeaton Personally, it drives me nuts when I go to someone else’s desk and they don’t have line numbers turned on.

@rcjsuen:
@waynebeaton Possibly a force of habit. I didn’t use debuggers when I first learned Java. :) @irbull made some good arguments though I see.

@irbull:
@waynebeaton stack traces / build failures (from hudson), working remotely with someone (see line XXX).

@kingargyle:
@waynebeaton personally I always turn line numbering on.

@vogella:
@kingargyle @waynebeaton +1 for default line numbering in Eclipse

@ngervais:
@waynebeaton its not like line numbers takes up huge amounts of space in your editor and when you debug in PHP its always needed :D

@alblue:
RT @kingargyle @waynebeaton personally I always turn line numbering on < line numbers are for people who learnt to program in BASIC :-)

I’m not sure if @alblue is coming out for or against line numbers. I learnt to program in BASIC on an Apple II Plus (who needs lower-case letters?), so line numbers are a familiar enough concept to me (I vividly recall the excitement of finding a utility that could renumber a BASIC file).

Ah, nostalgia. Excuse me while I queue up Van Halen – Van Halen.

Personally, I almost never need line numbers when I’m writing Java code. This is most likely a carry-over from my Smalltalk days. In my experience, the combination of my personal preference to write very concise methods (I tend to follow a seven-ish lines of code per method metric), great debugging support, and that cool ability to click on a line from a stack trace in the console or JUnit view seem to give me everything that I need for day-to-day development. Probably the only time that I might even want line numbers in Java is if I had to debug a bunch of stack traces from a production system. But code compiled for production deployment doesn’t always have line number information anyway…

PHP is a different story. It doesn’t take too long for me to turn on line numbers when I’m editing PHP code using the PHP Development Tools. Of course, I haven’t quite sorted out the debugging story in PHP (this is similar to @rcjsuen’s argument about familiarity: I didn’t have a debugger for so long that I got used to not having it).

I’m sure that there are many more opinions than have been expressed in this short exchange. Line numbers on by default was requested in Bug 191154, but didn’t generate any traction (i.e. nobody added themselves to the CC list, or voted) before it was closed as WONTFIX. Bug 293888 proposes to set this as the default in the Eclipse IDE for Education project (this–by the way–is a real easy bug to submit a patch for if you’re a student wanting to get involved with Eclipse).

In the end, it comes down to personal preference. But an “epitomizing feature”? I don’t buy it.

 

From http://waynebeaton.wordpress.com/2011/06/08/linenumbers/

The Java Zone is brought to you in partnership with AppDynamics. AppDynamics helps you gain the fundamentals behind application performance, and implement best practices so you can proactively analyze and act on performance problems as they arise, and more specifically with your Java applications. Start a Free Trial.

Topics:

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}