0

Tools like CodeRush and Resharper offer lots of simple refactorings, such as 'Rename Variable'. But if you could have any refactoring feature at all (no matter how complex), what would it be?

(I know, everyone wants a 'make program perfect' refactoring, but let's be realistic here.)

Dmitri Nesteruk
  • 23,067
  • 22
  • 97
  • 166
  • "Make program perfect" is not a refactoring. THe idea of refactoring is to change the code structure *without* altering the behaviour. – Jason Williams Nov 26 '09 at 17:52
  • You mention Rename, and it is the most useful refactoring (for me, at least). Complex refactorings are much less useful, so I don't completely understand what your point is. – Dmitry Osinovskiy Nov 27 '09 at 10:01
  • Yeah, Rename's on top of my list too, but I'm interested in complicated, deep changes in the program. – Dmitri Nesteruk Nov 27 '09 at 11:57
  • 1
    Great question!!! Don't understand how anybody could -1 it! How about a language for defining complex refactorings? It's difficult to predict what refactorings might be useful, so instead we might provide means to define complex refactorings, e.g. a very simple example, but non standard new Whatever(int) => Whatever.intern(int) – paweloque Oct 14 '11 at 13:04

3 Answers3

1

I wouldn't particularly like a specific feature. I'd prefer improvements on the existing built in functions. I.e. I'd like to declare how my code is refactored, i.e. naming conventions and variable positioning. As an example, I'd like my get/set properties to be as follows:

public string Foo
{
   get
   {
      return foo;
   }
   set
   {
      _foo = value;
   }
}
private string _foo;

But visual studios does it in some crazy way I cant stand and that doesn't meet our coding standards.

It'd be good if every existing refactoring method didn't feel as though it'd been written by a different person with their own ideas.

djdd87
  • 67,346
  • 27
  • 156
  • 195
  • Try the property implementer in AtomineerUtils. And if it doesn't do what you need, email me via the contact address on the website and I'll try to improve the flexibility :-) – Jason Williams Nov 26 '09 at 17:54
  • Actually, I have recently been playing about with a Resharper feature that lets one set their prefered layout. It's a bit complex but I've had some success with it — might be worth a look for you if you use this tool. – Paul Ruane Nov 26 '09 at 17:54
1
  • Move this method to library XYZ
Jason Williams
  • 56,972
  • 11
  • 108
  • 137
1
  • Add the reference and using needed to make (this class reference/method call) work
Jason Williams
  • 56,972
  • 11
  • 108
  • 137