Teaching Demo: http://www.devexpress.com/Products/NET/IDETools/CodeRush/Training.xml

有些功能在JBuilder2005中早就有了。大家了解一下吧,比较不错。
 Refactor! is freely available to all ASP.NET 2.0 developers and offers a comprehensive suite of tools that enable you and your team to simplify and shape complex code and HTML markup - making your web applications easier to read and less costly to maintain.

Note to customers who have Refactor! Pro installed: this product is incompatible with your existing Refactor! Pro install. Please do not install Refactor! for ASP.NET alongside your existing installation. Instead, existing Refactor! Pro customers who are still within their free one-year maintenance update period can download at no charge an update to Refactor! Pro that includes these new ASP.NET refactorings. Just visit the Client Center https://www.devexpress.com/ClientCenter/. Those customers who purchased/upgraded Refactor! Pro more than a year ago will need to purchase a new maintenance upgrade to get these new refactorings.

Download Your Copy Now 
 
Simplify and Restructure Your Code
Making it Easier to Read and Less Costly to Maintain

Refactor!™ by Developer Express fuses a language-independent state-of-the-art code shaping engine with a revolutionary and highly-optimized user experience. Unlike other refactoring solutions that target the system architect, Refactor! is designed to help all developers craft and sculpt their code with the speed and efficiency needed to meet their line of business demands.

What is Refactoring?

Refactoring describes the process of making many small changes to working code, improving the internal structure without altering the external behavior of that code.

As an analogy, consider the math statement 2*4*5*3*1, you can covert this to 1*2*3*4*5 without changing its meaning and from there into 5!. They all mean the same thing but are increasingly easier to read. Refactor! does the same thing but with working source code.

There was a time not too long ago when just for fun developers would actually engage in obfuscated code competitions to produce the most difficult to read code. Well unfortunately there is a lot of code out there that is not much more readable than that intentionally obfuscated code - which is where refactoring comes in. The goal of refactoring is to take working code that is harder to read than it needs to be, and tweak its structure to make it more readable and more easily maintained.

.NET languages have been designed to self-document and encourage the development of readable, maintainable code - but even these languages code can grow organically over time and become cluttered and overly complex. Refactor! has numerous industry-first features that can help you take this complex code and make it easier to read and less costly to maintain.

Why Refactor!™

Refactor! does something no other tool can claim to do: it brings the power of an entire suite of refactoring tools to bear with just one key ("One Key Refactoring") and it works directly on your code in your editor - so you'll never have to leave your code just to restructure it.

Figure 1. One Key Refactoring - press CTRL+~ at any point to see all available refactorings with a short description of each.

Refactor! is built upon a language neutral architecture that offers exactly the same functionality for Visual Basic .NET and C# developers (beta support of C++ is also available). Refactor! even includes extensibility features to allow developers to easily build language-independent refactorings that can be used internally or shared with a growing community of highly satisfied Refactor! Pro customers.

Before we describe to you just a few of the over 50 refactorings available within the product, let us assure you that everything you can do with Refactor! can be rolled back using the standard Visual Studio Undo/Redo mechanism. So you really have the freedom to explore with this tool - simply hit CTRL+Z (or whatever key Undo is bound to) if the refactoring is not what you expected.

Refactoring: Reorder Parameters

Change the order of parameters in a Method signature, while also updating all calls to this method. Great when you need to change the parameter declaration order so that the most important parameters appear first, which will improve the usability of the method.

"Reorder Parameters" is probably the best example of how Refactor! is different, because the entire process is extremely visual and happens right there in your code. Here is how you reorder your parameters. Simply move the text cursor into the declaration of a method with parameters and this refactoring will be available. You can see that it is available if you stay there for a moment, because the refactoring smart tag will show up with a list of all the refactorings available. But you don't need to wait for anything - just hit the "One Key Refactoring" key (CTRL+~) and now you can move all your parameters left and right simply using the left and right cursor keys.

Figure 2. Reordering parameters directly upon code in the Editor - no modal dialogs to slow you down.

Refactoring: Rename

This refactoring renames a local variable or a private field, property or method. This refactoring affects both the declaration and any references within the class.

