naming-conventions

Is there a Clojure convention for naming private functions?

末鹿安然 提交于 2019-12-03 15:39:46
问题 When I define a private function in Clojure, I usually use a - prefix as a visual indicator that the function cannot be used outside of my namespace, e.g. (defn- -name [] (let [formatter (formatter "yyyy-MM-dd-HH-mm-ss-SSSS")] (format "fixjure-%s" (unparse formatter (now))))) But the - prefix seems to also be a convention for public methods when using gen-class . Is there any generally accepted convention for defn- 'd functions in the Clojure community, or should I simply use non-prefixed

Why is the root package in source code called “com”? [duplicate]

孤街醉人 提交于 2019-12-03 15:11:55
问题 This question already has answers here : Java packages com and org (4 answers) Closed 3 years ago . In most source codes, the root package/folder is named "com". Why is that so? It it just convention or does it stand for something? 回答1: The convention is that a programmer in a given organization will start package names with their organization's domain name, as a unique identifier -- in reverse order. This prevents namespace clashes between code from different organizations (within the

Why should the first letter of a Java class be upper-cased? [closed]

不想你离开。 提交于 2019-12-03 14:40:20
问题 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 7 years ago . Why should the first letter of a Java class be upper-cased? Is it not possible to run a program containing lower-cased class names? If

When is a function name too long?

家住魔仙堡 提交于 2019-12-03 14:35:41
问题 I try to be rather descriptive with my function names, where possible. This occasionally results in function names in the twenty to thirty character range such as "GetActionFromTypeName" or "GetSelectedActionType". At what point do functions get too long to manage (not too long for the compiler)? 回答1: If there's a shorter, but yet descriptive way to name the function, then the function name is too long. 回答2: When you can't read them aloud anymore without taking a breath in the middle =D 回答3:

Why is the hyphen conventional in symbol names in LISP?

别说谁变了你拦得住时间么 提交于 2019-12-03 14:01:47
What's the reason of this recommendation? Why not keeping consistent with other programming languages which use underscore instead? I think that LISP uses the hyphen for two reasons: "history" and "because you can". History LISP is an old language, and in the early days typing an underscore could be challenging. For example, the first terminal I used for LISP was an ASR-33 teletype . On some hosts and teletype models, the key sequence for the underscore character would be interpreted as a left-pointing arrow (the assignment operator in Smalltalk). Hyphens could be typed more reliably. Because

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

﹥>﹥吖頭↗ 提交于 2019-12-03 13:27:16
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? 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 assume the use of TaskAsync over Async is to maintain backwards compatibility. If you are talking about an async

REST URL naming convention /items/{id} vs /items?id={id}

泪湿孤枕 提交于 2019-12-03 12:52:41
I understand that in MVC pattern and in REST services it is common to use URIs like /items/{id} but what is bad thing about using query parameters in the URI? GET /items/{id} vs GET /items?id={id} Further, lets say an entity has 'referenceId' field that points to some related (say parent) entity, and I need to create REST service to get all items for parent entity, which way is better: GET(POST) /items/parent/{parentId} or GET(POST) /items?parent={parentId} Will be grateful for insights that would help to resolve my subjective issues on constructing URLs for REST services. I would use the

Does * in (<*>) have a special meaning?

家住魔仙堡 提交于 2019-12-03 12:13:39
问题 Trying to expand my understanding about symbols in Haskell : ($) : Function Application operator (Allow you to apply arguments over a function) (&) : flipped version of Function Application Operator? (&) = flip ($) (<>) : associative operator (You'll find it in Semigroups and Monoids) (<$>) : function application ($) lifted over a Functor structure (<&>) : flipped functor map Can we make a link between (*) and (<*>) ? I don't understand the meaning of * actually... 回答1: This is deliberate. <*

For what reason do we have the lower_case_with_underscores naming convention? [closed]

社会主义新天地 提交于 2019-12-03 12:04:40
问题 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 5 years ago . Depending on your interpretation this may or may not be a rhetorical question, but it really baffles me. What sense does this convention make? I understand naming conventions don't necessarily have to have a rhyme or reason behind them, but why deviate from the already

Naming conventions for Code First migrations

有些话、适合烂在心里 提交于 2019-12-03 12:02:48
We are using code first migrations to keep our database and model in sync. At the moment we have the version number as name for the migration which clearly doesn't work out. The problem is that multiple migrations with the same name where created by different developers independent of each other for their local database. This led to some weird behavior as the IMigrationMetadata.Id was different because of the time stamp but the classes are partial with the same name. What is the way to go to call these migrations? The examples are always ridiculously oversimplified: e.g. adding a property