Do Scala libraries follow the same inverted domain convention for naming packages as Java?

I’m looking to write a small Scala library to get a feel for its Actor programming model.

In the example code I’ve come across, some libraries use inverted domain (e.g. for packages and some do not (maybe just for brevity).

Is it advisable for Scala libraries to use the same package naming conventions as Java? More generally, are there any good Scala coding style suggestions like Python has with PEP 8?

Yes, probably putting cart before horse, but I find I can get a decent feel for a language by also seeing some of the conventions that have shaken out.


Best Answer:

Lift, one of the larger projects in Scala, uses the inverted domain name convention, which actually makes a lot of sense, as Scala and Java can interoperate, it stands to reason you’d want to keep things as painless as possible, and I really can’t think of any worthwhile advantages of doing it any other way.

Other Answer 1:

Scala basically inherits most of Java’s conventions (in almost everything). There are a few exceptions to this. For example, Scala “getters and setters” are actually done in the following way:

class Person {
private var _name: String = _

def name = _name

def name_=(s: String) {
_name = s

When in doubt, borrow the convention from Java, Ruby or Haskell (in that order of preference). With regards to packages, the answer is “yes”, Scala packages are named using the inverted domain convention.