• Home
  • RSS Feed
  • Log in


IntelliJ 8: Even smarter code completion!
Posted by Erik Pragt around lunchtime: November 11th, 2008

Smart code completion has been improved in IntelliJ 8. In the new version of JetBrains’ IDE ‘even smarter’ code completion is added. But first I’ll explain what smart code completion is! Basically, it’s code completion on steroids, which takes the type of the variable into account too which the new value is assigned to. So, if your assigning a value to a variable of type String, smart code completion will only display methods which are compatible with a String type, and filters the list of methods accordingly. It does even a lot more than this, which you can read about here

The ‘even smarter’ code completion extends this smart behiour to objects two steps away. This best explained with some code samples:

public class Person {
   private Address address;

   // getters & setters
}

public class Address {
   private StreetName streetName;

   // getters & setters
}

public class StreetName {
   private String name;
}

And you type the following:

StreetName streetName = person.

When pressing Ctrl+Shift+Space once, nothing will happen, since no methods on person exists which are compatible with the StreetName type. However, pressing it twice will automatically find the getStreetName in the Address class, so the final result will look like this, which is a real timesaver, especially in an environment with loads of domain classes (instead of using Strings for names, etc). The final result is shown below!

StreetName streetName = person.getAddress().getStreetName()
Share

Tags: code completion, ide, IntelliJ
Filed under Java | 1 Comment »



One Response to “IntelliJ 8: Even smarter code completion!”



    Matt Says:
    Posted at: November 12, 2008 at 9:42 pm

    I’m not an IntelliJ user, but that looks pretty cool. A good IDE should work hard to guess what we might mean (and I’ve certainly wished that Eclipse would put in more effort.)

    Whoever came up with the “Law of Demeter” is probably rolling in their grave, though!

    Reply


Leave a Reply

Click here to cancel reply.


Xebia Sites

  • Xebia Corporate
  • Xebia France
  • Xebia India
  • Xebia Sweden

Categories

  • Java (311)
  • Agile (181)
  • General (136)
  • Scrum (67)
  • Architecture (64)
  • Testing (59)
  • Performance (46)
  • Middleware (56)
    • Deployment (38)
  • Xebia Labs (39)
  • SOA (31)
  • Podcast (31)
  • Project Management (28)
  • Tools (26)
  • Uncategorized (20)
  • lean architecture (20)
  • Quality Assurance (17)
  • Articles (13)
  • Requirements Management (13)
  • Virtualization (19)

Tag Cloud

    Xebia Concurrency Control Oracle agile architectuur SOA Flex Groovy lean architecture Lean JPA implementation patterns XML Java Maven Eclipse Moving to India Scala ACT product owner Architecture Javascript Frameworks Agile lean architectuur Scrum Spring Grails Ajax TDD JPA Hibernate

Archives

  • February 2012
  • January 2012
  • December 2011
  • November 2011
  • October 2011
  • September 2011
  • August 2011
  • July 2011
  • June 2011
  • May 2011
  • April 2011
  • March 2011
Avatars by Sterling Adventures