naming-conventions

Sensible variable names for a text adventure action

This is a difficult one, I've been racking my brains but I just come up with a sensible name for these variables. Someone will probably instantly hit on one. Take these example actions: "throw bottle at wall" "push John into door" "attack Ogre with sword" action thing at/with/on/in/to thing I need a sensible name for the first "thi...

Fluent NHibernate different Conventions for different base types

Hi All At this moment we are keeping all Entities and Mappings into same assembly. Our entities derived from a basic class Entity which is an EntityWithTypedId Also we are having a table name Convention telling to pluralize the table names. Now I want to create other two base types e.q. AggregateRootEntity and AggregateEntity, both d...

Boolean property naming

I have a property that indicates whether the instance could be modified. Should it be named MayModify or CanModify? ...

StyleCop: a complete document

I am sorry for asking a dull question. I'd like to provide StyleCop as a default code review tool in the company I am working for. StyleCop is a great tool, but the question is: is there a complete document that describe the code convention rules StyleCop based on? Not a list of warnings, but readable set of rules and explanations. T...

Rails naming conventions for models with forbidden names

Hi, I'm writing a rails application, and I need to name one of my model Test, and inside that model I need a class attribute - when I tried the first one, I couldn't run any UT since Test ceased to be a module - so I ranamed to Tst. I haven't even tried naming a column class - I went with clss. What names would you use? Are there any c...

Java Spring MVC Folder / Naming Conventions

I'm trying to determine the best way to organize our Maven / Spring web applications and have been looking around to see examples. Unfortunately, they seem to conflict at certain points. How should the folders be organized in a Spring MVC webapp and what should they be called? The big differences I see are: The folder for JSPs. /sr...

Cannot decide a proper namespace for 'Character'.

I am building a game engine, and I am actually having a very difficult time placing what kind of namespace to put Character under. This may be the single dumbest question I've ever posted on StackOverflow, but it's driving me nuts. What would you guys do? I don't really have any other namespaces yet defined. Characters have Sheets (La...

Naming conventions - Working with PHP and MySQL

Aloha, I just recently started programming in PHP and have a basic naming convention question. I've read a lot of PHP coding standards after reading this post. It made perfect sense to me, since I already prefer to use camelCase when naming variables. Since I'm going to be working with MySQL, I also read up on Database naming convent...

Why are List and String identifiers named "xs" (in Scala and other languages)?

A lot of sample Scala code contains Strings and Collections named "xs" Why xs? Anything to do with the xs: used in XML (for Schema?) Examples: var xs = List(1,2,3) val xs = "abc" ...

Regex to verify filename and relative path with no upward navigation (..\) in Windows

I'm trying to verify that a filename and path input by the user is structurally correct in a C# GUI. I do not need to make sure the file exists, just that the name is a valid windows file name and the path is a valid relative path from the present working directory. Absolute paths must be explicitly denied. Regex was never my thing. A...

Best practice: best database naming convention for JPA?

In Java the naming convention for properties en classes (entities) are done the CamelCase way: @Entity public class UserMessage implements Serializable { @Id private Integer id; private String shortTitle; private String longTitle; private String htmlMessage; } But in the SQL world it’s considered a best pract...

Why do local variables in Magento have an underscore prefix?

As a follow up to an earlier question I wonder if anyone knows why Magento templates all declare their variables with an underscore. Templates are .phtml files include-ed from Mage_Core_Block_Template::fetchView(), their local variables are disposed of by the end of the function and never become global. So what's the point of an unders...

Multiple databases or table naming conventions?

How do you split up your data for an application based on a database? A lot of software will have tables named something like Auth_Users, Auth_Whatever, Auth_Something, and then Admin_Something, Admin_Whatever, etc. Essentially the tables all exist in one database but they are organized by a naming convention. The other option would be t...

Is there a meaningful difference between "Double" and "double" in .Net?

As regards best practices, is there a meaningful difference between using: Double d; and double d; I know best practices are fraught with contradictions, so I know the answers may vary here. I just want to know the pragmatic difference between the two. ...

Are there any best-practices or guidelines for naming conventions for the business layer in a n-tier architecture?

We are thinking of going with an n-tier architecture for a project that we are going to start. I just wanted to get an idea of naming conventions. I have read a couple of books and done some research on the net but I am still struggling to find an appropriate name for objects that do your basic CRUD. One book used the suffix logic. So if...

What does it mean when `Ex` is added to a function/method name?

I don't work with the Windows API much, but I've seen it used there as well as occasionally in a codebase here at work. ...

Method naming conventions. Should the method be named getX(), if the there's no corresponding setX() ?

Say I got an Employee class that has a hire date data member. This member only get set one time only and it is constant too. So it'll get initialised when the object is created. If I want the class to have a method that returns the hire date, what's better: getHireDate(); Or just: hireDate(); Am I thinking too much :D ? ...

What is the technical term for the input used to calculate a checkdigit?

For example: code = '7777-5'; input = code.substring(0, 4); // Returns '7777' checkdigit = f(input); // f() produces a checkdigit assert.areEqual(code, input + "-" + checkdigit) Is there a technical term for input used above? Specifically I'm calculating checkdigits for ISBNs, but that shouldn't effect the answer. ...

.NET parameter naming conventions

In the example below, what would you name the parameter given that it is used to initialize the property FromDate? For class constructor methods, I like to have the name of the constructor parameter variable match the name of the property which is being initialized. For example, the parameter "fromDate" is used to initialize the module...

Java method naming conventions

I have a boolean field called showLabels in a Bean class, and I want to provide getter and setter methods for it. The setter will be setShowLabels, but should the getter be isShowingLabels, isShowLabels (that's really weird sounding), or setShowLabels? ...