Friday, 14 June 2013

Some Handy IntelliJ Code Completion Keyboard Short Cut Tips

Assuming you chose IntelliJ as your Java IDE, and why wouldn't you?

There are a few tips I want to pass on for helping with code completion.

I assume you already know Ctrl+Space to start code completion.

In the code completion pop-up you can use Ctrl+Q to see the JavaDoc help for that method.

And if you get stuck with the parameters for a method then Ctrl+P can show you what options are available.

Wednesday, 12 June 2013

How do I get started installing what I need to write Java?

If you want some help getting started with Java then I created a Free online course that includes the setup instructions for:
  • Java
  • Maven
  • Ant
  • an IDE (Eclipse and IntelliJ)
It even has instructions for writing your first test.

Admittedly the course is designed to get you started writing web tests using WebDriver, but in Java. So it has to cover getting started with Java as a prerequisite.

Monday, 10 June 2013

JUnit ExpectedException Rule

JUnit has a new way of testing for Exceptions.
Back in the day, we used to add the expected parameter to the @Test annotation.
@Test(expected = InvalidPassword.class)
But now, JUnit has a new @Rule
@Rulepublic ExpectedException expected = ExpectedException.none();
And you configure the ExpectedException in the @Test method:
expected.expect(InvalidPassword.class);expected.expectMessage("> 6 chars");
Very useful if you want finer grained control over your Exception testing.
You can find out more on the JUnit github.

Friday, 7 June 2013

Which IDE should you use for Java?

There are a whole bunch of free IDEs out there that you could use with Java:

  1. IntelliJ
  2. Eclipse
  3. Netbeans
And there are more, I just listed those that I have tried. You can also use Text Editors as an IDE, some of those even have code completion now.

So which Java IDE should you use?

Well, I use IntelliJ. I even paid for it, which is something that I never thought I'd do for a Java IDE - I do use it for pretty much all my development work: JavaScript, HTML, XML etc.

But that doesn't mean you should use IntelliJ

First thing I recommend you do is:
  •  look around and see what people on your team are using. 
Because chances are you are going to need some support when you start learning Java, and chances are the first people you are going to ask will be the people on your team. 

If you are using the same IDE as the people you are asking for support then you have one less barrier getting in the way, and one less thing adding noise to your problems.

Warning: Don't ask people what you should use. Instead ask what they use. but do it individually, and in secret otherwise you'll start an IDE development flame war

All the IDEs are very good. Some will work faultlessly on your machine, and some won't work. So if you 
encounter initial setup issues, then try another IDE, you might find your problem vanishes. 

Over time you will start to get a feel for what problems are caused by your code, and what problems are environmental related to your machine + your IDE.

If you want help getting started with Eclipse or IntelliJ then my Free Online Start Using WebDriver course has videos explaining how to install Java, Maven and Eclipse or IntelliJ

P.S. But I use IntelliJ.
P.P.S The android dev kit was based on Eclipse, but the next version uses IntelliJ