How much does Introduce Variables feature really increase productivity?

I wanted to start a discusion on this topic.

I read the blog post  http://blogs.jetbrains.com/webide/2011/04/productivity-hints-writing-assignments-with-%E2%80%98introduce-variable%E2%80%99-refactoring/#comments
about the introduce variable refactoring.

I am curious to those that use this, how much does it actually improve your productivity?  Off of the top of my head I can't see this feature helping much but I wanted to see what others that are using it think about it.

When I write my variables I pretty much have a use in mind and come up with the name of the variable then write the right side of the assignment in my head, I just basically see it then I write what I see down.  This is wierd method to me, writing the right side first.   Anyway that is the way I do it now and of course everyone is different.

I did not realize that the software also came with increased productivity tips teaching us all how to code more efficiently and just be better developers.  I think this is totally incredible and that everyone at JetBrains are amazing.

FYI:  I am a new owner of a PhpStorm License, just purchased today after a little over a week of testing every IDE I could get my hands on from free to commercial and finally decided on PhpStorm as my chosen IDE.  HUGE upgrade for me from handcoding using texteditors and occasionally Dreamweaver CS3 over the last few years.

Thanks.

6 comments
Comment actions Permalink

Well, everyone's experience is different but its always useful to get the different perspective on such mundane things.

Part of this habit here comes from other languages i.e. Java - the one that we use like 95% of time - and in this case introduction also takes care of declaring proper type (imagine typing Collection<PhpNamedElement> suggestions = ) :)

And its nice to know that we win the competition, even in one persons mind :) thanks!

0
Comment actions Permalink

newbie2IDE,

I am curious to those that use this, how much does it actually improve your productivity?

At least it can help to save on keyboard pressings:)

Try to use this method for some time and probably you will wonder at how you could write code without it(personally I use it constantly for Java and PHP).

Thank you for feedback!

0
Comment actions Permalink

Doesn't work too well on none opp assignements. Like typing $_SERVER["PHP_SELF"] PHPStorm suggest a variable name of "var". LOL maybe something like "file" or "this_file" or file_name" would be better. :)

But it's cute. I look at this as something you should off to crowds but I'm no so such how useful this feature will be.

0
Comment actions Permalink

Just send in your suggestion heuristic as a feature request! :)

0
Comment actions Permalink

I tried using it for a while, but I found that it actually starts to irritate me after a while. The problem is (for me) that I need to do it like this all the time, otherwise it doesn't become an automatic thing. So I also used it for non-field variables like 12, "hello", true etc. and in those instances you actaully increase your keyboard usage instead of decrease it. For example:

12 [ctrl-alt-v]
variable 'i' is suggested (for integer I guess), so I change that to:
startage [enter]

whereas normally I would have typed:
startage=12;

saves me the [ctrl-alt-v] and the enter in exchange for the semicolon.
Not a big timesaver as I see it.

Also, but that is because I probably don't understand how to use this properly, the declaration is placed at the top of the file instead of at where my cursor is. Not sure why anyone would assume I want all my declarations at the top. This becomes esp. annoying in php files that start out with html and have some php in the middle, in those cases the declarations are placed OUTSIDE the php tags.

All in all I find it more trouble than anything else.

0
Comment actions Permalink

Hello Peter,

Thank you for feedback!

Also, but that is because I probably don't understand how to use this properly, the declaration is placed at the top of the file instead of at where my cursor is. Not sure why anyone would assume I want all my declarations at the top.


Please provide code snippets, actual and expected refactoring behavior. We are highly concerned to make this feature as handy as possible.

This becomes esp. annoying in php files that start out with html and have some php in the middle, in those cases the declarations are placed OUTSIDE the php tags.

Please vote/watch - http://youtrack.jetbrains.net/issue/WI-5598

0

Please sign in to leave a comment.