naming-conventions

Do you see any way to shorten this class name?

I have a class called PriceStep. I keep a list of PriceStep objects in a class called PriceStepSearchSpace. Now I am required to have different PriceStepSearchSpace objects for different products and I need to keep them in some sort of a dictionary. I called this new class PriceStepSearchSpaceRepository. Can you think of a simpler/short...

Object persistence terminology: 'repository' vs. 'store' vs. 'context' vs. 'retriever' vs. (...)

I'm not sure how to name data store classes when designing a program's data access layer (DAL). (By data store class, I mean a class that is responsible to read a persisted object into memory, or to persist an in-memory object.) It seems reasonable to name a data store class according to two things: what kinds of objects it handles; ...

Naming Conventions for Property Types

If you a have Person Property on Address defined like public class Address { public int AdressId {get; set;} public Person AddressesPerson {get;set;} public string FullAddress {get; set;} } What is the proper conventions, if any, for naming a property of another type? ...

Using special character in Enum e.g. % (C#3.0)

I ahve a combo whose source is an Enum. Now , among the other values(say value1, value2 etc.) there is one item Changes(%) that will be displayed in the combo . How to define Changes(%) in the enum? Using C#3.0 Thanks ...

What table naming convention is best for ORM

I recently started work at a new shop that uses a table naming convention like the following: Users UserRoles UserUserRoles UserProfiles UserProfileLanguages The convention I've been using is: Users Roles UserRoleMaps Profiles Languages When my boss asked why I don't prefix my tables, I explained that a database diagram would exp...

Id vs ClassNameId for a class identifier's name

I'm in the middle of a debate here at work. Say you have a POCO named Person. Person has an identifier. I'm in the camp that says the identifier should be named Id. class Person { public int Id { get; set; } } The other camp says it should be named PersonId. class Person { public int PersonId { get; set; } } Is one more ...

How to set ReSharper variable naming rules so that it allows underscores?

Hi, Whenever I use a variable name that stands for a primary key as int pk_MyObject = GetPrimaryKey(myObject) ReSharper complains about the pk_MyObject and offers me to rename it pkMyObject. How can I add a new rule to ReSharper so that it does not complain about variable names such as xx_YYYYY ? ...

Typing convention for local collections in Java

I recently ran across a set of code which instantiated local maps as following: HashMap<String, Object> theMap = new HashMap<String, Object>(); Typically, when I've seen HashMaps used (and used them myself), the local variables are simply Map (the interface), rather than being tied to the specific implementation. Obviously this is re...

C# style question, ctor variable names & class property names

Trying to do everything by the book, is this correct?: public class JollyHockey { public string AnotherCoolProperty { get { return anotherCoolProperty; } } string anotherCoolProperty; public JollyHockey(string anotherCoolProperty) { this.anotherCoolProperty = anotherCoolProperty; } } Or do some people us...

JMX attribute naming conventions

I've noticed that the convention for JMX MBeans appears to deviate from the standard Java Bean property model in that the names for attributes will traditionally start with a capital letter, i.e. PascalCase. To explain this a bit more clearly, I'll take an example from the JDK (chopped down a bit for clarity) : public interface Memory...

Table and Field naming for fresh database + documentation Q

We are startingt o build the database fresh, lots of tables and fields to create for a social website. There will be heavy API implemntation so I am pushing the tech team for solid documentation of data schema, however lost on naming for fields and tables. I want it to all be user friendly, maybe specify the type of table it is also lik...

PHP methods: getMyVariable() vs myVariable()

I was wondering what is better or more accepted when coding in PHP. I was taught, in Java, that class methods to get and set variables should be prefixed with "get" and "set". What I want to know, though, is should I use these prefixes on regular PHP functions. For example, to retrieve a username from a session variable I would either h...

Fluent Nhibernate - Collection name naming convention

Is it possible to set a naming convention for all collection of an entity even if I use the Access Strategy or not, so that all collection names are {EnityName}s instead of {entityName}s (because of Access.CamelCaseField(Prefix.Underscore) the first letter is lower)? Or is there a way where I can tell NHibernate that it shall use the as...

Why do Cocoa-Touch class ivars have leading underscore character?

Is there some purpose for this convention? ...

Good naming schema for Services and DAOs

What is a good naming convention for multi-layered services and DAOs in a multi-tier applications? In most of our application we have two layers of services, where the top level services use either DAOs or lower-level services for persistence and other tasks. Both the top-level services and lower-level services end with "Service" in th...

Database Surrogate Key Name: Product.ProductId vs Product.Id vs Product.Product_Id

Say you have a table named Product and it has an auto-number/identity column. Do you name it simply Id or do you name it ProductId or Product_Id? Please explain why. ...

What is the recommend naming convention for classes in a multi-tier-application?

I sort of have naming problems of my classes/namespaces/controls. In my business library I have namespace called Shopping. It contains the following classes: ShoppingCartItem ShoppingCart ShoppingCartManager In my ASP.net application I want to create a control that graphically represents the items of a ShoppingCart instance. Normally...

How can I get the Agent Smith ReSharper plugin to recogize that Status is not plural

When using the Agent Smith plugin for ReSharper, I get the warning "Enums that are not flags should not have plural names" for an enum that ends in Status. For example: public enum SomeStatus { Success, Failed } In fact Status is not plural, so this isn't really in violation of the naming rule. I found this ticket from 2008 br...

Is it wrong to call a class a FooFactory if it doesn't *always* create Foo objects?

Is it wrong to call a class a FooFactory if it doesn't always create Foo objects? For example if I have the following interface: public interface IFooFactory { Foo Create(); } and implement it as follows: public class FooFactory : IFooFactory { public IFoo Create() { return ServiceLocator.Current.GetInstance<IFoo>...

How can I name and organize methods used by a finite state machine?

In the following code you'll see a simple lexer that conforms to the following regular expression: \d*(\.\d*)?([eE]([+-]\d+|\d+))? If I were to use this design for something more complex, all of the anonymous delegates would be a nightmare to maintain. The biggest challenge I am facing is what to name the methods that would act as cho...