651.288.7000 info@intertech.com
 By Jim White (Director of Training and Instructor)

The first post of a 10 part series.

I love the game of golf. It is a game that requires you coordinate hundreds of muscles in your body in a precise fashion in order to shoot well. Unfortunately, I think novice golfers are overwhelmed by all the mechanics. As they are just trying to hit the ball, someone has put dozens of thoughts in their mind. ‘Keep your head down.’ ‘Grip the club this way.’ ‘Rotate your shoulder that way.’ ‘Keep this arm straight.’ ‘Bend this arm here’? Yikes! It’s no wonder some give up the game before ever enjoying it. A golf instructor once told me, if you want to work on your swing, pick one, maybe two things at a time to concentrate on and that is it. Anymore and it gets in the way. Once you have mastered those few changes, pick a couple more and keep improving.


Just hit it!

The other day, I was working with someone on a piece of software in Eclipse. They were new to the tool. I found myself back-seat programming. ‘Hit control shift F.’ ‘Now go here and hit Alt up arrow.’ Etc. Etc. After a few minutes, the person on the keyboard turned to me and said, “Can you tell me what we just did?” They knew Java; they just didn’t have all the shortcuts and tips I had memorized over the years. They were overwhelmed by the Eclipse ‘mechanics’. Consequently, they were lost and frustrated. I should have been more interested in ‘just hitting the ball.’ In this case, that means just getting the code written and running. After focusing on the code for a while, I slowly began introducing the person to a few helpful shortcuts. By the end of our small session, the person had about a half dozen shortcuts that were making them more productive without overwhelming them. More importantly, we got our code working.

Eclipse is an immense tool filed with all sorts of productivity enhancements, baked-in best practices and patterns, guardrails, and tricks to help the most sophisticated software engineers on the planet write and test good code – quickly. However, not all of us are up to the rank of Top Gun Software Jockey. Sometimes the tool can be a little overwhelming.

Therefore, for those just learning Eclipse, or even those that use it, but would like to start to learn a few new tricks in order to be more productive, I have prepared a 10-day Eclipse tutorial to make you a better software engineer in Eclipse. I don’t want you to try to swing like Tiger Woods on day one (you’d forget it all by day 2). So, unlike other Eclipse tips and trick guides you may have seen, I want you to concentrate on only a few new features each day. Keep them in your memory while you are coding and try to use them as often as you can on that day. Put them on a sticky note and hang it near your monitor. I hope that by day number 10 these tips and tricks will be baked into your programming sub-conscious. Your coworkers will see you as the Eclipse expert of the team.


The 10-day training program provides two (2) shortcuts and one (1) little know Eclipse feature (I call them ‘power features’) you can focus on each day. I am assuming that you already know the basics of Eclipse and Java. I also assume you already know some of the very basic shortcuts and features of the tool (like Control-Shift-S to save a file). Oh and one more assumption – I assume you are using the Eclipse Helios release or better. If not, get it here. Many of the tips and features may work in older versions of Eclipse, but why bother. Just like in golf, you are going to do better with the most modern equipment.

image image

Without further ado, on to day 1 of training.

Day 1

image Let’s start day 1 of your training with a pair of shortcut keys to help you find a class, method, etc. to help you write code without having to memorize an API.

CTRL + Space: code assist/code completion. In a code editor, this shortcut opens a list of available code completions. For example, you have an instance of a class, but you cannot remember what method or field can be called on that instance. Code assist will tell you. In my example below, I have an instance reference (model) to a Model object. Code assist provides me list of methods I can call on the instance. I hate memorizing APIs and code assist is my weapon of choice in the fight against memorizing the API.

image However, code assist also works just as well to help you with Java syntax. In this example, I want a for loop in my code. I use code assist to help provide me with a list of for loop templates.


CTRL + H: search. This shortcut, used from anywhere in Eclipse, opens the Search dialog. You can use this dialog (shown below) to search for just about anything in the Eclipse workbench. You can look for a file, a piece of text, a piece of Java code (example: class, method, field), or just about anything. The Search dialog is a powerful tool and offers many options. You could write an entire tutorial on this tool alone.


As a simple example, you have a class CustomerSSN and you need to change (refactor) the code in this class. So, your first question is, ‘Where is CustomerSSN used?’ Using the Search dialog, you can check for all references to the CustomerSSN within the source files of your Workspace.


Once you press the Search button, a separate Search view opens providing you all the places where CustomerSSN was found.


Power Feature: Code Assist Using Camel Case. Eclipse has put some ‘smarts’ into the code assistant to help you select and write code faster. Specifically, the code assistant is aware of camel casing. If code abides by camel casing naming conventions, code assist uses camel case patterns to find code faster. In the example below, I need to create a new BadCustomerIDException. By providing the upper case characters of the class name, code assist knows to find a type matching the camel case characters when called on.


Similarly, if I need to call on a setter method, I simply ask code assist for help finding a setter method using ‘s’ and the first uppercase character of the field.


Well, that’s it for day 1.  Try these shortcuts and the feature out as often as you can.  Come back tomorrow for the continuation of this Eclipse tutorial.

If you are looking for training in a Java subject, I hope you will consider an Intertech class. You can find our curriculum listed located on the web here.

Like What You've Read?

Subscribe to the Blog.

Every Friday we send that week's content from our Developers via email. Try it out!

Some ad blockers can block the form below.

You have Successfully Subscribed!

Pin It on Pinterest

Share This