开发者

Where can I learn to refactor code? [closed]

开发者 https://www.devze.com 2023-01-08 02:05 出处:网络
Closed. This question does not meet Stack Overflow guidelines. I开发者_运维百科t is not currently accepting answers.
Closed. This question does not meet Stack Overflow guidelines. I开发者_运维百科t is not currently accepting answers.

Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.

Closed 8 years ago.

Improve this question

Where can I learn to refactor code?


Books. See http://www.amazon.com/Refactoring-Improving-Design-Existing-Code/dp/0201485672/ref=sr_1_1?ie=UTF8&s=books&qid=1279262199&sr=1-1


You can learn on the job by using a refactoring tool such as Resharper and asking yourself, why is it suggesting this change? It will show you places where you can make your code simpler as well as which code is not being used any where. One you have taken this first step, it is easier to see what your code is doing and then you can perform your manual refactoring as suggested by the other answers.


Refactoring - C# Tutorials | Dream.In.Code

http://www.dreamincode.net/forums/topic/77242-refactoring/

C# 2.0 Code Refactoring

http://www.premier-club.com/codemag/Article/20143


See Martin Fowler's material: http://www.refactoring.com/

His articles are very good, recommended to anybody who wishes to learn beyond the basics of just writing code.

Robert Martin's blogs (Uncle Bob) are also excellent.

In practise, choose any IDE which supports common refactoring like Eclipse or IntelliJ (latter is my favorite). But it's just a tool -- it helps to learn what are the reasons why a piece of code should be refactored and how.


Fowler's book is a good place to begin, but before doing any refactoring you should make sure you have automated tests for your code. Refactoring without tests is risky at best.

Visual Studio supports the most common refactoring operations, but you may also want to take a look at Resharper, which adds additional tools.


Head over to LosTechies and have a look at the ebook 31 days of refactoring, its an easy way to start.

Then as others here have said, read Fowler's book when you have the time.

0

精彩评论

暂无评论...
验证码 换一张
取 消