Incerteza
Incerteza

Reputation: 34884

Naming convention for packages and projects

There was a discussion about that here in SO but I still have a question about that topic, though. So, a simple question: what is a naming convention for projects in Scala? Is it "my_new_project", "myNewProject", "my-new-project", "MyNewProject" or "mynewproject"? And the same question for packages.

Upvotes: 5

Views: 9878

Answers (3)

bradylange
bradylange

Reputation: 384

For projects, I have seen many people use my-new-project or MyNewProject frequently. I personally prefer MyNewProject. I have researched your question a lot and haven't found any set conventions for project names. I do believe on GitHub a lot of repositories use my-new-project and almost appears like it's their own convention for repository names.

For packages, the convention is to either use a company domain address or personal domain address with all lowercase letters in reverse order style: com.company.packagename.

Hope that helps!

Brady

Upvotes: 1

Vincenzo Maggio
Vincenzo Maggio

Reputation: 3869

I don't know if there is a specific naming convention for projects in Scala, but usually the Java convention is used, so: - thisIsAVariable (all but first word initial letter uppercase aka camelCase) - ThisIsAClass (all initial letters uppercase aka PascalCase) - com.example.www (reversed url for packages)

I've seen both camelCase and PascalCase for naming projects in Java, but I prefer PascalCase!

Upvotes: 3

0__
0__

Reputation: 67280

Packages follow com.mycompany.myproject reversed-URL style. There is no naming convention for project names. Many people prefer all lower case with hyphenation like scala-foo. I prefer capitalised camel-case like ScalaFoo. It's a matter of taste. I have not seen scalaFoo as a project name convention, also underscore is not used (I think that's C or Python style?)


Like in the earlier days of Java, where almost every project begins with a J, there are a lot of projects beginning with scala. While I think this makes sense for porting existing libraries, I came to think that you should probably not call your project ScalaFoo or ScFoo but just Foo unless there is a specific reason to highlight the fact it's written in Scala.


You may take a look at the community libraries wiki to sense the taste for project names.

Upvotes: 7

Related Questions