naming-conventions

PersistenceConstructor argument variable name doesn't match instance variable name

梦想的初衷 提交于 2019-12-01 06:03:58
I'm trying to persist the following object with spring-data-mongodb version 1.1.1.RELEASE : @Document public static class TestObject { private final int m_property; @PersistenceConstructor public TestObject(int a_property) { m_property = a_property; } public int property() { return m_property; } } I get a MappingException when I try to read the object back from the database (see full stacktrace below) The naming convention my group uses requires argument variable names to be prefaced by a_ and instance variable names to be prefaced by m_ . It seems like spring-data-mongodb is making the

Naming local constants: UpperCamelCase or lowerCamelCase?

荒凉一梦 提交于 2019-12-01 04:55:29
问题 Which naming convention do you use for local constants in C# and why? const int Pi = 3; const int pi = 3; It seems the trade-off is between lower camel-case indicating restricted scope, and upper camel-case being more readable and easier to move to a class level. I've noticed StyleCop prefers upper camel-case. 回答1: I'm used to upper case (pascal case) for everything except variables and fields. Global constants are an exception to the fields, I don't know why, probably because they are public

PersistenceConstructor argument variable name doesn't match instance variable name

时间秒杀一切 提交于 2019-12-01 03:58:41
问题 I'm trying to persist the following object with spring-data-mongodb version 1.1.1.RELEASE : @Document public static class TestObject { private final int m_property; @PersistenceConstructor public TestObject(int a_property) { m_property = a_property; } public int property() { return m_property; } } I get a MappingException when I try to read the object back from the database (see full stacktrace below) The naming convention my group uses requires argument variable names to be prefaced by a_

How to name Haskell variables which in physics are uppercase

女生的网名这么多〃 提交于 2019-12-01 03:55:25
Variable names in haskell need to be in small case, but How to declare variables in .hs file, if we want to store g = 9.8 and G = 6.67300 × 10-11 (in following scenario) ? Conventionally Physicists mention : (1) Acceleration due to gravity on earth g = 9.8 m/sec^2 (2) Universal Gravitational constant G = 6.67300 × 10-11 m3 kg-1 s-2 You will just have to come up with another name. The distinction between names starting with upper- and lowercase letters is part of the syntax. While this may be unfortunate in your case, it's a design trade-off. In order to simplify differentiating between

Identical class names in different namespaces

萝らか妹 提交于 2019-12-01 03:21: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 to do the following... namespace Print.Pdl.PostScript.Operators { public abstract class BasePsOperator

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

ε祈祈猫儿з 提交于 2019-12-01 02:18:31
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() 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 unlucky, compile to mean something completely different than you intended). So, even in contexts where you have a

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

随声附和 提交于 2019-12-01 02:04:18
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. Emacs doesn't have any support for namespaces, packages, libraries or modules. Emacs sources therefore use foo- as a prefix for a foo library, and in some cases foo-- is used for bindings that are supposed to be internal. There is

Why is the C++ STL set container's count() method thus named?

蓝咒 提交于 2019-12-01 00:36:19
问题 What it really checks for is contains() and not the count of the number of occurrences, right? Duplicates are not permitted either so wouldn't contains() be a better name than count()? 回答1: It's to make it consistent with other container classes, given that one of the great aspects of polymorphism is to be able to treat different classes with the same API. It does actually return the count. The fact that the count can only be zero or one for a set does not change that aspect. It's not

How to name Haskell variables which in physics are uppercase

﹥>﹥吖頭↗ 提交于 2019-12-01 00:16:34
问题 Variable names in haskell need to be in small case, but How to declare variables in .hs file, if we want to store g = 9.8 and G = 6.67300 × 10-11 (in following scenario) ? Conventionally Physicists mention : (1) Acceleration due to gravity on earth g = 9.8 m/sec^2 (2) Universal Gravitational constant G = 6.67300 × 10-11 m3 kg-1 s-2 回答1: You will just have to come up with another name. The distinction between names starting with upper- and lowercase letters is part of the syntax. While this

What are the naming conventions that you use while coding?

混江龙づ霸主 提交于 2019-11-30 23:26:17
What are the naming conventions that you use while coding? aku I hope we will not discuss prefixes for field names and brace styles here :) Here is my bible for .NET: Also MSDN gives solid guidelines. Another useful source is MS Internal Coding Guidelines Here's a list of general naming conventions from MSDN. I tend to just go-with-the-flow, however. Whatever standards are currently in place, it's usually easiest to just go with them and maybe slowly shift it over time. It's not really practical to just come into a project with your own idea of "standards" and try to implement them. It doesn't