naming-conventions

.htm or .html extension - which one is correct and what is different?

帅比萌擦擦* 提交于 2019-12-02 18:41:33
When I save a file with an .htm or .html extension, which one is correct and what is different? Neither is wrong, it's a matter of preference. Traditionally, MS software uses htm by default, and *nix prefers html . As oded pointed out below, the .htm tradition was carried over from win 3.xx, where file extensions were limited to three characters. Mainly, the number of characters is different. ".htm" smells of Microsoft operating systems where the file system historically limited file name extensions (the part of the file name after the dot) to 3 characters. ".html" smells of Un*x operating

Naming of enums in Java: Singular or Plural?

陌路散爱 提交于 2019-12-02 18:17:41
Is there an "official" recommendation of how to name Java enums? enum Protocol { HTTP, HTTPS, FTP } or enum Protocols { HTTP, HTTPS, FTP } I know in the .Net world the recommendation is to use singular except for enums that represent bit flags. Just curious if there is something similar in Java. A related question that seems to be .Net specific: Singular or plural for enumerations? Enums in Java (and probably enums in general) should be singular. The thinking is that you're not selecting multiple Protocols, but rather one Protocol of the possible choices in the list of values. Note the absence

C library naming conventions

别来无恙 提交于 2019-12-02 18:11:48
Introduction Hello folks, I recently learned to program in C! (This was a huge step for me, since C++ was the first language, I had contact with and scared me off for nearly 10 years.) Coming from a mostly OO background (Java + C#), this was a very nice paradigm shift. I love C. It's such a beautiful language. What surprised me the most, is the high grade of modularity and code reusability C supports - of course it's not as high as in a OO-language, but still far beyond my expectations for an imperative language. Question How do I prevent naming conflicts between the client code and my C

Naming convention for a C# Dictionary

我们两清 提交于 2019-12-02 17:50:35
How do we name a dictionary variable? Say in my method I have Dictionary<string, List<string>> dictionary; , where the keys of the dictionary are country names and the values are lists of province/state names. How should I rename dictionary ? I know we can create a Country class for this example. But please don't mention this alternative because I'm thinking of good naming convention here. ProvincesByCountry I use mostly one of these: CountryToStatesDictionary CountryToStatesMap CountryToStatesMapping I like XtoYMap or YFromX . Naming is always contextual. So in this specific case some name

Java Interface Naming Conventions [closed]

◇◆丶佛笑我妖孽 提交于 2019-12-02 17:34:34
I work on a Java web-app that uses Spring for dependency injection and JMock for mocking out these dependencies in our unit tests. Currently our team is at a point were we have a few different opinions in terms of how to name certain interfaces that we use. We have no issue with naming the interfaces in our domain that have multiple implementations, that is simple. However, when it comes to interfaces for which we only have one implementation and intend on only having one implementation in the future, we have hit a snag. The reason that we have such interfaces is purely for mocking, for

.NET naming convention for “ID” (anything identification: Capitalization)

久未见 提交于 2019-12-02 17:05:54
I am in the process of unifying these inconsistent naming conventions and this one problem has been a bit driving me crazy lately. In the code base I am working with has no convention regarding "ID"; "ID", "Id" and even "iD" are used inconsistently. ****Question**: In .NET, how do you guys capitalize "ID"? For an example, nodeID, nodeId? FolderID or FolderId? ****Edit**: How about plural cases? then should I do "NodeIDs" or "NodeIds"? Thanks Capitalization is for 2 letters acronyms . UI, IP, etc. "Id" is an abbreviation for Identifier, so it should stay pascal cased. Microsoft's naming

Does functional programming mandate new naming conventions?

时光毁灭记忆、已成空白 提交于 2019-12-02 17:05:18
I recently started studying functional programming using Haskell and came upon this article on the official Haskell wiki: How to read Haskell . The article claims that short variable names such as x , xs , and f are fitting for Haskell code, because of conciseness and abstraction. In essence, it claims that functional programming is such a distinct paradigm that the naming conventions from other paradigms don't apply. What are your thoughts on this? Ionuț G. Stan In a functional programming paradigm, people usually construct abstractions not only top-down , but also bottom-up . That means you

Storyboard Segue Identifier naming conventions

泪湿孤枕 提交于 2019-12-02 17:00:28
I'm building a large storyboard and I was wondering if anyone has come up with helpful naming conventions for segue identifiers . It looks like Apple just uses 'ShowX' in their examples where X is the name of the view it is showing. So far I prefer to use 'PushX' or 'ModalX' to keep track of which type of transition it is. Anyone have any other tricks or tips? There is no correct answer for this question. It depends on taste. I mitigate for readability. Don't be shy to give a long name for your segue identifier; give long and expressive names because Objective-C is a very verbose language

Maven naming conventions for hierarchical multiple module projects

余生长醉 提交于 2019-12-02 16:37:38
I've got a question on Maven naming conventions (groupId, artifactId and directory names) in a multiple module project with a hierarchical directory structrure. Research Before asking, I went through other the web on this topic and what I cleared out for myself: Possible duplication for my question, but it does not cover multiple-hierarchy levels. Project directory name should match artificatId . Guide to Naming Conventions provide examples: groupId will identify your project uniquely across all projects, so we need to enforce a naming schema. It has to follow the package name rules (eg. org

Which way to name a function in Go, CamelCase or Semi-CamelCase?

匆匆过客 提交于 2019-12-02 16:31:22
I want to write a function in Go to insert a document into a collection in a MongoDB database. Which way to name the function is better, writeToMongoDB or WriteToMongoD ? The second is CamelCase, while I saw someone using the style of the first one, so I am not sure which one is more appropriate. Thanks. Syntax In Go this is not a matter of style, it is a matter of syntax. Exported names (that is, identifiers that can be used from a package other than the one where they are defined) begin with a capital letter. Thus if your method is part of your public API, it should be written: WriteToDB but