Solved

fixing variable names in code as per coding standard

Posted on 2010-08-30
10
242 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
Comment Utility
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
Comment Utility
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 500 total points
Comment Utility
>>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
 
LVL 1

Expert Comment

by:JensMig
Comment Utility
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
Comment Utility
FxCop has nothing to do with the problem.
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 13

Expert Comment

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

Expert Comment

by:Gururaj Badam
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

772 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now