ABOUT \ EMAIL \ TWITTER \ RSS \ ARCHIVE
IDE Feature - Function Variable View

I have a new IDE feature that I want.  Maybe it exists, but I’ve yet to come across it in any of the IDEs that I’ve used.  I was reading through Smart Bear Software’s FREE book, Best Kept Secrets of Peer Code Review.  The book centers around convincing you that you need to be doing peer code review at your company.  There’s several essays in the book, and it ends with a small, but tasteful pitch for Smart Bear’s very own product, Code Collaborator, a robust, efficient and organized tool for peer code review.

We happen to use Code Collaborator where I work.  So, I’ve already drank the code review and using Code Collaborator cool-aid.   However, the book, more specifically some of the studies in the book, did spark some ideas, one being this new IDE feature I mentioned at the top.  Basically, what I’m looking for is a list of the variables used in the function that I’m working on or attempting to get up to speed with.  The study on code review and eye movement sparked this need of mine.  The researchers studied the eye movement of an individual during a code review session, to see exactly how programmers work their way through unfamiliar code, understanding how programmers hone in on defects.

The paper reveals that several interesting eye movement patterns emerged during the study.  The pattern of my interest was called Retrace Declaration Pattern.  Here’s what the study had to say on it.

When a reviewer reaches a code line where a variable is firstly used, within a short period the reviewer often looks back to the declaration line of the variable. We define this eye movement as retrace declaration pattern…Statistics show that the number of variables causing the retrace declaration pattern is 51.8 percent of the total number of variables. The retrace declaration pattern can be interpreted as a cognitive action that the reviewer reconfirms the data type of the variable.

Pay attention to what you do when comprehending code.  I know I refer back to the initial declaration of variables obsessively, especially when there is no naming convention or a convention not familiar to me.

The study only used local variables in short functions.  So, the variables were always in view.  There was no use of class member variables or global variables, nothing that would be declared elsewhere.  The IDEs I use, Eclipse, Visual Studio 08, and IntelliJ IDEA, all have ways of allowing the user to view declarations without actually opening the variable’s file.  Eclipse has a Declaration Window, which shows the declaration code of whatever variable the cursor is on.  Visual Studio’s method is similar.  Known as the Code Definition Window, it shows whatever the last variable the cursor came across was.  And, in IDEA you can do a Quick Definition Lookup using the shortcut Ctrl+Shift+I.

These are all useful, but they have two problems.  The first is that none of these options are passive.  In each instance you need to identify which variable you want more information on.  The other problem is that you can only get feedback on one variable at a time.  I would use these functionalities to get more information if needed.  However, a passive list that just shows the variable’s name and data type for each variable active in the function would be much more useful.

Anyways, would it kill me not to have this function variable view? No, it hasn’t yet at least, but it would be a small efficiency gain I would gladly embrace.