当前位置: 首页 > 编程日记 > 正文

Refactor!™ for ASP.NET--ASP.NET代码重构插件

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

相关文章:

面向对象的程序开发技术C++教学课件系列之四

面向对象的程序开发技术C教学课件系列之四转载于:https://blog.51cto.com/hnxdd/13205

python自动华 (十四)

Python自动化 【第十四篇】:HTML介绍 本节内容: Html概述HTML文档常用标签2. CSS 概述CSS选择器CSS常用属性1.HTML 1.1概述 HTML是英文Hyper Text Mark-up Language(超文本标记语言)的缩写,他是一种制作万维网页面标准语言(标记&a…

一些有趣的题目(java)持续更新

有趣的编程题1.面试题2.某公司面试题1.面试题 此处为正确的代码 package Java.king01.Test;class MicrosoftTest {public static void main(String[] args) {int[] arr new int[]{12,3,3,34,56,78,432};for(int i arr.length - 1;i > 0;i--){arr[i] arr[i]/arr[0];}for(…

lunix开放端口

以mysql服的3306端口为例。 1、直接打开端口:iptables -I INPUT -p tcp --dport 3306 -j ACCEPT 2、永久打开某端口首先,用vim打开防火墙配置文件:vim /etc/sysconfig/iptables然后,在iptables文件内容中加入如下内容:-A RH-Firew…

开机运行记事本怎么回事

1.删除文件%SystemRoot%\system32\wincfgs.exe%SystemRoot%\KB20060111.exe2.清除移动存储设备病毒连接好usb设备后,打开我的电脑,点击右键选择打开(不要直接打开或点“open”),然后打开菜单栏的“工具--文件夹选项--查…

IDEA快捷键及基本使用方法

IDEA常用设置一级目录快捷键导包:自动导包设置开启自动编译按住Ctrl之后滑动鼠标滚轮可以实现代码自由缩放一级目录 快捷键 导包: 1.手动导包 import java.util.Scanner; 2. 快捷键导包 Alt Enter 3.自动导包快捷键功能CtrlD复制光标所在行到下一行…

php 前台生成多维数组 后台批量添加

同一个地方绊倒两次&#xff0c;记录一下哈 1&#xff09;前台表单&#xff0c;看 name 1 <div class"tab-pane row " id"tab-1" >2 <input type"hidden" name"data[1][Type]" value class"form-control" id&q…

plsql循环语句

循环结构有loop。。end&#xff0c;while和for循环 loop基本结构 LOOP 要执行的语句; EXIT WHEN <条件语句> /*条件满足&#xff0c;退出循环语句*/ END LOOP; declare int number(4) : 1;begin loop dbms_output.put_line(我是||int|||); int : int 1; exit when int …

净空法师认为忧郁症源于缺乏伦理教育和因果教育

昨天上海的几个豆瓣佛友聚会&#xff0c;大家谈到了忧郁症的问题。   净空老法师是从教育和预防的角度讲的&#xff0c;大家的看法如何。     下面是老法师开示的连接     http://www.360doc.com/showWeb/0/0/393089.aspx 转载于:https://www.cnblogs.com/chenge/arc…

C语言博客作业04--数组

1.本章学习总结 1.1 思维导图 1.2 本章学习体会及代码量学习体会 1.2.1 学习体会 关于数组&#xff0c;数组是最基本的构造类型&#xff0c;它是一组相同类型数据的有序组合。数组中的元素在内存中连续存放&#xff0c;每个元素都属于相同的数据类型&#xff0c;用数组名和下表…

AJAX ControlToolkit学习日志-ModalPopupExtender(16)

ModalPopupExtender控件用于设置网页上文本的样式。下面看一个示例&#xff1a;1)在Vs2005中新建一个ASP.NET AJAX-Enabeld Web Project项目工程&#xff0c;命名为ModalPopupExtender1。2)在Default.aspx中的<div/>标签中添加一段文字。再添加一个LinkButton控件&#x…

Ubuntu 想要更新源 报错 “E: 无法获得锁 /var/lib/dpkg/lock-frontend - open (11: 资源暂时不可用)”

不得不说&#xff0c;想要apt -get update 一下还真的是很慢啊&#xff0c;但是刚刚装的Ubuntu有没有vim,我没法修改更新源。悲催呐~ 能够得到这个也是查了好多资料 出现这个问题的原因可能是有另外一个程序正在运行&#xff0c;由于它在运行时&#xff0c;会占用软件源更新时…

1.lamp网站构建

bs、cs结构 及优缺点 s-server , c-client , b-broswer cs结构&#xff1a;客户端--服务器 &#xff0c; 比如QQ&#xff0c;首先要下载QQ客户端&#xff0c;之后是客户端与服务器连接 &#xff0c; bs结构&#xff1a;浏览器--服务器 &#xff0c; 浏览器直接登录的&#xff…

Database design best practice(1):关于primary key及其它

1. The job of the primary key is to uniquely identify records, not to store business data ; any use of business data in a primary key is a dangerous practice, since any changes to such data will have large ripple effects (from javapractices) 这是不是意味着…

ReentrantLock+线程池+同步+线程锁

1、并发编程三要素&#xff1f;1&#xff09;原子性原子性指的是一个或者多个操作&#xff0c;要么全部执行并且在执行的过程中不被其他操作打断&#xff0c;要么就全部都不执行。2&#xff09;可见性可见性指多个线程操作一个共享变量时&#xff0c;其中一个线程对变量进行修改…

String.hashCode 哈希值出现重复?

String.hashCode重复 在我学习hash的时候&#xff0c;没有按照教程里面的字符串的值去获取了一个hashcode,然后让这个小白的我惊讶了&#xff0c;这个竟然和教程里面的那个不一样&#xff0c; 对此&#xff0c;我对于这个问题进行了“研究” &#xff0c;在这里先写点我已经知道…

Selenium2(WebDriver)总结(二)---Firefox的firebug插件参数设置(补充)

Selenium2(WebDriver)总结(二)---Firefox的firebug插件参数设置(补充) 本文是对上一节的补充&#xff1a;http://www.cnblogs.com/puresoul/p/4251536.html 使用Selenium2(webdriver)启动firefox且自动加载firebug插件时&#xff0c;切换到firebug插件的网络和cookies部分时&am…

个人信息管理器

转&#xff1a;http://www.cnblogs.com/maxianghui/archive/2006/10/10/524873.html 经过一个多月的努力&#xff0c;终于搞定了这个小软件&#xff0c;请大家给点意见我。采用VC# Access2003 XML开发&#xff0c;扩展了TreeView控件&#xff0c;扩展了RichTextBox控件&#…

分享一些我在开发过程中用过的资源

以下所提到的控件/组件均为开源或免费的。1,ComboBox控件: Upgrade Your Select Element to a Combo Box2,DateTimePicker控件: GrayMetterSoft3,TabStrip控件: A simple ASP.NET Web TabStrip User Control4,Grid控件: XGrid5,数据结构Tree: A Generic Tree Collection6,csv文…

Ubuntu16.04如何彻底删除Apache2

虽然作为运维人员通常情况不建议随意删除Linux系统上面的任何软件&#xff0c;主要指生产环境下&#xff0c;测试环境也不能太随意。 但是有的时候&#xff0c;比如系统环境要变一变&#xff0c;我们就需要替换一些淘汰的软件&#xff0c;对此我们一般都会删除。 按照下面的步骤…

Java案例——统计字符串中每个字符串出现的次数

统计字符串中每个字符串出现的次数 需求&#xff1a; 1.键盘录入一个字符串&#xff0c;要求统计字符串中每个字符串出现的次数 举例&#xff1a;键盘录入“aababcabcdabcde” 在控制台输出&#xff1a;“a(5)f(4&#xff09;c(3)g(2)e(1)” 思路&#xff1a; 1.键盘录入一个字…

在C#中怎样推断线程当前所处的状态

在C#中怎样推断线程当前所处的状态老帅 在C#中。线程对象Thread使用ThreadState属性指示线程状态。它是带Flags特性的枚举类型对象。ThreadState 为线程定义了一组全部可能的执行状态。一旦线程被创建。它就至少处于当中一个状态中。直到终止。在公共语言执行时中创建的线程最…

写《回国驯火记》的那个安普若

2007/3/27写《回国驯火记》的那个安普若 http://an.haiguinet.com/以前光觉得安普若的 《 回国驯火记》[ 《回国驯火记》又名《回国训火记》&#xff0c; 人送外号《熏火鸡》。这是一部表现 海归沉浮&#xff0c;新潮时尚&#xff0c;商战阴谋&#xff0c;名人八卦的小说。以故…

毒霸主程序集成反流氓

原来使用毒霸杀流氓软件&#xff0c;还得单独启动反间谍模块扫描。考虑到很多用户还清楚如何调用反间谍&#xff0c;主程序干脆直接调用反间谍库&#xff0c;会把最恶劣的流氓程序直接清除掉&#xff0c;一般的流氓程序会被忽略&#xff0c;首选解决最影响用户感观的问题。

.NET(C#)连接各类数据库-集锦

1.C#连接连接Access程序代码: ------------------------------------------------------------------------------- usingSystem.Data;usingSystem.Data.OleDb;..stringstrConnection"ProviderMicrosoft.Jet.OleDb.4.0;";strConnection"Data SourceC:BegASPNETN…

CQOI2015 任务查询系统

传送门 又是一句经常见到的话……做完这题对主席树的理解会更好一些…… 这道题把普通的主席树单点修改区间查询改成了区间修改单点查询。这个的话我们可以改成差分解决……把一个操作改成两个&#xff0c;然后把所有操作按照时间进行排序。注意这里修改细节很多&#xff0c;因…

在?三缺一,来斗个地主——肝个斗地主案例(java)

在&#xff1f;三缺一&#xff0c;来斗个地主 *手动狗头 * 模拟斗地主升级版&#xff0c;通过程序实现斗地主过程中的洗牌、发牌和看牌&#xff0c;要求&#xff1a;对牌进行排序 思路&#xff1a; 1.创建HashMap&#xff0c;键是编号&#xff0c;值是牌 2.创建ArrayList&…

RK3399 BOX编译步骤

1、U-Boot编译&#xff1a; make rk3399_box_defconfig make ARCHVaarch64 生成trust.img、 RK3399MiniLoaderAll_V1.05.bin、 uboot.img&#xff1b; 2、Kernel编译&#xff1a; make ARCHarm64 rockchip_defconfig(make ARCHarm64 sunny_rk3399_defconfig) make ARCHarm64 rk…

小型星形网络结构设计示例

<?xml:namespace prefix st1 ns "urn:schemas-microsoft-com:office:smarttags" />以下内容摘自笔者编著的《网络工程师必读——网络系统设计》一书&#xff1a; 上节介绍的是网络形成后&#xff0c;由LAN MapShot 2.0自动发现网络拓扑结构的方法。在网络没…

IOS_多线程_ASI_AFN_UIWebView

H:/0730/00_多线程4种售票_ViewController.h// // ViewController.h // 卖票 // // Created by apple on 13-7-29. // Copyright (c) 2013年 itcast. All rights reserved. //#import <UIKit/UIKit.h>interface ViewController : UIViewController// 多行文本提示框 …