Choosing meaningful identifier names is one of the simplest ways to improve the readability of your code - Refactor! makes this process trivial. You simply put the text cursor into the identifier, and hit the "One key refactoring" key (CTRL+~), and start changing your identifier. You will see all references to your identifier highlighted with a light green box. You can now cycle through each call using the TAB and SHIFT+TAB keys, and if you change any one - the others all reflect the change.

Refactoring: Extract Method

The most sophisticated of all class based refactorings is probably "Extract Method". This refactoring allows you to select a piece of code from inside a method and extract it outside into a method of its own - while leaving a call to that new method in the code the method came from.

You are probably already several steps ahead of us in how to activate this refactoring by now; You simply select some code, put the text cursor in the code, hit the "One Key Refactoring" key (CTRL+~), and now you have a new method containing your block of code, with a call where that code came from.

Consider this example code which calculates the volume of a cylinder. Suppose we decide to extract the code that calculates the area of a circle to a method of its own, for later reuse. To do this all we do is select the specific block of code and hit the "One key Refactoring" (CTRL+~), the code is cut from the source method, and we are prompted for a location for the target method.

Figure 6. You can place the extracted method precisely using the red Target Picker.

Once we have chosen the location for the new method, Refactor! calculates how many parameters need to be passed, creates some default names for the new method and any parameters, generates the code for the new method and calls it, and finally invokes the "Rename" refactoring in case we wish to override any of the default names chosen.

Figure 7. The fully extracted method - Refactor has determined parameters to pass and even come up with a meaningful name.

You know there is actually an even faster way to extract. Select the code - Cut the code - Paste it outside the Method but inside the class and Refactor! will extract the method for you automatically.

Notice that the method name and the call are both linked with green boxes - the "Extract Method" has automatically invoked the "Rename" refactoring for you. Also if there are any variables referenced outside as well as inside the block you selected, then Refactor! will automatically give your new method the appropriate parameters to pass in that data and if needed pass it back.

Over 50 Built-in Refactorings

When it comes to scope, breadth, and ease-of-use, no other product in the market even comes close to Refactor! It would be impossible to describe each of the 50+ refactorings in detail within this white paper and so we wont try – but to whet your appetite, here are a few others worth consideration.

