Typically, when I use lambdas, I just use "a, b, c, d..." as variable names as the types are easily inferred, and I find short names to be easier to read. Here is an example:
var someEnumerable = GetSomeEnumerable();
var somethingElseList = someEnumerable.Select(a => a.SomeProperty)
.OrderBy(a => a...
I think most of us agree that it's a good idea to use a descriptive name for variables, object attributes, and database columns. If you want to store something's name, you may as well call the attribute Name so people know what to put in it.
Where the unit of measurement isn't immediately apparent, I think you should go a step further ...
For those of you who name you member variables with no special notation like m_foo or foo_, how do you name parameters to your ctors and setters?
Some options I've tried so far...
Obj(int foo) : foo(foo) { }
void set_foo(int foo) { this->foo = foo; }
Obj(int _foo) : foo(_foo) { }
void set_foo(int _foo) { foo = _foo; }
Obj(int a_foo) ...
Do you think x, y, z are good variable names? How will you explain a new programmer to write readable code?
...
For instance in C# or Java, you always have a main() method used to get your program running. What do you name the class that it is in? Some ideas I would use would just be "Program" or the name of the program itself. What would be considered conventional in this case?
...
I have a naming strategy for denoting the nature of code entity (variable, method, etc.) which accounts for the most common permutations of scope, entity type, and mutability, but I have not been able to choose a way of denoting private static member fields (not properties).
What are some recommended ways of denoting this?
Update: F...
Have read through the MSDN naming guidelines and could not find a clear answer, other than that you should try to avoid underscores in general. Let's say I have the following:
public class Employee
{
private string m_name; //to store property value called Name
public string Name
{
get { return m_name; }
set...
Do you have a naming convention for APIs or Classes that are being phased in to replace an older version that performed the same function / filled the same role?
E.g. Windows does this by adding "Ex" to the end of the function:
ShellExecute // old
ShellExecuteEx // new
What do you prefer, and what are you reasonings?
Appendin...
When dealing with MySQL, I typically use the BOOLEAN type, which is equivalent to TINYINT(1), or 1/0
In most languages I work with, true/false is preferred
When displaying forms, sometimes "Yes / No" makes more sense
...
The standard naming convention in the Java world is to name packages, classes and methods according to:
com.domainname.productname (package)
com.domainname.productname.ClassName (class)
com.domainname.productname.ClassName.isUpperCase(String str) (method)
What is the C#/.NET standard naming convention for the above cases?
...
Is it possible to use the "_" underscore prefix for your own MovieClip names? (AS2)
i.e. Can you name a created/attached MovieClip "_feature" or "_bug" ?
Typically this is reserved for internal properties like _x or _visible.
...
Ever wonder what wikipedia's database schema looks like? I recently read this thread from reddit.
I like how their tables are tagged with a prefix so you can sort of tell its functionality, purpose, and relationship with other tables right off the bat.
One thing I do not notice is how they name their stored procedures. Do they even u...
What is the feeling on how strictly one should apply camel casing to variables.
I'm thinking specifically of variables like identifiers whose names will contain ID. Do you use thingID, or the more correct thingId? The second one always looks wrong to me.
...
Hi All,
I often find myself implementing a class maintaining some kind of own status property as an enum: I have a Status enum and ONE Status property of Status type. How should I solve this name conflict?
public class Car
{
public enum Status
{
Off,
Starting,
Moving
};
Status status = Status.Off;
public Status ...
When I write setters for instance methods, I use this to disambiguate between the instance variable and the parameter:
public void setValue(int value) {
this.value = value;
}
So, what do I do when value is a class variable (static) instead of a member of an instance?
private static int value = 7;
public static void setValue(int val...
I am developing a framework, and some of the objects have reaaally long names. I don't really like this, but I don't like acronyms either. I am trying to come up with a shorter name for "EventModelSocket", basically a wrapper around the .Net socket class that implements various events, and methods to send files, objects, etc. Some of the...
I'm having some problems to come up with a sane type naming scheme for our new line of applications. I want to follow the .NET Framework Developer's Guide - Design Guidelines for Developing Class Libraries, but I'm starting to wonder if that's such a good idea.
I'd like to use the Company.Product.Feature namespace scheme as a basis.
Pr...
I'm looking for the "best practice" as to where the JSON should be stored if it's just a string array. Should it be stored in a variable in a script block in the HTML page? Should it be stored in a JavaScript file outside of the HTML for separation? Or should it be stored in the plugin itself?
If it should be an external js file, what's...
Sorry for the waffly title - if I could come up with a concise title, I wouldn't have to ask the question.
Suppose I have an immutable list type. It has an operation Foo(x) which returns a new immutable list with the specified argument as an extra element at the end. So to build up a list of strings with values "Hello", "immutable", "wo...
In the last year and a bit of working on my team's code base I have noticed a steady progression of naming conventions.
For example, there are a lot of classes that are named to express that they are a class that helps you do something.
Here's the ones I've spotted:
MyClassUtil
MyClassFactory
MyClassHelper
MyClassManager
MyClassServic...