naming-conventions

What is the convention for word separator in Java package names?

感情迁移 提交于 2019-12-17 03:21:54
问题 How should one separate words in package names? Which of the following are correct? com.stackoverflow.my_package (underscore) com.stackoverflow.my-package (hyphens) com.stackoverflow.MyPackage (CamelCase) What is the general standard? 回答1: Here's what the official naming conventions document prescribes: Packages The prefix of a unique package name is always written in all-lowercase ASCII letters and should be one of the top-level domain names, currently com , edu , gov , mil , net , org , or

Singular or plural controller and helper names in Rails

大憨熊 提交于 2019-12-17 02:59:47
问题 Is there any disadvantage to using singular names for controllers and helpers? Nothing seems to rely on this. It even seems helpers don't have to make the same choice about singular vs. plural as their corresponding controllers, at least according to my limited experimentation. Is that true? 回答1: Definitely plural . With restful routing and a singular controller Controller: dog_controller.rb Routes: map.resources :dogs # => blows up map.resources :dog # is ok, but... dogs_path # => blows up

Singular or plural controller and helper names in Rails

丶灬走出姿态 提交于 2019-12-17 02:59:16
问题 Is there any disadvantage to using singular names for controllers and helpers? Nothing seems to rely on this. It even seems helpers don't have to make the same choice about singular vs. plural as their corresponding controllers, at least according to my limited experimentation. Is that true? 回答1: Definitely plural . With restful routing and a singular controller Controller: dog_controller.rb Routes: map.resources :dogs # => blows up map.resources :dog # is ok, but... dogs_path # => blows up

Generic type parameter naming convention for Java (with multiple chars)?

橙三吉。 提交于 2019-12-17 02:55:29
问题 In some interfaces I wrote I'd like to name generic type parameters with more than one character to make the code more readable. Something like.... Map<Key,Value> Instead of this... Map<K,V> But when it comes to methods, the type-parameters look like java-classes which is also confusing. public void put(Key key, Value value) This seems like Key and Value are classes. I found or thought of some notations, but nothing like a convention from Sun or a general best-practice. Alternatives I guessed

What characters are allowed in C# class name?

淺唱寂寞╮ 提交于 2019-12-17 02:33:08
问题 What characters are allowed and what is not allowed in a C# class name? Could you please help? EDIT: To specify. What special characters are allowed? Please be specific, because links to 50 pages specs in high-technical language is not an answer that will help me a lot. EXPLANATION: What I try to accomplish is to divide class name into distinguishable parts for example: class Person@WorkOffice@Helper@Class { } And I think about a way of using some kind of character or something else to be

Naming convention for context-manager classes (“with” blocks)

荒凉一梦 提交于 2019-12-14 04:17:25
问题 Is there a general naming convention for classes or functions that are meant to be used in with block such as with CreateSomeContext() as x: ... ? Something that signals that the class or the result of a function should be used with with ? 回答1: There's no naming convention ( open , socket.create_connection , urllib.request.urlopen all return context managers which can be used with with ) but context managers will have the __enter__ and __exit__ methods. Note : in the case of open("file", "w")

ReSharper C# naming style for private methods and properties

橙三吉。 提交于 2019-12-14 03:39:57
问题 I like to make the first letter of private methods, properties and events lowercase and the first letter of public methods, properties and events uppercase. However, in ReSharper 7.1 there is only one option under C# naming style that applies all methods, properties and events. What is the best way to tell ReSharper to use a different convention for private only? 回答1: You can create your own Naming Style Rule. Resharper Options => Code Editing => [Language] => Naming Style => Advanced Options

Does naming an instance variable with underscore as a prefix have any side effects in Cocoa (Objective-C)? [duplicate]

我是研究僧i 提交于 2019-12-13 21:16:18
问题 This question already has answers here : Closed 8 years ago . Possible Duplicate: How does an underscore in front of a variable in a cocoa objective-c class work? I found that in Apple's frameworks' header files , Apple name instance variable with prefix underscope inside a class interface. like the _delegate instance below: @interface ClassName : NSObject { id _delegate; } @end But is there any side effects if we follow this naming convention when defining our own instance variable? I've

What is the capitalization standard for class names in the Python Standard Library?

早过忘川 提交于 2019-12-13 17:08:48
问题 The norm for Python standard library classes seems to be that class names are lowercase - this appears to hold true for built-ins such as str and int as well as for most classes that are part of standard library modules that must be imported such as datetime.date or datetime.datetime . But, certain standard library classes such as enum.Enum and decimal.Decimal are capitalized. At first glance, it might seem that classes are capitalized when their name is equal to the module name, but that

SQL Table / Sub-Query Alias Conventions

风格不统一 提交于 2019-12-13 16:18:24
问题 I've been writing SQL for a number of years now on various DBMS (Oracle, SQL Server, MySQL, Access etc.) and one thing that has always struck me is the seemingly lack of naming convention when it comes to table & sub-query aliases. I've always read that table alises are the way to go and although I haven't always used them, when I do I'm always stuck between what names to use. I've gone from using descriptive names to single characters such as 't', 's' or 'q' and back again. Take for example