Seven types of classic tools that must be added to the. NET Program Development

Source: Internet
Author: User
Tags reflector
ArticleDirectory
    • 1 reflection. Net Reflector
    • 2 test nunit or Visual Studio Test
    • 3 Improvement code analysis ndepend
    • 4 environment simulate virtual PC/vmware workstation/virtual box
    • 5 text handle text processing regexbuddy expresso regextester
    • 6 Language linqpad/snippet Compiler
    • 7 refactor resharper Reconstruction

In my spare time, I often add some software applied to. NET development. These tools cover the fields of design, debugging, construction, and testing. With the help of these tools, it is much easier to deal with problems encountered during development.

1 reflection. Net Reflector

This decompilation tool is indeed very important. Not to mention doing bad things, it is often used to check your own design.ProgramSet naming is also very beneficial. Whether the namespace is reasonable and whether the type name is reasonable.

In my experience, compiled self-written assembly may often show some namespaces that I did not expect. For example, when we add a new type or form in Visual Studio, it will add the complete namespace according to the path of the current item. Therefore, after compilation, I will still use this tool to check the definition of the Assembly namespace. Another experience is that do not use equivalent type names, even if they are placed in different namespaces, do not make the type names the same as those of the system, although the system name can better express the meaning of the type, this should not be done.

Once there was a project that named the rewritten control as button, lable, and textbox. It took a lot of effort to block the control with the same name in system. Windows. forms. If my ERP is Flex ERP, I can name the rewritten button flexbutton, which will bring a lot of convenience to future compilation.

 

2 test nunit or Visual Studio Test

BasisCodeUnit testing plays a slightly different role in code development. Framework developers need to test the availability and flexibility of framework methods. They often need to write some test code and hand it over to application programmers to familiarize themselves with the usage of the framework. For application programmers, I focus on using the test project as a code collection tool. I will save the good code on the Internet to the unit test project for future use.

I prefer the latter for these two tools. Visual Studio test can be used to debug code. Sometimes I don't necessarily want to see that the final test result is green and red. What I need is to grasp the method process. Although the debugging test method is a bit impractical, I often do this. For example, in LINQ to XML, the mutual reference between nodes and power-saving is often mistaken. Therefore, a test project is developed, and the debugger is used to open the project and write and tune it. The debugger can also be used to assist in writing code.

 

3 Improvement code analysis ndepend

Based onSource codeCode analysis and statistics can be used to improve code quality. For example, if I want to find the method that starts with do and has 15 parameters, the result is as follows:

In addition, it can detect useless code (often after the return statement in the method), and the field needs to be encapsulated. If a method is too long, it can also be checked out to remind you to improve this code. For code verification after assembly compilation, foxcop can be used, which uses the program set as the detection unit. While ndepend uses the source code of the build assembly as the detection unit, I think the latter is more useful for reference.

 

4 environment simulate virtual PC/vmware workstation/virtual box

CPU hardware technology is evolving to multiple cores, bringing faster processing speed. Sometimes it is necessary to simulate problems encountered in the customer's computer. You can use virtual technology. In Versions later than Windows Server 2008, virtual machine technology is built in directly. For Windows 7, you need to install virtual machines, such as virual PC, VMWare Workstation, or virtual box.

Mircrosoft Virtual PC is no longer updated after it reaches 2007, so I prefer VMWare virtual machines, which are powerful and flexible.

 

5 text handle text processing regexbuddy expresso regextester

When it comes to text-related content, you should select a regular expression tool for the name operator. It is flexible and powerful with the help of regular expressions.

You can use string parsing in a simple way. indexof can be used with substring to solve the problem. If it is more complex, you need to use a regular expression to handle it more flexibly.

For example, the following code reads the host address and port in the configuration item in the format of 127.0.0.1/2908.

 
Match reportserverurimatch = RegEx. Match ("Maid/2908","(? <Host> [^/\ r \ n] + ):(? <Port> [0-9] *)", Regexoptions. ignorecase | regexoptions. singleline );If(Reportserverurimatch. Success ){StringServicehost = reportserverurimatch. Groups ["Host"]. Value;IntServiceport = convert. toint32 (reportserverurimatch. Groups ["Port"]. Value );}
 
 
 
 

6 Language linqpad/snippet Compiler

Although it is gradually forgotten by the public. However, it is quite useful to use the techniques of LINQ to object and LINQ to XML. LINQ to object can greatly reduce the amount of foreach code.


In the C #2.0 era, a loop is required to read strings with a length greater than or equal to 4 in an array, while in LINQ, only one line of code is required.

String[] Names = {"Tom","Dick","Harry"}; Ienumerable <String> Filterednames = system. LINQ. enumerable. Where (names, n => N. length> = 4 );Foreach(StringNInFilterednames) console. Write (n +"|"); // Dick | Harry |
 
 
 
 

Linqpad is one of the most excellent tools of the LINQ type. It is used to quickly build a LINQ syntax expression.

Snippet compile, another tool in this series, can be used to compile. Net code snippets. It can directly run code snippets and debug them.

 

7 refactor resharper Reconstruction

The resharper produced by jetbrain is one of the best such tools, and there is almost no tool of the same kind that is better than jetbrain.

During code writing, resharper can help you discover a large number of problems and prompt you to modify them. This tool completely replaces the reconstruction tool of Visual Studio. Although Visual Studio has powerful functions, it is not good enough in some places, and the purpose of resharper is clear. It is the speed for you to write code and standardize your code. For developers, resharper provides the following six core functions:

1. Code Analysis: intelligently prompts problems in the Code and provides resolutions.

2. coding ASSISTANT: intelligent prompts automatically complete the function.

3. Code Generation: automatically generates attributes, constructor, interface implementation, covering base class members, proxy members, etc.

4. Code cleanup: Re-organizes the code and eliminates code redundancy and sorting among members.

5. navigation and search)

6. refactorings)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.