4 ms·
I'm really loving how the refactor and generate stuff has developed over the years. It is such a different experience these days and I'm probably at least five
by mhomde 11y ago
I'm really loving how the refactor and generate stuff has developed over the years. It is such a different experience these days and I'm probably at least five times as productive as a result of it.
First we had no refactor tools at all, and how we survived I'll never now
Then basic refactor tools where introduced. You could call up a dialog to do explicit refactoring.
Then the generate functionality was introduced and you could start doing things like typing out a class name that didn't exist, right-click and generate a class and file with that name.
Now everything been taken to the far end. I can just edit parameters, types etc directly in the editor, a light bulb will appear, I click it and choose how it will apply refactoring regarding my changes. If I want to change the type returned from a method inherited from a base class I can just edit it in the derived class and have it apply it on the base class.
Same with generate, just type a lot stuff like you want it to be, a light bulb will appear and it generates everything with correct parameters and all.
If I want to break stuff out of a blob class to a another class called by the original class, I just highlight the methods in the editor and chose "create new class" and it will add initialization for the new class, a field or property for it.
Sometimes when I need to split a class in two there really isn't any good refactoring tool. So what do you do? Copy the class and rename it so you have them side by side in the same file. Eliminate the fields and properties for each that you don't want in either. It will now highlight all the code you've broken. Now delete and change all that has been highlighted. Then just click the light bulb and choose "move class to file named whatever.class". Voila! It's such a streamlined process.
Or just things like Ctrl-clicking something to navigate to it (or pressing F12). Or quickly finding what code calls a method. Or snippet templates like ctor or prop.
To put the cherry on the cake I can press Ctrl-M+Space and Ctrl-M+Z to have the Code Maid plugin reorganize the code and normalize white space.
Seeing, doing and navigating has all come together so nicely and totally changed the way I code. It has made constant and continuous refactoring feasible and effortless. The only downside is that I'm not always sure where Visual Studio ends and Resharper begins :)
The thing I miss though is unit testing being as "on-the-fly" and integrated into the editor. I'd love to be able to write mini-tests as annotations to methods and have VS highlight when it breaks them.
... and maybe continuous background compiling and "live-updating" of apps :)
- manigandham 11y agoBackground compiling and live-updating is now here with Rosyln powered builds. EDIT: actually I'm not sure if this only applies to ASP.NET 5 which constantly builds in the background in-memory...
- mhomde 11y agoHmm, in what sense, or do you mean it's feasible now? I was thinking that whenever I press F5 it should instantly run. It's insane that the computer just loiters around and doesn't compile until you explicitly tells it to, when it could do incremental background compiling... especially since the editor pretty much does that anyway to provide its intellisense and stuff. The build process seems very separated from the editor. Guess it's more complicated with app that's deployed to devices though. Live-editing I was thinking more like I could change parameters and methods and have the reflect directly in an running app. Edit-and-continue has been around for a while but doesn't work on apps ... for probably natural reasons. Eclipse seems to have stuff like that
- manigandham 11y agoRoslyn is a new compiler built in C# and faster. When using VS2015 (and confirmed working with asp.net 5 projects), the solution is compiled using Roslyn and completely in memory (meaning it doesnt build and then write out assemblies to disk just to read them back into memory and reset the app). The whole cycle is way faster and there's a lot less pause time between editing a c# file, hitting save and then just hitting refresh in the browser. I'm not sure about mobile app dev but that probably has more latency due to the emulator setup.
- mhomde 11y agohmm, I doubt it applies to Windows Forms and WPF... but I could be wrong
- guiomie 11y ago"continuous background compiling and "live-updating" ... I use .net demon for this. It also does auto-save.