Scalatra file organisation

57 views Asked by At

How should I manage my files in Scalatra . After encountering the following error my fundamental understanding of "code separation" in Scala has been destroyed .

Working in Scalatra I defined an class in one file and received an in an error after attempting to define a class with the same name in another file . I was somewhat confused about the error because I was working under the impression that there was some degree of isolation afforded to each file ( Node JS inspired assumption).

I cam currently working on an application that requires : Actors, Routes, Classes, etc . How should I organize these things ?

1

There are 1 answers

0
Rex Kerr On BEST ANSWER

Classes of the same name need to be in different packages. You can use imports to avoid having to type the full path (packagename.ClassName), but if you don't create separate packages there is no way to unambiguously refer to the class you mean. That quickly grows unworkable in code bases of more than moderate size.

So, no, separate files are not enough.