naming-conventions

.NET guidelines: Why exception for two-letter acronyms?

Microsofts Framework Design Guidelines define, among other things, the following: "Do capitalize both characters of two-character acronyms, except the first first word of a camel-cased identifier" So there is an exception defined for acronyms that comprise of only two letters, since acronyms with three or more letters are "proper...

n-Tiered .NET application localization guidelines

I would like to get some of your ideas about resource name / categorizing place of resources Let me just give you the scope of the application: 3 or more supported languages 3 MVC websites [with a lot of shared resources, and also some unique resources] 1 shared MVC extensions library 1 core business library, which has shared func...

Why does C# use a different Naming convention?

I started working with C# recently and I noticed that the convention seems to be that the variables start with a capital letter along with the methods. Is this the only language that does this and why? For instance: Page Page = new Page(); Page.Action(); In other languages, you'd see instead: Page page = new Page(); page.action(); ...

Is file path a url?

I have a variable in code that can have file path or url as value. Examples: http://someDomain/someFile.dat file://c:\files\someFile.dat c:\files\someFile.dat So there are two ways to represent a file and I can't ignore any of them. What is the correct name for such a variable: path, url, location? I'm using a 3rd party api so I can'...

What about file-path-in-class-name convention?

What do you (especially PHP) guys think about a naming convention for classes in which the class name reflects the path to the file, related to the project directory? e.g: # /project/Session/Abstract.php # /project/Session/Database.php class Session_Database extends Session_Abstract ... I'm sure you get the idea. I'm also sure some o...

What should I do if I have the same class name on different namespaces?

I'm working on a project and I came to the following naming problem. I'd like to implement the factory pattern but I don't know the best class namings to use (i'm changing from one to the other and it's quite time-consuming :S). I usually go for namespaces to separate groups of classes, but my problem is with this specific piece of cod...

Two C# naming conventions: What do you think?

I have two specific C# coding conventions I've been practicing with mixed feelings. I'd be curious to hear what people think. They are: #1. Name instances after the class it's an instance of, camelCased #2: "Matching property names" Here's the rationale: #1. Name instances after the class it's an instance of, camelCased I use this ...

C# Class naming convention: Is it BaseClass or ClassBase or AbstractClass

What is the recomemded approach to naming base classes? Will it be prefixing the type name with a "Base" or "Abstract" or whould we just suffix it with "Base"! consider the following: type: ViewModel e.g. MainViewModel, ReportViewModel base class: BaseViewModel or ViewModelBase or AbstractViewModel Also consider: type: Product e.g. ...

Underscore prefix on member variables. intellisense

everyone said the "underscore, no underscore" debate is purely philosophical and user preference driven but with intelli-sense having the underscore allows you to differentiate your member variables from your local variable very easily and thus giving you a concrete benefit is there any counter argument to this benefit of having undersc...

Simple yet reoccurring naming problem

Let's say we have a method: public String wishes(Date birthday) { String birthayDateString = convertToString(birthay); ... } I wonder what's the best name to give to the string called now "birthayDateString". This string represents date converted to text. I can't name it "birthay" beause this name is alredy used. Do...

Naming: Why should named constants be all uppercase in C++/Java?

I know, that for C++ and Java it is a well established naming convention, that constants should be written all uppercase, with underscores to separate words. Like this (Java-example): public final static Color BACKGROUND_COLOR = Color.WHITE; public final static Color TEXT_COLOR = Color.BLACK; This naming convention is easy to understa...

What would you name this CRUD class?

Trying to avoid the SomethingManager trap here... Let's say I'm going to write a User editor which will allow administrators to create users in the system. Pretty basic functionality - view a list of existing users, create a new user, update an existing user, delete a user. Let us also say that I decide to write a "business" class to ...

Picking good identifier names

Ok, so you can read guidelines on identifier naming 'til you're blue in the face... camel case, pascal case, make 'em descriptive... but they won't help you actually pick the best name for a given application domain. The easiest to choose (IMHO) are one or two word noun groups: EntryForm Employee WidgetCollection But not every class...

Naming Preference for class fields in C#?

I have seen several naming conventions used for fields in C#. They are: Underscore public class Foo { private string _name; public string Name { get { return _name; } set { _name = value; } } } This public class Foo { private string name; public string Name { get { return this.nam...

How to name a struct that represents both a size and a position?

I have a structure named WaveSize to represent both an amount of samples or an amount of time, but I'm also using this structure to represent a position or an offset within a wave. While it's pretty common to represent both sizes and positions within a coordinate system with a Vector2d type, I'm unable to find a good name abstract enoug...

Enforce File Naming Convention on Windows Share?

Hi Everyone, Simple question, but I can't seem to find the answer anywhere. Is there a way in Windows, or via a third-party utility, to enforce file naming conventions within a Windows network share? I'm sure this is easy in Sharepoint, but I want to be able to limit users to the file name format they save into a folder. I could crea...

Naming convention for property

Which one is preferable or more clear? public int FrozenRegionWidth { get; set; } Or... public int WidthOfFrozenRegion { get; set; } ...

Id or [TableName]Id as primary key / entity identifier

Is it preferred to use "Id" as the column name for a primary key or "[TableName]Id" as a naming convention? Table: Account Primary Key: Id -- versus -- Table: Account Primary Key: AccountId It seems to be split about 50% / 50% in the implementations that I've seen. What are the advantages and disadvantages in each approac...

Proper language to use in form field labels: A linguistic question

I wish to use the following sentence as the comment on a form field. I have already come up with a short-form label for the field. This text is meant to explain the field in a bit more detail: The country [where] you come from. The question is: is this "where" needed there, can be used there (optional) or cannot be used there (error). ...

Naming convention for Django views?

I'm building a website (in Django) and am confused about the right naming convention to use for my functions. Trivial example: let's say I have a page that lets the user decide whether they want to see image A or image B. Once the user submits the decision, the site displays the image the user requested. Here are the two functions I wou...