Compress to ternary expression / Expand ternary expression
Converts an if/else conditional with assignments in each branch into a ternary expression, or expands a ternary expression into an if/else block.
Widen scope
Moves a variable declaration up and out in scope.
Flatten conditional
Unindents the If or Else statement for a conditional. This will apply one of the following refactorings: Replace Nested Conditional with Guard Clause, Remove Redundant Else, or Reverse Conditional followed by Remove Redundant Else. Flatten conditional is also smart enough to recognize "if (E) return true; else return false;" and convert that condition to simply "return E;".
Simplify expression
Resolves a complex expression to its simplest form.
Combine conditionals
Combines two or more neighboring conditionals with identical bodies into a single conditional statement where each conditional expression is logically OR'd.
Create method contract
Creates a contract for the current method, verifying that parameters are valid.
Inline result
Replaces final assignments to the temporary variable with a statement that immediately returns the value, removing the temporary variable if possible.
Move type to file
Creates a new file with the same name as the type at the caret, adds the file to the project, and then moves the type to that file, along with any leading comments, attributes, and XML doc comments. This refactoring is available when the caret is on a type declaration and the file contains two or more types.
Use String.Format
Converts a composed string expression into a single String.Format call.
Use StringBuilder
Replaces these string concatenation operations with method calls on a local StringBuilder instance to improve performance (working with a StringBuilder is faster than concatenating strings).
Optimize namespace references
Removes unused namespace references (using/imports statements in VB and C#, and unused #include files in C++).

转载于:https://www.cnblogs.com/RuiLei/archive/2007/02/15/651036.html

Refactor!™ for ASP.NET--ASP.NET代码重构插件相关推荐

  1. ASP.NET 例程完全代码版(3)——随意创建图形信息

    随意创建图形信息 功能:    可以选择输出图象的文本:    可以选择文本的颜色:    可以选择背景的颜色:    可以选择字体:    可以选择字号: 用途:比如显示自己的一个计数器,或者验证码 ...

  2. ASP 三十条精华代码

    ASP 三十条精华代码 1. οncοntextmenu="window.event.returnvalue=false" 将彻底屏蔽鼠标右键 <table border ο ...

  3. ASP.NET开发常用代码

    1. 打开新的窗口并传送参数: 传送参数: response.write("<script>window.open('*.aspx?id="+this.DropDown ...

  4. ASP实例:6行代码实现无组件上传

    ASP实例:6行代码实现无组件上传 目前有很多无组件上传类,我大概看了一下,大多写的相当复杂,有的居然还只能传文本 最关键的是没有10行代码以下的 :) 我花了一个晚上时间研究了一下ADODB.Str ...

  5. Asp.Net MVC 页面代码压缩筛选器-自定义删除无效内容

    Asp.Net MVC 页面代码压缩筛选器 首先定义以下筛选器,用于代码压缩. /*页面压缩 筛选器*/public class WhiteSpaceFilter : Stream{private S ...

  6. asp php微信支付,Asp微信支付接口代码 微信中生成订单后可以直接调出微信钱包直接付款_随便下源码网...

    Asp微信支付接口代码 微信中生成订单后,可以直接调出微信钱包直接付款 软件介绍: 众所周到,目前微信支付已经十分普及,无论是商场.超市.网站上,微信支付的发展十分迅速,而ASP版微信支付在微信公众平 ...

  7. asp和mysql分页代码

    <!--#include file="zheboconn.asp"--> <html xmlns="http://www.w3.org/1999/xht ...

  8. [转]ASP.NET(C#)常用代码30例

    [转]ASP.NET(C#)常用代码30例 1. 打开新的窗口并传送参数: 传送参数: response.write("<script>window.open('*.aspx?i ...

  9. ASP批量更新数据代码

    ASP批量更新数据代码 %> 两个文件 ..cn.asp 连接数据库用的 ..cn3.asp 执行文件 . cn.asp 源代码 <% dim conn dim dbpath bb=&qu ...

最新文章

  1. erlang使用gen_server实现质数服务器(手打代码,还debug了几个错误)
  2. sklearn 相似度矩阵_精简易懂,30 分钟学会 SVD 矩阵分解,很强!
  3. Elasticsearch技术解析与实战(六)Elasticsearch并发
  4. 具有链接资源的Spring RestTemplate
  5. 工作实践 之 Google Guava 工具集的使用 ,提高效率
  6. 嵌入式linux的tftp配置[ZT]
  7. 使用idea的maven插件自动打jar包
  8. pyspark 数据写入hive_Pyspark将数据写入hi
  9. 使用fileupload实现文件上传
  10. c语言中rcu缩写,ICU、MICU、EICU、NICU、NCU、CCU、RCU,科室英文缩写大全
  11. 网易云音乐,如何修改文件品质为320Kbps
  12. 用指针将字符串逆序输出
  13. 坑多路难走,学数据分析转行前要知道培训机构不会说的事情
  14. 用户管理和数据库安全(一)
  15. 证明不同特征值的实对称矩阵的特征向量相互正交的
  16. 阿里妈妈年赚2500亿:淘宝商家的“曝光焦虑”生意好做吗?
  17. Python画豪华版圣诞树,带漂亮彩灯与文字背景
  18. shellcode加载器--从入门到放弃
  19. mvn clean package是个什么鬼?
  20. 计算机窗口的大小是什么单位,电脑软件窗口大小调整

热门文章

  1. 2022-2028年中国再生天然橡胶行业市场调查分析及未来前景分析报告
  2. python 网络编程之Socket通信案例消息发送与接收
  3. 【C#实践】三层:初识
  4. matplotlib绘制热力图
  5. list extend 和 append
  6. tf.contrib.layers.xavier_initializer
  7. Relay IR表示
  8. 什么是L1/L2/L3 Cache?
  9. CVPR2020:Grid-GCN用于快速和可扩展的点云学习
  10. CVPR2020:点云三维目标跟踪的点对盒网络(P2B)