naming-conventions

good name for a method that adds to a container if not aleady there

What's a good name for a method that adds something to a container if it's not already there, i.e. void AddCustomerToList(CustomerList list, Customer customer) but that name does not properly convey that it won't be added if it's not there already. What is a better name? AddCustomerToListIfNotThereAlready? EnsureCustomerInList? ...

How to circumvent Symbian naming conventions?

I'm about to write a C++ library that is to be used by a Windows application as well as on Symbian. Linux is not a current requirement but should generally be possible, too. For this reason I would like to use the STL/Boost naming conventions instead of Symbian's, which I think, are hard to get used to. This seems to already present a pr...

A few C# naming convention questions

1) What's the policy for declaring a variable? Should you always use the keyword private, or is it OK to skip it? string MyVar1; vs. private string MyVar1; The only reason I see is that Microsoft one day can change the default access modifiers to public instead of private. Where does it say that private is optional? Any references...

is it ever useful to define a class method with a reference to self not called 'self' in Python?

I'm teaching myself Python and I see the following in Dive into Python section 5.3: By convention, the first argument of any Python class method (the reference to the current instance) is called self. This argument fills the role of the reserved word this in C++ or Java, but self is not a reserved word in Python, merely a naming conv...

Naming database table fields

Exists any naming guideline for naming columns at Sql Server? I searched at MSDN, but dont found anything, just for .Net ...

Best practices for C# GUI naming conventions?

GUIs, whether written in WinForms or XAML, seem to have the most widely differing naming conventions between projects I see. For a simple TextBox for a person's name, I've seen various naming conventions: TextBox tbName // Hungarian notation TextBox txtName // Alternative Hungarian TextBox NameTextBox // Not even camelCase Text...

Base file naming conventions

I have a few web pages that all perform various functions for one main piece of functionality or "tool". Instead of having one massive page where I do the various functions based on a "mode" query parameter (?mode=edit, new, view, etc.) I want to break up the pages so debugging won't be such a nightmare since the code is long and comple...

Why is it convention to suffix event handlers with 'handler'? Why not prefix them with 'handle'?

I've noticed that it's common (at least in ECMAScript) to suffix event handlers with 'handler': clickHandler, fooBarHandler, etc… But I've always thought it made more sense to prefix them with 'handle': handleClick, handleFooBar, etc. With prefix notation, methods are much easier to visually parse (it's very easy to distinguish between ...

Custom naming conventions in Fluent NHibernate AutoMapping

Hello, according to this Post it is possible to change the naming convention from "[TableName]_id" to "[TableName]ID". However when I saw the code, I wasn't able to do it with my rather new (about 6 weeks old) version of Fluent NHibernate. Original code: var cfg = new Configuration().Configure(); var persistenceModel = new Persistence...

What is it called when several conditional code blocks are inside each other?

I cant for the life of me remember what the word is. It's when you ???? several if/else/for/while/usings inside each other. bool isTrue = true, isFalse = true, HasForgottenWord = true; if( isTrue ) { if( isFalse ) { if( HasForgottenWord ) { Console.WriteLine("Ask on StackOverflow....

Interface naming for adjectives

OK, so it's easy to name an interface (or class for that matter) if you can easily think of a noun: User, Window, Database, Stream, etc. What about an adjective or adjective concept? e.g. something that has a timestamp (HasTimestamp, Timestamped, Timestampable...?) or something that is tracked or watched (Trackable, IsTracked, Watchable...

Naming convention and structure for utility classes and methods

Do you have any input on how to organize and name utility classes? Whenever I run in to some code-duplication, could be just a couple of code lines, I move them to a utility class. After a while, I tend to get a lot of small static classes, usually with only one method, which I usualy put in a utility namespace that gets bloated with ...

Class naming chaos

I often struggle with deciding how to name a class. Not so much because the class's purpose is unclear, but because of names like xxx*Controller*, xxx*Manager*, xxx*Info*, xxx*Helper*, xxx*Util* etc that I see everywhere. If I have a class that uploads some stuff over HTTP, I tend to name it HttpUploader or something on those lines. ...

Should I stop fighting Visual Studio's default namespace naming convention?

I'm working on an MVVM project, so I have folders in my project like Models, ViewModels, Windows, etc. Whenever I create a new class, Visual Studio automatically adds the folder name to the namespace designation instead of just keeping the project-level namespace. So, adding a new class to the ViewModels folder would result in the namesp...

Most awkward/misleading method in Java Base API ?

I was recently trying to convert a string literal into a boolean, when the method "boolean Boolean.getBoolean(String name)" popped out of the auto-complete window. There was also another method ("boolean Boolean.parseBoolean(String s)") appearing right after, which lead me to search to find out what were the differences between these two...

Naming Usercontrols. Convention?

So you've got a usercontrol. You would like to bind to some of its dependency properties, so you need specify an x:Name in order to use it. You can't do this... <UserControl x:Class="WpfApplication1.UserControl1" x:Name="UserControl1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="h...

What are the C# namespace and class/sub-class naming conventions when the top namespace contains the base class and inner namespaces contain sub-classes?

I'm trying to design a class library for a particular engineering application and I'm trying to ensure that my class & namespace naming conventions make sense. I have the following situation: namespace Vehicle{ class Wheel{...} //base class for Wheel objects class Engine{...} //base class for Engine objects ... namesp...

Naming conventions for function parameter variables?

Is there a naming convention or maybe some guideline on how to name function parameters? Since forever, I have been doing it like this: function divide( $pDividend, $pDivisor ) { ... } That way I'll always know which variables were passed as parameters. (This one's PHP, but it should be applicable to most programming languages) Is ...

Advantages of a framework with strong naming conventions

Hi There I know some PHP and now I'm the stage of choosing a framework. After some diggs, I've find that CakePhp is a good choice. After some manual/tutorial readings and trying some cakephp code samples I'm wondering myself about how good is the idea of naming convention used by CakePHP. They are using the term: "convention over conf...

What is the purpose of tbl_Product, tbl_Order naming conventions?

I've seen tbl_ prefixes decorating all tables in the last two code bases I've worked with. I can't think of any reason they'd be useful for application developers or database administrators. If a DBA needs to see what objects are tables they can always join up to DMV's or the schema tables in master right? I can't think of how they'd ...