Mainstream D Programming

Bruce Adams tortoise_74 at yeah.who.co.uk
Mon Oct 15 16:05:54 PDT 2007


Ary Manzana Wrote:

> Please tell me the steps you perform to do the refactor... Say, for 
> example, you are renaming the name of a method of class A, and suppose 
> there is another class B with the same method name (but you don't want 
> to change B's method's name).
> 
> Janice Caron escribió:
> > On 10/14/07, Ary Manzana <ary at esperanto.org.ar> wrote:
> >> Does nobody refactor their code? If so, how a text editor helps?
> > 
> > Why wouldn't a text editor help? I've always found it perfectly
> > adequate to the task.

It is surprsing how much refactoring can be performed using good old fashioned cut and paste and search and replace. The context sensitivity problem you describe is actually surprisingly rare in my experience. That's not to say having tools to do it for you isn't useful. When they aren't available you have to knock out a five minute one use script or do the job manually. There is a flip side to the coin though. Too many people become reliant on particular tools and ways of working without understanding what's going on under the hood. This can lead to bad habits. My example generator is offline at the moment but why don't I name all my member variables X Y & Z in each class and let the tools sort it out from the context. A better example might be all the copying that goes on when returning by value. Unless you know its expensive your superfast box will prevent you realising how inefficient your code is until you get a bottleneck there out of the blue.

Bruce.




More information about the Digitalmars-d mailing list