• 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
  • XebiCon 2012

Categories

  • Java (312)
  • Agile (192)
  • General (141)
  • Scrum (70)
  • Testing (65)
  • Architecture (65)
  • Performance (47)
  • Middleware (59)
    • Deployment (40)
  • Xebia Labs (41)
  • SOA (31)
  • Project Management (31)
  • Podcast (31)
  • Tools (28)
  • Uncategorized (24)
  • lean architecture (20)
  • Quality Assurance (19)
  • Articles (15)
  • Requirements Management (14)
  • Virtualization (21)

Tag Cloud

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

Archives

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