naming-conventions

HTML comment conventions

I need to use HTML comments to store specific data, but I don't want use comment schemes that already exist, as generated by programs like Dreamweaver <!-- #BeginLibraryItem "/File.lbi" --> or Frontpage. How do I know what comment scheme would be least problematic, or at least not look like other existing comment conventions? PS: I'm ...

Help me name this property (C#)

Imagine I created this class: public class ColoredPolygon { public Point[] Vertices { get; set; } public Brush Brush { get; set; } } Inside Visual Studio isn't difficult to see which "Brush" is the class and which is the property. But something tells me that is not a best practice to name a property after its class. How w...

How to name methods that are registered to events

Hello, assume i have class that exposes the following event public event EventHandler Closing How to name methods that are registered to this event. Do you prefer to name the methods like they are generated by Visual Studio (aka. +=, Tab, Tab) private void TheClass_Closing( object sender, EventArgs e ) or do you use your own style...

Extracted Interface naming conventions

I'm currently refactoring some code to make it more testable. Specifically, I am extracting the interface of several classes to allow easy creation of test doubles. I'd like to keep the public interface the same to this code, naming the interface after the original class. However this leaves me with the problem of what to call the ori...

What is the preferred way of notating methods in comments?

Hey! Sometimes one has to refer to another method when commenting. Here some example in PHP: class A { /** * @see B::bar */ public function foo() { B::bar(); } } class B { public static function bar() { // ... } } So what if there would be a non-static method bar in class B? What...

Best-practice for naming a WCF endpoint for an iis hosted service?

What is best practice for naming & hosting a WCF service endpoint in IIS? Assuming an example scenario of: A service dealing with customer entities A solution namespace of Company.Entities.Customer Company.Entities.Customer.ServiceHost contains the IIS Host (ie. just the .svc file) Company.Entities.Customer.Service contains the servic...

What naming convention do you use for the service layer in a Spring MVC application?

I'm stuck with figuring out a good naming convention for the service layer in a spring application. For each class in the service layer I first write the interface it should implement and then the actual class. So for example I have the following interface: public interface UserAccountManager{ public void registerUser(UserAccount new...

Database columns type prefix

I’ve been developing solutions with databases for more than 11 years now, and it seems I’ve “developed” a rather controversial opinion about naming columns in my tables: I always give them a 3 or 4 character type prefix, i.e. intGroupID, nvcTitle, dtmCreated, bitPlayerHater, etc. I’ve worked with several other developers who all absolute...

Naming convention for Visual Studio solutions and projects

We were thinking about organizing our BIG project this way: \trunk [CompanyName] [Product1] [Project1] CompanyName.Product1.Project1.csproj [Project2] CompanyName.Product1.Project2.csproj CompanyName.Product1.sln [Product2] We were trying to follow Microsoft's recommendation that ...

Should I use a SQL Server keyword as a column name?

I am designing a database and recently named a column in a table DayOfWeek, completely forgetting that DayOfWeek is a built-in function in SQL Server. Now I am deciding if I should just leave it as is and reference the column with square brackets [DayOfWeek] or change the column name to avoid any conflicts in the future. I am not too f...

When is a function name too long?

I try to be rather descriptive with my function names, where possible. This occasionally results in function names in the twenty to thirty character range such as "GetActionFromTypeName" or "GetSelectedActionType". At what point do functions get too long to manage (not too long for the compiler)? ...

Should I change the naming convention for my unit tests?

I currently use a simple convention for my unit tests. If I have a class named "EmployeeReader", I create a test class named "EmployeeReader.Tests. I then create all the tests for the class in the test class with names such as: Reading_Valid_Employee_Data_Correctly_Generates_Employee_Object Reading_Missing_Employee_Data_Throws_Invalid_...

Naming a dictionary structure that stores keys in a predictable order?

Note: Although my particular context is Objective-C, my question actually transcends programming language choice. Also, I tagged it as "subjective" since someone is bound to complain otherwise, but I personally think it's almost entirely objective. Also, I'm aware of this related SO question, but since this was a bigger issue, I thoug...

What is a good (natural-language) naming scheme for interfaces (Java, C#, ...)?

Hello! NOTE: This is not the popular interface naming question about using or not using "I" at the beginning. I encounter often the problem to name an interface, which indicates a belonging or property of a class. (Please see following list) Let's brainstorm, what kinds of interfaces are there? Indicate the "kind" of a class DataStr...

Persistence Object Naming Convention

I have some POCOs and there are corresponding persistence objects that do the CRUD. What is a good name for the persistence objects? I've seen people use the term "service objects" for these, but when I think service, I think WCF. Maybe "persistence objects" is the best, but I'd like to hear what other people think. ...

What is the correct color notation in XAML: #555 or #555555?

Doing CSS throughout the last couple years, I eventually learned that the standard way to represent a gray color shade (or any color which repeated its first three characters) was to use only three characters instead of six, I assume for terseness: #555 instead of #555555 #eee instead of #eeeeee In XAML, however, I often see the oppo...

Naming conventions for extension method namespaces and sponsor classes

What naming conventions are you using for namespaces and sponsor classes? (i.e. the classes that hold extension method definitions) Is there a standard/recommended .NET Framework naming convention? (the "Framework Design Guidelines, 2nd Edition" book only gives guidance on what namespaces not to use). ...

Need help naming a class which represents a value and its linear variation.

While doing some refactoring I've found that I'm quite often using a pair or floats to represent an initial value and how much this value linearly varies over time. I want to create a struct to hold both fields but I just can't find the right name for it. It should look something like this: struct XXX { float Value; float Slope...

Function naming: ActionIfCondition()

I often need to use a function which performs and action X is condition Y is set. What is the best way to name such a function? I don't want to repeat if statements, since they could be complex. For instance, if I want to trim a string if a property is set, function could be named: void TrimIfOptionSet(string) -- too unwieldy, espec...

Convention over configuration in ASP.NET MVC

I am relatively new to ASP.NET MVC, and am very impressed with the clarity of the platform so far. However, there is one aspect that I find uncomfortable. At first, I accepted the fact that when I say return View(); I am calling a helper method that returns an ActionResult, and makes some assumptions about which view to present, ro...