convention

What is build-by-convention in Gradle deep explanation?

…衆ロ難τιáo~ 提交于 2019-12-03 16:27:12
问题 The Gradle User Guide often mentions that Gradle is declarative and uses build-by-convention . What does this mean? From what I understand it means that, for example, in java plugin there are conventions like source must be in src/main/java ,tests must be in src/main/test , resources in src/main/resources , ready jars in build/libs and so on. However, Gradle does not oblige you to use these conventions and you can change them if you want. But with the second concept, I have a bigger problem

Java coding convention about static method

孤人 提交于 2019-12-03 07:14:58
It is a very simple question, but I think it is a little bit controversial. When I code Java classes I use the following order. class Foo { // static fields // instance fields // constructors // methods (non-static and static methods are mixed but sorted based on their functionalities) } I read an article that says: (From http://code.google.com/webtoolkit/makinggwtbetter.html#codestyle ) Java types should have the following member order: Nested Types (mixing inner and static classes is okay) Static Fields Static Initializers Static Methods Instance Fields Instance Initializers Constructors

Naming convention for VB.NET private fields

試著忘記壹切 提交于 2019-12-03 05:43:46
问题 Is there an official convention for naming private fields in VB.NET? For example, if I have a property called 'Foo', I normally call the private field '_Foo'. This seems to be frowned upon in the Offical Guidelines: "Do not use a prefix for field names. For example, do not use g_ or s_ to distinguish static versus non-static fields." In C#, you could call the private field 'foo', the property 'Foo', and refer to the private field as 'this.foo' in the constructor. As VB.NET is case insensitive

What is build-by-convention in Gradle deep explanation?

丶灬走出姿态 提交于 2019-12-03 05:40:52
The Gradle User Guide often mentions that Gradle is declarative and uses build-by-convention . What does this mean? From what I understand it means that, for example, in java plugin there are conventions like source must be in src/main/java ,tests must be in src/main/test , resources in src/main/resources , ready jars in build/libs and so on. However, Gradle does not oblige you to use these conventions and you can change them if you want. But with the second concept, I have a bigger problem with understanding. Like SQL you say what you want to do with your queries but do not say how the

Naming convention for VB.NET private fields

旧街凉风 提交于 2019-12-02 19:03:24
Is there an official convention for naming private fields in VB.NET? For example, if I have a property called 'Foo', I normally call the private field '_Foo'. This seems to be frowned upon in the Offical Guidelines : "Do not use a prefix for field names. For example, do not use g_ or s_ to distinguish static versus non-static fields." In C#, you could call the private field 'foo', the property 'Foo', and refer to the private field as 'this.foo' in the constructor. As VB.NET is case insensitive you can't do this - any suggestions? I still use the _ prefix in VB for private fields, so I'll have

Why single element tuple is interpreted as that element in python?

倾然丶 夕夏残阳落幕 提交于 2019-12-02 01:40:38
Could anyone explain why single element tuple is interpreted as that element in Python? And Why don't they just print the tuple (1,) as (1) ? See the examples below: >>> (1) 1 >>> ((((1)))) 1 >>> print(1,) 1 >>> print((1,)) (1,) A single element tuple is never treated as the contained element. Parentheses are mostly useful for grouping, not for creating tuples; a comma does that. Why don't they just print (1,) as (1)? Probably because printing a builtin container type gives a representation that can be used to recreate the container object via , say eval : The docs for __repr__ provides some

What's the significance of TLD-first domain-like identifiers?

大兔子大兔子 提交于 2019-12-02 01:28:51
问题 "TLD-first domain-like identifiers" is a mouthful but that's all I can come up with. I've seen these used in various places over the years and wondered what the history/reason behind this convention is, since you might be forgiven in thinking that there is one true way to mention a domain. I don't use Java but I recall from poking around that namespaces are often done like this: uk.co.tophats.stitchkit A specification file for a "Launch Agent" on Mac OS X: ws.agile.1PasswordAgent.plist A

What's the significance of TLD-first domain-like identifiers?

空扰寡人 提交于 2019-12-01 22:22:07
"TLD-first domain-like identifiers" is a mouthful but that's all I can come up with. I've seen these used in various places over the years and wondered what the history/reason behind this convention is, since you might be forgiven in thinking that there is one true way to mention a domain. I don't use Java but I recall from poking around that namespaces are often done like this: uk.co.tophats.stitchkit A specification file for a "Launch Agent" on Mac OS X: ws.agile.1PasswordAgent.plist A preferences file on Mac OS X: com.apple.iTunesHelper.plist Why is the TLD first? Is it just hierarchical

Kotlin Data Class packaging [closed]

坚强是说给别人听的谎言 提交于 2019-12-01 17:30:21
Kotlin introduces the wonderful concept of Data Classes. These classes will derive the equals()/hashCode() , toString() , getters()/setters() , and a copy() function based on the properties declared in the constructor: data class KotlinUser(val name: String, val age: Int) In Java, this would look something like: public class JavaUser { public JavaUser(String name, Int age) { ... } //getters //setters //equals()/hashCode() //toString() } My question is about the packaging of these data class files in Kotlin. Coming from Java I would store JavaUser in its own Class file under: org.package.foo

What's the point of String[] args in Java?

帅比萌擦擦* 提交于 2019-12-01 14:17:44
Whenever you declare the main method in a class, you always have to do a String array called "args". What's the point? Unless I live under a rock, command line agruments in Java are barely used anymore. And when I try and run this... //this program won't compile public class SomeClass { public static void main(){ System.out.println("This text will never be displayed :("); } } The output shows this in red text: Error: Main method not found in class SomeClass , please define the main method as: public static void main(String[] args) I, the newbie Java programmer, would greatly appreciate it if