www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Re: Mainstream D Programming

reply Jussi Jumppanen <jussij zeusedit.com> writes:
Ary Manzana Wrote:

 Does nobody refactor their code? 

I do have to admit the refactoring rename feature found in the MS Visual Studio IDE is very nice, but I'm not going to change my text editor just for one feature.
 If so, how a text editor helps?

Refactoring is still possible in a text editor: Syep 1) Run a grep to find all the instances of text Syep 2) Load up all the files found Syep 3) Change each name one at a time or all in one hit Syep 4) Run a build to check your changes This might take an extra minute or two, but it's still pretty easy todo.
Oct 14 2007
next sibling parent reply Bill Baxter <dnewsgroup billbaxter.com> writes:
Jussi Jumppanen wrote:
 Ary Manzana Wrote:
 
 Does nobody refactor their code? 

I do have to admit the refactoring rename feature found in the MS Visual Studio IDE is very nice, but I'm not going to change my text editor just for one feature.
 If so, how a text editor helps?

Refactoring is still possible in a text editor: Syep 1) Run a grep to find all the instances of text Syep 2) Load up all the files found Syep 3) Change each name one at a time or all in one hit Syep 4) Run a build to check your changes This might take an extra minute or two, but it's still pretty easy todo.

Where grep doesn't work so well is when you want to rename a variable called 's' to something else. Or a better example is changing the name of a member of one class only. Say we want to change the "name" member of one class. That's likely to have a lot of false hits that grep, without any semantic knowledge, won't be able to help you with. A good refactoring IDE can (I think!) distinguish between things called 'name' that are referring to the member of the class in question and those that aren't. --bb
Oct 14 2007
next sibling parent BCS <ao pathlink.com> writes:
Reply to Bill,

 Jussi Jumppanen wrote:
 
 Ary Manzana Wrote:
 
 Does nobody refactor their code?
 

Visual Studio IDE is very nice, but I'm not going to change my text editor just for one feature.
 If so, how a text editor helps?
 

Syep 1) Run a grep to find all the instances of text Syep 2) Load up all the files found Syep 3) Change each name one at a time or all in one hit Syep 4) Run a build to check your changes This might take an extra minute or two, but it's still pretty easy todo.

called 's' to something else. Or a better example is changing the name of a member of one class only. Say we want to change the "name" member of one class. That's likely to have a lot of false hits that grep, without any semantic knowledge, won't be able to help you with. A good refactoring IDE can (I think!) distinguish between things called 'name' that are referring to the member of the class in question and those that aren't. --bb

how about a Refactoring primitives tool set: tool1: runs like DMD but dumps the name of the symbol at a given location tool2: same as tool1 but in reverse, lists the location of every reference to symbol "____" a few more tools along this line (and a lib of the code behind them) and you could whip out a lot of refactoring stuff really quick
Oct 14 2007
prev sibling next sibling parent Jussi Jumppanen <jussij zeusedit.com> writes:
Bill Baxter Wrote:

 A good refactoring IDE can (I think!) distinguish between 
 things called 'name' that are referring to the member of 
 the class in question and those that aren't.

The MS Visual Studio name refactoring feature does exactly that.
Oct 14 2007
prev sibling parent reply Walter Bright <newshound1 digitalmars.com> writes:
Bill Baxter wrote:
 Where grep doesn't work so well is when you want to rename a variable 
 called 's' to something else.

That'll teach anyone not to use single letter names for non-locals <g>.
Oct 15 2007
parent reply Bill Baxter <dnewsgroup billbaxter.com> writes:
Walter Bright wrote:
 Bill Baxter wrote:
 Where grep doesn't work so well is when you want to rename a variable 
 called 's' to something else.

That'll teach anyone not to use single letter names for non-locals <g>.

But the same scenario is true of local variables too. A refactoring tool can help you rename every 's' within a function without messing up other symbols that just happen to contain that letter. --bb
Oct 15 2007
parent Walter Bright <newshound1 digitalmars.com> writes:
Bill Baxter wrote:
 Walter Bright wrote:
 Bill Baxter wrote:
 Where grep doesn't work so well is when you want to rename a variable 
 called 's' to something else.

That'll teach anyone not to use single letter names for non-locals <g>.

But the same scenario is true of local variables too. A refactoring tool can help you rename every 's' within a function without messing up other symbols that just happen to contain that letter.

True, that'd be nice, but it isn't compelling by itself. With the other features Robert mentioned, the aggregate becomes compelling.
Oct 15 2007
prev sibling parent Alexander Panek <alexander.panek brainsware.org> writes:
On Mon, 15 Oct 2007 18:30:18 +0900
Bill Baxter <dnewsgroup billbaxter.com> wrote:
 But the same scenario is true of local variables too.
 A refactoring tool can help you rename every 's' within a function 
 without messing up other symbols that just happen to contain that
 letter.

How great, that my text editor can work with regex on ranges. :) -- Alexander Panek <alexander.panek brainsware.org>
Oct 15 2007