naming-conventions

Python / Django: Is it wise to use "Item" as a class name in Python (in Django in this case)?

I'm creating this: # models.py class Item(models.Model): sku = models.CharField(max_length=20) class Attribute(models.Model): item = models.ForeignKey(Item, related_name='items') Is that going to cause naming collisions in Python? Like: # views.py some_object.items.create(sku='123abc') # Is there a place / way that this c...

Making CodeIgniter use <ControllerName>_Controller by default without changing the library?

I'm finding I have lots of conflicts with class names when developing for CodeIgniter. For example, I recently had the situation where I had a Checkout controller: class Checkout extends Controller { // Contents } And then went on to create a new custom library: class Checkout { // Contents } Which would obviously throw a...

What are the best naming conventions you've used?

I was wondering how people name variables, objects, and function names with all the combination's out there; camel-case, pascal, using underscores, all caps for statics etc.... A good naming convention that is uniform could create a quicker understanding of what the item is, leading to much faster interpretations...e.g. 'oh its all in c...

tell jaxb to not remove underscores

Hi.Is there a way to tell JAXB to not remove underscores when creating getter/setter names from XML Schema? Reason: this causes loss of information and it is harder to trip between XML and Java; e.g. in written communications where one participant might be confused about "different names". Example: NR_ROR should not become getNRROR but...

How to name GUI elements?

Hi, One thing that constantly causing me headache in programming is when I don't have any naming-convention in a domain where I have to deal with a lot elements. It is clearly what is happening to me when using UI designers such as Windows Forms designer. Everytime I start a new project I am trying to reinvent a "seem-strong" naming co...

How do I resolve this terminological confusion when refactoring existing code to use the MVVM pattern?

I'm struggling with a terminological conflict and can't figure out a good resolution. Maybe someone else has had this problem. I'm rebuilding an existing WinForms application to use WPF. I'll be using the MVVM pattern in my new application. My old application makes extensive use of ADO; specifically, I have Row objects that wrap Data...

jQuery plugin naming convention (for the function)

Which casing looks better to you for a jQuery plugin: $("#foo").runMyPlugin(); or $("#foo").runmyplugin(); Is there a naming convention for jQuery that prefers on over the other? Thanks in advance! ...

What is a good name for class which creates factories? (FooFactoryFactory sounds silly imo)

I don't remember exactly is it a common pattern but I have a class (Factory Method pattern) which has method for creating other classes (Abstract Factory pattern) depending on enum parameter: public class FooFactoryFactory { public FooFactory createFactory (FooFactoryType type) { switch (type) { case AFoo: ...

assembly naming conventions

Assuming you have a namespace that is useful to more than one project in your company, in the format of "MyCompany.Core", would you have an assembly named exactly the same way or just "Core". Why or why not? ...

What is the correct generic name for the data structure in a calculator app that holds the numeric display

It would hold a string and have characters (numeric, or decimal point) added and removed from the right end. Ignore the case of negative numbers for simplicity. Does this kind of data structure have an agreed-upon name? Register? Buffer? Display? Something else? UPDATE: This is an internal representation and may not be the final form o...

C# variable name corpID vs. corpId

I'm trying to determine if a local variable in C# should be named "corpID" or "corpId". See the difference? Should the "d" to be upper case or lower case? Consider this one also: customerPK vs. customerPk It matters more if another word is added the end. Like this: customerPKField vs. customerPkField See my delima? Is there a wi...

How should I format user uploaded pictures' filenames?

My website deals with pictures that users upload. I'm kind of conflicted on what my picture filename should consist of. I'm worried about scalability simply and possibly security? Maybe someone out there deals with the same thing and can tell me what their use on their site? Currently, my filename convention is {pictureId}_{userId}_{sa...

Better identifier names?

How can I train myself to give better variable and function names (any user-defined name in a program). ...

How to avoid crazy naming conventions?

Is it common to name an assembly one name, name a folder inside of the assembly another and then start to carry those names into the classes inside of those folders? For example: Project.Presenter Carriers CarriersFindPreferedCarriersPresenter.cs CarriersPreferencesPresenter.cs PreferredTargetLocationPresent...

Accessing data members shadowed by parameters

In Java you can access variables in a class by using the keyword this, so you don't have to figure out a new name for the parameters in a function. Java snippet: private int x; public int setX(int x) { this.x = x; } Is there something similar in C++? If not, what the best practice is for naming function parameters? ...

Was it a big mistake of JavaScript language inventor to use function instead of a shorter word ?

It seems that it would be wise to use def, fn, or fun for function definitions similar to Ruby or other succinct languages. Now that it's too late to change things due to potential compatibility issues, the whole world is forced to suffer using that wasteful long name 'function' everywhere in JavaScript code. ...

Java Naming Convention with Acronyms

What is the correct name for the following Java class: DVDPlayer or DvdPlayer? ...

What is a proper naming convention for MySQL FKs?

Being that they must be unique, what should I name FK's in a MySQL DB? ...

How to best name fields and properties

Microsoft says fields and properties must differ by more than just case. So, if they truly represent the same idea how should they be different? Here's Microsoft's example of what not to do: using System; namespace NamingLibrary { public class Foo // IdentifiersShouldDifferByMoreThanCase { protected...

Is there a convention for naming initializer method in objective-c?

In an objective-c class that can be initialized through different init... methods, it is common sense to collect initialization code that is common to all initializers into one common method that is called from the other init* methods (or also sometimes from awakeFromNib). Is there a convention for how this method should be named? initi...