naming-conventions

How do I name an interface when the base word starts with an I?

不羁的心 提交于 2019-12-21 07:05:47
问题 I want to create an interface for "Items". Typicaly I would name an interface by adding and "I" prefix to a base word. But in this case my base word already starts with an I. Here are a couple ideas I've had IItem : Two I's Iitem : Vary the case ItemInterface : Skip the I prefix and write out Interface What looks the best? Has anyone else run into this problem. If so what did you do? 回答1: Although hard to read, IItem would be in line with some existing " II " interfaces: IItem in Windows

Should methods in an API that return Task end with Task or Async

≯℡__Kan透↙ 提交于 2019-12-21 04:25:27
问题 If an API has a synchronous method T DoSomething<T>(); , what is the naming convention for the corresponding asynchronous method if it returns Task<T> ? Task<T> DoSomethingTask<T>(); or Task<T> DoSomethingAsync<T>(); or something else? 回答1: From what I've seen in C# 5 / .NET 4.5, the preferred name is DoSomethingTaskAsync or DoSomethingAsync For example, the WebClient class in .NET 4.5 has methods like DownloadFileTaskAsync , because it already had a method named DownloadFileAsync , so I

What is that thing between CSS “selectors” called?

怎甘沉沦 提交于 2019-12-21 03:54:17
问题 What do you call these : body > p + p in a CSS selector? Are they: Relational operators Position-based criteria Something else? I just have no idea what to call them. Is there an official name? (And, also, are there official names for a b c in a b c, d e f and a in a b c ?) 回答1: According to http://www.w3.org/TR/CSS2/selector.html#selector-syntax they are called "combinators". Thanks to Duncan Babbage for pointing out there are (or were) only three of them: space character = descendant > =

Why do I see JavaScript variables prefixed with $?

不想你离开。 提交于 2019-12-21 03:36:23
问题 This is sort of a meta-question. Many snippets of JavaScript I've seen here on SO are named with a dollar sign prefix (for example, $id on the second line of the snippet shown in this question). I'm not referring to jQuery or other libraries. I am well aware that this is valid, but it seems awkward to do when not necessary. Why do people name their variables like this? Is it just familiarity with a server-side language like PHP carrying over into their JavaScript code? I thought perhaps it

Naming convention for Visual Studio solutions and projects

為{幸葍}努か 提交于 2019-12-21 03:09:13
问题 We were thinking about organizing our BIG project this way: \trunk [CompanyName] [Product1] [Project1] CompanyName.Product1.Project1.csproj [Project2] CompanyName.Product1.Project2.csproj CompanyName.Product1.sln [Product2] We were trying to follow Microsoft's recommendation that namespace names follow folder structure, but are there any drawbacks for making it this way? What is the naming convention for solutions and projects that you apply? 回答1: That looks pretty good if you ask me.

To foo bar, or not to foo bar: that is the question

大城市里の小女人 提交于 2019-12-20 16:22:54
问题 This was something originally discussed during a presentation given by Charles Brian Quinn of the Big Nerd Ranch at acts_as_conference. He was discussing what he had learned from instructing a Ruby on Rails Bootcamp to many people both new to programming and new to Rails. One particular slide that stood out was along the lines of never using foo and bar as examples when trying to teach someone to program . His reasoning was very simple. Which is easier to understand? baz = foo + bar or answer

Lambda variable names - to short name, or not to short name? [closed]

被刻印的时光 ゝ 提交于 2019-12-20 11:06:16
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 3 years ago . Typically, when I use lambdas, I just use "a, b, c, d..." as variable names as the types are easily inferred, and I find short names to be easier to read. Here is an example: var someEnumerable = GetSomeEnumerable(); var somethingElseList = someEnumerable.Select(a => a

Lambda variable names - to short name, or not to short name? [closed]

别等时光非礼了梦想. 提交于 2019-12-20 11:06:03
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 3 years ago . Typically, when I use lambdas, I just use "a, b, c, d..." as variable names as the types are easily inferred, and I find short names to be easier to read. Here is an example: var someEnumerable = GetSomeEnumerable(); var somethingElseList = someEnumerable.Select(a => a

What is the naming convention for Python class references

廉价感情. 提交于 2019-12-20 10:19:38
问题 What is the naming convention for a variable referencing a class in Python? class MyClass(object): pass # which one is correct? reference_to_class = MyClass # or ReferenceToClass = MyClass Here is another example that resembles my situation: # cars.py class Car(object): pass class Sedan(Car): pass class Coupe(Car): pass class StatonWagon(Car): pass class Van(Car): pass def get_car_class(slug, config): return config.get(slug) # config.py CONFIG = { 'ford-mustang': Coupe, 'buick-riviera': Coupe

Naming conventions for “number of foos” variables [closed]

ⅰ亾dé卋堺 提交于 2019-12-20 09:46:07
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 2 years ago . Let's suppose that I need to store the number of foo objects in a variable. Not being a native English speaker, I always wonder what's the best (= short and immediately clear) name for that var. foo_num ? num_foo ? no_foo ? foo_no ? or something else? The full name should be