naming-conventions

How to avoid class name and namespace conflict?

核能气质少年 提交于 2019-12-10 10:42:49
问题 Sometimes I have need to call namespace and class the same. For example, SomeProject.Compiler namespace, containing lots of compiler-related stuff and the main entry point class Compiler. But naming namespace and class name the same is not recommended, as it creates ambiguity and misleads compiler. Is there any idea, how to name them better? 回答1: It is always possible to give general namespace name, which describes all its members. For example, CompilerServices instead of compiler. 回答2: Some

MvvmCross Naming Conventions

浪子不回头ぞ 提交于 2019-12-10 10:08:14
问题 I'm pretty new to MvvmCross and understand that successful use of the framework relies on specific naming conventions in some areas. I have been looking around trying to find information on these naming conventions, but apart from figuring some of them out from watching various videos, I haven't been able to find anything that explains all the requirements in one place. Any suggestions? 回答1: The naming conventions used: in bindings are in https://github.com/MvvmCross/MvvmCross/wiki

Get property-name of generic abstract class

纵饮孤独 提交于 2019-12-10 10:05:25
问题 Considering the following implementation of a generic, abstract class: public abstract class BaseRequest<TGeneric> : BaseResponse where TRequest : IRequestFromResponse { public TGeneric Request { get; set; } } Is there any chance to get the name of the property Request without having an instance inherited from it? I need Request as string "Request" to avoid using hardcoded strings. Any ideas how to make this through reflection? 回答1: Starting from C# 6, you should be able to use the nameof

Why is it bad to start a variable name with a dollar sign in C++/Java and similar?

我们两清 提交于 2019-12-10 09:51:26
问题 Why is it bad to start a variable name with a dollar sign in C++/Java and similar such as in PHP? Edit: Are there any risks? 回答1: In C++, it's non-portable. The only characters the standard says (section [lex.name] ) must be acceptable to begin an identifier are uppercase and lowercase letters and underscore. 回答2: In Java, using $ in variables is legal but definitely a bad idea. If you do this, there is a risk that you will accidentally use a name that collides with a name that is used by the

Do vs. Run vs. Execute vs. Perform verbs [closed]

╄→гoц情女王★ 提交于 2019-12-10 03:21:17
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 6 years ago . What list of verbs are you using for method names? What's your personal or team standard? I debate whether to use Do vs. Run vs.

When to use one or two underscore in Python [duplicate]

六眼飞鱼酱① 提交于 2019-12-10 03:15:08
问题 This question already has answers here : What is the meaning of a single and a double underscore before an object name? (15 answers) Closed 10 months ago . Ok I think I have understood the use of one and two heading underscores in Python. Correct me if I am wrong, In the case of one underscore, the underscore prevents the from X import * statement to import this kind of variables. In the case of two underscores, the variable's name is prepended with the name of the class it belongs to allow a

Naming convention for groovy script files

假如想象 提交于 2019-12-10 02:21:08
问题 Is there any convention regarding groovy script files naming? Should I name the script file in camelcase form, like if it was a regular class (i.e. FooBar.groovy )? Or will it be better to name it using small case letters and underscores (i.e. foo_bar.groovy )? 回答1: I have seen suggestions that say groovy class files should be the camel case just like Java classes, but for groovy scripts, the recommendation was lower case names, at least the first letter. The idea is that you can very easily

Naming convention for UML

拟墨画扇 提交于 2019-12-09 16:31:01
问题 Is there any name convention for UML? I am interested in knowing how to name classes, packages and methods. However, if there is some document which specifies all naming convention for each UML diagram, please share it. 回答1: The UML standard does not specify any naming convention. The naming standard you choose depends on the target audience of your UML model. This audience again is dependend on the purpose of your model. If you intend e.g. to generate code from your model than you need to

Python: how to batch rename mixed case to lower case with underscores

半城伤御伤魂 提交于 2019-12-09 16:16:03
问题 I've written a fair bit of my first significant Python script. I just finished reading PEP 8, and I learned that lower_case_with_underscores is preferred for instance variable names. I've been using mixedCase for variable names throughout, and I'd like my code to be make more Pythonic by changing those to lower_case_with_underscores if that's how we do things around here. I could probably write some script that searches for mixedCase and tries to smartly replace it, but before I potentially

Underscore after a variable name in Python

夙愿已清 提交于 2019-12-09 14:09:15
问题 I am deciphering someone else's code and I see the following: def get_set_string(set_): if PY3: return str(set_) else: return str(set_) Does the underscore AFTER the variable mean anything or is this just a part of the variable's name and means nothing? 回答1: No semantics are associated with a trailing underscore. According to PEP 8, the style guide for Python, users are urged to use trailing underscores in order to not conflict with Python keywords and/or Python built-ins: single_trailing