naming-conventions

The meaning of ' in Haskell function name?

拜拜、爱过 提交于 2019-11-30 18:42:30
What is quote ' used for? I have read about curried functions and read two ways of defining the add function - curried and uncurried. The curried version... myadd' :: Int -> Int -> Int myadd' x y = x + y ...but it works equally well without the quote. So what is the point of the ' ? The quote means nothing to Haskell. It is just part of the name of that function. People tend to use this for "internal" functions. If you have a function that sums a list by using an accumulator argument, your sum function will take two args. This is ugly, so you make a sum' function of two args, and a sum

Naming convention for objects in java

自闭症网瘾萝莉.ら 提交于 2019-11-30 18:21:00
I had started programming in java 2 years back. Seniors in our project at that time had advised me to append 'obj' to the name of the object which is being created. Ex: Car objCar = new Car("Ferrari"); Here objCar is what am talking about. But many at Stack overflow had opposed it and now I find that this shouldn't be the way naming of an object should be done. Am clear with naming conventions when collections are used but am confused when objects of general classes are created. Can anyone shed some light on it ? Just call it car . Hungarian notation is not used by Sun/Oracle. Name your

How to deal with duplicated function name within C?

*爱你&永不变心* 提交于 2019-11-30 17:45:40
I have a little project in which I named two same name function in two different source file, but while I building the project, the compiler failed with 'func_name already defined in filename.obj'. Why could not I have two functions with the same name in two different source files? I thought the function should be local to the source file only if when we declared it in the header file will it become global. And except for changing the filename, are there any other elegant solution to duplicated function name in the C programming language? In C, a function has global scope by default. To

Meaning of _ underscore as a variable prefix in VB.net

孤街醉人 提交于 2019-11-30 17:42:46
What is the meaning of underscore in visual basic? I have this code: Private _isAuthenticated As Boolean Is that the same as doing this? Private isAuthenticated As Boolean Or does adding the underscore to the front of the name do something special? 勿绮语 It's a convention. A leading _ often indicates that the variable is private to the class. This convention is commonly used in many different languages, not just VB. In a similar sense, it also indicates that the variable is the local variable behind a property. However it has no significant meaning to the compiler. FYI: if you are looking at VB

Naming convention for class properties in TypeScript

主宰稳场 提交于 2019-11-30 17:26:35
According to the offical style guide you should Avoid prefixing private properties and methods with an underscore. As I come from a Java background, I usually would just use the this keyword: export default class Device { private id: string; constructor(id: string) { this.id = id; } public get id(): string { // [ts] Duplicate identifier 'id'. return this.id; } public set id(value: string) { // [ts] Duplicate identifier 'id'. this.id = value; } } But the TypeScript compiler complains: [ts] Duplicate identifier 'id'. Is there a convention or best practice for parameter naming in a TypeScript

Ruby - Naming Convention - letter case for acronyms in class/module names?

纵然是瞬间 提交于 2019-11-30 16:34:35
问题 I need to create a class that represent "SVN" inside a module called "SCM". But I don't know what is the convention when dealing with acronyms in Ruby, and could not find anything relevant in Google, except "Camel case is preferred". Should I call it SCM::SVN or Scm::Svn ? Is there a convention for this? 回答1: SCM::SVN looks best to me. Rails is full of classes like ERB, ORM and OMFGIMATEAPOT. And that's not to mention things like JSONSerializer. Ruby's source has a bunch of acronyms, too. The

toString(): for debugging or for humans?

為{幸葍}努か 提交于 2019-11-30 15:32:53
问题 class Address { private enum Component { NUMBER, STREET, STATE, COUNTRY } private Map<Component, String> componentToValue = ...; } I'd like my class to contain two methods: One to indicate the value of each address component (so I can debug if anything goes wrong). One to return the address in a form expected by humans: "1600 Amphitheatre Parkway Mountain View, CA 94043". What is the best-practice for Object.toString()? Is it primary meant for #1 or #2? Is there a best-practice for the naming

Why is System.arraycopy not camelCased?

纵然是瞬间 提交于 2019-11-30 14:39:02
问题 Java's standard libraries seem to use camelCase for method names. Native functions like nanoTime() are no exceptions. If so, why is System.arraycopy not camelCased? Is there something special about System.arraycopy ? 回答1: It's been in Java for before v1.0 was released - so my guess is that it predates the naming conventions, and it was missed in a sweep of the API when the naming conventions were decided. (In other news, NullPointerException should be called NullReferenceException .) 来源:

Why do Apache Commons libraries have inconsistent groupIds, depending on the project?

别等时光非礼了梦想. 提交于 2019-11-30 14:14:08
问题 Apache Commons is a set of many various libraries. On Maven Central Repository they have two different naming conventions for groupIds, depending on the project, e.g. for Commons Lang, Commons Compress, Commons Weaver - 'org.apache.commons' for Commons CLI, Commons IO - 'commons-[library_name]' What is the difference between them? 回答1: The commons-[library_name] naming convention is the older, legacy convention. The org.apache.commons -style names follow the current operating convention of

How to use two class with the same name in different packages? [duplicate]

对着背影说爱祢 提交于 2019-11-30 13:56:34
问题 This question already has answers here : Importing two classes with same name. How to handle? (11 answers) Closed 4 years ago . How can I access two classes with the same name in different packages? foo.bar.myClass.class and foo.myClass.class All of this in the same class @TestRunner(Suite.class) @SuiteTest({bar.myClass.class, myClass.class}) Thank you. 回答1: you will have to import one and other you will be writting fully qualified path for example in your code: import foo.bar.myClass; . . .