Scala libraries follow the same upside down domain convention for naming packages as Java?

I want to write a small Scala library to get an idea of ​​my Actor programming model.

In the code sample that I met, some libraries use an inverted domain (e.g. org.foo.bar) for packages, and some don't (maybe just for short).

Is it advisable to use Scala libraries to use the same package naming conventions as Java? In general, are there any good Scala coding style options like Python with PEP 8 ?

Yes, perhaps by putting a cart before the horse, but I find that I can get a decent feel for the tongue, also seeing some of the conventions that were shaking out.

thanks

+6
coding-style scala naming-conventions packages
source share
2 answers

Lift , one of Scala’s big projects, uses an inverted domain name convention that actually makes a lot of sense, since Scala and Java can interact with each other, it’s reasonable that you want things to be as painless as possible. and I really can't come up with any beneficial benefits for this in any other way.

+8
source share

Scala basically inherits most Java conventions (in almost all cases). There are a few exceptions to this. For example, Scala "getters and setters" are actually executed as follows:

class Person { private var _name: String = _ def name = _name def name_=(s: String) { _name = s } } 

If in doubt, borrow an agreement with Java, Ruby, or Haskell (in that order of preference). As for packages, the answer is yes, Scala packages are named using an inverted domain agreement.

+2
source share

All Articles