naming-conventions

Identical class names in different namespaces

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-30 23:25:10
问题 I have two different namespaces, with lots of classes with the same name. I believe some code will make it easier to understand: namespace Print.Pdl.PostScript.Operators { public abstract class BaseOperator : IOperator { // ... } } namespace Print.Pdl.Pcl6.Operators { public abstract class BaseOperator : IOperator { // ... } } The basic implementation is the same, as PostScript and PCL have similar constructs. So, both namespaces end up having identical names to several classes. I am tempted

MySQL: Can't give tables a name in Upper Camel Case (Pascal Case)

倾然丶 夕夏残阳落幕 提交于 2019-11-30 23:15:29
I read that it is best practise to have table names in Pascal Case (ThisIsMyTableName). Therefor I would like to change my tables in MySQL. But neither phpmyadmin, nore SQL Manager 2005 for MySQL will let me. The names stay to appear in lowercase, as if I didn't to a change at all. Any suggestions to solve this problem? I advice against mixed case because of problems with case sensitivity. A fully tested solution on one platform where case doesn't matter may actually fail when deployed on a platform where case DOES matter. For that reason alone I suggest sticking with either all caps or all

What does the double minus (--) convention in function names mean in Emacs Lisp

蓝咒 提交于 2019-11-30 22:20:03
问题 I've been reading through a number of Emacs Lisp packages and have come across the convention of some functions being declared with -- after the library prefix, e.g.: (defun eproject--combine-regexps (regexp-list) I'm wondering if this a convention for declaring "private" functions to the library but so far I haven't found anything in the Emacs Coding guidelines. 回答1: Emacs doesn't have any support for namespaces, packages, libraries or modules. Emacs sources therefore use foo- as a prefix

Is there a python naming convention for avoiding conflicts with standard module names?

心不动则不痛 提交于 2019-11-30 21:49:54
问题 PEP 8 recommends using a single trailing underscore to avoid conflicts with python keywords, but what about conflicts with module names for standard python modules? Should that also be a single trailing underscore? I'm imagining something like this: import time time_ = time.time() 回答1: PEP 8 doesn't seem to address it directly. The trailing underscore is obviously necessary when you're colliding with a keyword, because your code would otherwise raise a SyntaxError (or, if you're really

Camel case and Pascal case mistake

丶灬走出姿态 提交于 2019-11-30 21:29:09
问题 I constantly forget which is Camel case and which is Pascal case. So I thought that maybe a little history will help. Where do the names of these conventions come from? Is there some history behind their names? 回答1: To remember camel case you have to think about the shape of the capital letters. They are like the humps of a camel as you can see in this image. Pascal Casing - capitalizes each word: ThisShouldBePascalCase Camel Casing - is similiar to pascal case but the first word is not

Underscore method prefix

烈酒焚心 提交于 2019-11-30 21:18:32
I've been examining the code of CodeIgniter and CakePHP and I noticed that some of the methods in their classes are prefixed with an underscore _ or a double underscore __ . What's the purpose of that? In the case where it is not any of PHP's magic methods , it is to indicate Visibility in lack of proper Visibility keywords: Cake Coding Conventions: As we cannot use PHP5's private and protected keywords for methods or variables, we agree on following rules: A protected method or variable name start with a single underscore ("_"). A private method or variable name start with double underscore (

Naming convention for params of ctors and setters

橙三吉。 提交于 2019-11-30 20:46:51
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) : foo(a_foo) { } // a for "argument" void set_foo(int a_foo) { foo = a_foo; } Obj(int init_foo) : foo(init_foo) { } void set_foo(int new_foo) { foo = new_foo; } I'm using foo_, it's better than _foo since it won't conflict with implementation specific function

Standard naming conventions for Objective-C [closed]

醉酒当歌 提交于 2019-11-30 20:32:18
Being in the beginning of a project in Objective-C, I'm gathering different kind of information and I would like to find a good naming convention. Does such resource exist ? Official Unofficial but still widely used Here is the Cocoa official documentation . additionally to the standart coding conventions published by Apple, I want to hint to Matt Gemmell's great article about API Design , that also covers naming conventions for protocols used in delegation. 来源: https://stackoverflow.com/questions/12662969/standard-naming-conventions-for-objective-c

What are the most common naming conventions in C#?

醉酒当歌 提交于 2019-11-30 19:58:24
问题 What are the most common naming conventions in C# for classes, namespaces and methods? Is it common to have getter/setter style methods as in Java? 回答1: There are a few common patterns out there. One I frequently see and use in my own projects is: namespace Company.Concept.SubConcept { public class MyClass { private MyType someData; public MyType SomeData { get { return someData; } set { someData = value; } } public void MyMethod() { } } } 回答2: Guidelines for Names (from Design Guidelines for

camel case method names

为君一笑 提交于 2019-11-30 19:04:52
I understand the reason to camel case variable names, but I've always wondered why you would camel case a method name? why is it toString() and not ToString()? What purpose does it serve? A lot of conventions say you capitalize the first letter of types (classes, structs, enums, etc.), and use lowercase otherwise (functions, members, etc.). If you follow that convention, you can then tell just by looking that MyStruct.MyType refers to a nested type, and MyStruct.myData refers to some form of data, and MyStruct.myFunc() refers to a function call. We use lower-case on the first letter to save a