naming-conventions

Method Naming Convention Question (most languages)

If I have a method that hides a button, I would probably call it HideButton If I have a method that shows a button, I would probably call it ShowButton But what do you guys call a ShowIfThisHideIfThat style method? Possible Choices: TestForButtonVisibility (this kind of sounds like it will return true/false but not actually do the wo...

Hyphenated company name in Java packages

Let's say you're working on the core module of the foo project for BarBaz Incorporated. Your code fragment might look like this: package com.barbaz.foo.core; import com.barbaz.foo.util; What would the convention be if your companies website was not barbaz.com, but instead bar-baz.com? Thanks in advance! ...

Resharper suggestion Page_Load = PageLoad

Usually when the page_load event handler is added to a codebehind file by Visual Studio (e.g. double clicking the page in designer mode), it ends up looking like this: /// <summary> /// Handles the Load event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="...

unit testing package naming convention

Is there even a standard convention for this? I see a lot of different and perhaps misguided package naming that is very mixed in some projects and thus is never consistent: Let's say I want to write unit tests for something that falls under the 'stuff' package. com.company.product.amodule.submodule.stuff The unit test could be one ...

How would you call a life-cycle management class?

Hi, The title pretty much says it all, as an example you can think of a hibernate transaction and a class which begins one for a thread, commits and rollbacks, Or a class which gets a session, closes it and flushes it (both examples are with the threadlocal pattern in mind). Thanks ...

Naming of classes providing the complete implementation of an interface, but which are designed to be extended / used as mixins.

If you write an interface with a lot of methods, say IPerson, and you expect a lot of different implementations of it, it is quite common practice to provide an abstract class AbstractPerson which implements the bulk of the functionality. Normally AbstractPerson is abstract, since you usually leave some key functionality unimplemented. ...

Java : naming convention for accessors

I'm looking for the official naming convention in Java regarding accessors. I've seen that, for instance, the JPanel class deprecated the size() method in favor of getSize(). But in the ArrayList class, the method is size(). So I'm wondering if accessors should be named getXXX() or xXX() ? ...

Naming suggestion for a class containing a timestamp and a float value?

I need to name this structure: struct NameNeeded { DateTime timestamp; float value; } I will have arrays of this struct (a time-series). I'd like a short and suggestive name. The data is financial (and Tick is not a good name). The best one I can think of is DataPoint, but I feel that a better one exists :) How would you na...

What is a good naming convention for vars, methods, etc in C++?

Hi all. I come from a the Objective-C and Cocoa world where there are lots of conventions and many people will say it makes your code beautiful! Now programming in C++ I cannot find a good document like this one for C++. http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/CodingGuidelines/CodingGuidelines.html Stand...

Maven artifact and groupId naming

I'm currently in the process of moving some project from Ant to Maven. Conformist as I am, I want to use well-established conventions for finding groupId and artifactId, but I can't find any detailed conventions (there are some, but they don't cover the points I'm wondering about). Take this project for instance, first the Java package:...

Naming dto objects

Hi, I have a model object called Country: class Country { public string Name { get; set; } public string Code { get; set; } public Region[] Regions {get;set;} public URI[] Uris {get;set;} } and via WebService I want get this Country in few versions: only Name and Code every field every filed without Uris every fiel...

Naming convention for interface implementator's object

What is the most commonly used convention (in C# and VB) to name object, when I want to emphesize that it is an instance of class that implements some interface. Like here: //is iDisp correct name? protected void Dispose(IDisposable iDisp) { iDisp.Dispose(); Console.WriteLine("Disposed"); } ...

Visual Studio 2010 & 2008 can't handle source files with identical names in different folders?

Direct Question: If I have two files with the same name (but in different directories), it appears that only Visual Studio 2005 can handle this transparently?? VS 2008 & 2010 require a bunch of tweaking? Aside from my naming convention, am I doing something wrong? Background: I'm developing C++ statistical libraries... I have two fo...

What is a good name for an instance method that adds a linked-list node after the target?

I'm creating a doubly-linked list in Objective-C. I would like my node class to include an instance method that allows me to add another node after the target node, like so: // start <-> nodeA <-> nodeB <-> nodeC <-> end Node * newNode = [Node node]; [NodeB thisMethodNeedsAGoodName:newNode]; // start <-> nodeA <-> nodeB <-> newNode <-...

Using a "custom" user ID as opposed to the user's real, auto_incremented database ID in web applications ?

I'm not sure about its terminology, but for http://www.somedomain.com/user/123456, the "custom user ID" I'm referring to is 123456. I have seen this on quite a lot of websites, in fact, even SO uses something similar. What I'm curious about is: What are they ? - I guess they can't be the real, auto_incremented user ID from the database...

PHP coding standards at work: Insane, or am I?

I prefer coding standards to be logical. This is my argument for why the following set of standards are not. I need to know one of two things: (1) why I'm wrong, or (2) how to convince my team to change them. camelCase: Functions, class names, methods, and variables must be camelCase. Makes it hard to differentiate between variable...

Naming conventions for "number of foos" variables

Let's suppose that I need to store the number of foo objects in a variable. Not being a native English speaker, I always wonder what's the best (= short and immediately clear) name for that var. foo_num? num_foo? no_foo? foo_no? or something else? The full name should be number_of_foos, but it's a bit verbose. What's your favorite an...

Underscore method prefix

I've been examining the code of CodeIgniter and CakePHP and I noticed that some of the methods in their classes are prefixed with underscore _ / double underscore __. What's the purpose of that? ...

Django naming conventions for dates.

Is there any naming convention for "created" and "last edit" dates in Django? ie. in Symfony Framework this fields are named by default: created_at updated_at ...

Why have the "jquery." prefix on plugin filenames?

I'm curious as to the reasoning behind the standard procedure of prefixing jQuery plugin filenames with "jquery.". Several tutorials state something like: The use of the "jquery." prefix eliminates any possible name collisions with files intended for use with other libraries. I believe I have even seen a couple of plugins that actu...