?
Solved

fixing variable names in code as per coding standard

Posted on 2010-08-30
10
Medium Priority
?
269 Views
Last Modified: 2013-12-17
Hi,

We have fairly large piece of code developed over past several months. We have now realized that naming convention of variables is not following the standards. As the code is quiet huge we are trying to understand how to go about expediting this fixing of variables names as per coding standards.

Please suggest what is the best way to address this problem. Are there any third party tools available which can assist in this.

We are using Visual Studio 2008 and coding langauge is C#.

Thanks for your help
0
Comment
Question by:Alok-Agarwal
  • 3
  • 2
  • 2
  • +3
10 Comments
 
LVL 14

Expert Comment

by:systan
ID: 33561594
The first thing to do is to change color and font size, it can be found at Tools menu, Options, Environment, Fonts and Colors, then maximize your adjustment.
0
 
LVL 5

Author Comment

by:Alok-Agarwal
ID: 33561670
Hi,

Sorry, I did not understand how change of font and color can fix my variable name. e.g. if I wanted my integer variable should have started with int but by mistake I have not started any of my integer variables with int then how do I go about changing all my int variables to start with int without spending lot of time. As I said I have thousands and thousands of lines of code and fixing each of these manually is now going to eat lot of time, which I cannot afford.
0
 
LVL 14

Accepted Solution

by:
systan earned 2000 total points
ID: 33561914
>>I did not understand how change of font and color
The quickiest way to fix your problem is to change the font and color, that enables you to look-out directly the changes you wanted too.

Goto your VS Menu, at the [menu]s, you will find Tools[menu], at Tools[menu], you will find Options[at the bottom of menu], then if you find it, goto Environment, Fonts and Colors, then maximize your adjustment to see directly your look-outs to be changed.

In the Font and Color, you will find to change the size of the string, number, comment, etc.,...


>>without spending lot of time.
You have to spend a time for that, have fun in changing,  first thing? follow my suggestions.
0
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 
LVL 1

Expert Comment

by:JensMig
ID: 33562756
You could use FxCop to identify deviations. Its free and its from Microsoft.
You can configure this tool to accept your own standards if they should be that different. The default is MS standard which - at least I think - is quite good.

Read more here:
http://msdn.microsoft.com/en-us/library/bb429476%28VS.80%29.aspx
0
 
LVL 14

Expert Comment

by:systan
ID: 33563927
FxCop has nothing to do with the problem.
0
 
LVL 13

Expert Comment

by:Naman Goel
ID: 33564689
You can use Code Rush and Refactor Pro tool,
Its too good and this will help.
0
 
LVL 8

Expert Comment

by:Gururaj Badam
ID: 33566307
The best of my knowledge where you want to clean up such things I suggest you to use StyleCop/FxCop (Free from MS) to identify files/classes where's the discrepancy and then you can use some 3rd Party Tools like Resharper (Not free) do rename the variables. Resharper is intelligent enough to update all the Usages of the variables.

VS too can rename the Refactor -> Rename (or F2) but it's not efficient.
0
 
LVL 1

Expert Comment

by:JensMig
ID: 33569972
FxCop is a solution to find all variables with bad names systan. I dont know what color changes should help me if I dont know where to look at all?

There is a free express edition of Resharper available, both for VS 2008 and VS 2010. But normally the VS refactoring is sufficient.
0
 
LVL 13

Expert Comment

by:Naman Goel
ID: 33570001
FX Cop is best tool but You can use Code Rush and Refactor Pro tool are too good and handy..

http://www.devexpress.com/Downloads/Visual_Studio_Add-in/index.xml
0
 
LVL 2

Expert Comment

by:sumeetsuvi
ID: 34282367
Fx Cop is free & do right things according to you as you want....
You can make ur own rules..
So it is easy & effective.
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question