Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FxCop Analysis - LiteralsShouldBeSpelledCorrectly - Your Advice? 1

Status
Not open for further replies.

eb24

Programmer
Dec 17, 2003
240
US
I ran FxCop against my code and am wondering what the rest of you suggest regarding the message below.

So how does everyone name/categorize/organize their Forms (and other components)? For example, for Forms (frmSomeSample) or UserControls (ucSample)?

Thanks for any advice!
Code:
Error, Certainty 85, for LiteralsShouldBeSpelledCorrectly
{
    Target       : InitializeComponent():System.Void  (IntrospectionTargetMethodBase)
    Id           : frm  (String)
    Location     : file:///C:/Documents%2520and%2520Settings/xxx/My%2520Documents/Visual%2520Studio%25202005/Projects/xxx/frmSomeProfile.Designer.cs<33>  (String)
    Resolution   : "Correct the spelling of the unrecognized token 
                   'frm' in the literal 'frmSomeProfile'."
    Help         : [URL unfurl="true"]http://www.gotdotnet.com/team/fxcop/docs/rules.aspx?version=1.35&url=/Usage/LiteralsShouldBeSpelledCorrectly.html[/URL]  (String)
    Category     : Microsoft.Usage  (String)
    CheckId      : CA2204  (String)
    RuleFile     : Usage Rules  (String)
    Info         : "Literals should consist of correctly spelled words."
    Created      : 6/20/2007 5:03:41 PM  (DateTime)
    LastSeen     : 6/22/2007 11:59:52 PM  (DateTime)
    Status       : Active  (MessageStatus)
    Fix Category : NonBreaking  (FixCategories)
 
Personally if and when I prefix I tend to fully prefix, rather than use Hungarian notation, i.e., formMyForm, userControlMyUserControl. Everything remains grouped appropriately in Intellisense and everything's type is patently obvious.

However, within my own base libraries I utilise between clients I tend not to prefix as it just gives you really long names in the long run. There is much to be said for appropriate use of Namespaces so, for example, put your Forms in a Forms namespace and User Controls in a User Control namespace etc. and simply don't prefix them. I.e.,

Code:
using System;
using System.Windows;
using System.Windows.Forms;

namespace MyLibrary.UI.Forms
{
    public partial class UserAdmin : Form
    {
        // Stuff...
    }
}
[/name]

Consistency is the key, pick a methodology and stick with it. IMHO it is far, far worse to try reading code in different notations within one code file, than using almost any one single form of notation.

Rhys
[I]The use of COBOL cripples the mind; its teaching should, therefore, be regarded as a criminal offense[/I] [b]Edsgar Dijkstra[/b]

[url=http://www.venganza.org/]Church of the Flying Spaghetti Monster[/url]
 
Excellent advice! Greatly appreciate your input on your design style!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top