Eclipse Tips: Extract Local Variable

When I teach my little Java TDD course, I quite often do live coding demos …especially if we’re running behind schedule and I want to catch up; I’ll skip an exercise and work through the solution. And one of the remarks I often get at the end is “thanks for the course, but what I also found useful was learning about how to use Eclipse effectively”.

Well, I guess I have used Eclipse for over 10 years now, so I suppose I am reasonably familiar with it. So I thought I’d show some of these tips by way of a series of screencasts.

The first one in the series is nice and simple: the “Extract Local Variable” refactoring, and its corollary, “Inline Variable”; something I use an awful lot when working on Apache Isis codebase. You’ll find it just below…

About these ads

Posted on March 16, 2013, in Uncategorized and tagged , , , , , . Bookmark the permalink. 4 Comments.

  1. Hi Dan

    Great tips. When using this as a shortcut for turning an expression into a local variable assignment, don’t type that semicolon! If you use Alt-Shift-L while the cursor is at the end of the expression it will work fine (no need to select the expression), and it adds the semicolon as well.

    When and where are you next teaching TDD? I have a colleague who might be interested.

    Justin Forder

    • Hi Justin,
      Thanks for that quick tip in return. These are silly little things, really, but we’ve all watched our colleagues on the keyboard frustratingly making edits the most long-winded way possible, so they are good to share. And I think it all adds up to being productive and being able to “get into the flow”.

      Not sure when I’m doing my TDD course next; taking a bit of a break from teaching this year what with commitments in Ireland and on the Isis project I’m working on. And in any case, that course isn’t a public course, it’s usually done for individual companies on-site. Still, if this fits in with your colleague’s situation, do have him drop me a line, and I’ll see if something can be worked out.

      Cheers
      Dan

  2. Rabea Gransberger

    Hi Dan,

    I did at talk about this topic at Devoxx UK last week.

    Here’s my slides https://speakerdeck.com/rgra/devoxx-uk-2013-effective-ide-usage

  1. Pingback: Eclipse Tips: More refactorings (and a bit of common sense). | Dan Haywood

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 248 other followers