- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
Ctrie naming
Hi,
is it possible to change the class name of Ctrie to something more in line with the style guide out there?
Having "ConcurrentHashMap" in Java I think "ConcurrentTrie" is a reasonable choice. Imho it is very dangerous to not
follow the standard naming without a very good reason, because it
serves as precedent and excuse for users to ignore naming conventions in
their own code.
Scala Style guide:
Classes should be named in the camelCase style with the very first letter of the name capitalized [...] This mimics the Java naming convention for classes.
http://docs.scala-lang.org/style/naming-conventions.html#classestraits
Java naming conventions:
Class names should be nouns, in mixed case with the first letter of each internal word capitalized. Try to keep your class names simple and descriptive. Use whole words-avoid acronyms and abbreviations (unless the abbreviation is much more widely used than the long form, such as URL or HTML).
http://www.oracle.com/technetwork/java/javase/documentation/codeconventions-135099.html#367
Thanks!
Simon










Re: Ctrie naming
On Thu, Feb 16, 2012 at 7:16 AM, Simon Ochsenreither <simon [dot] ochsenreither [at] googlemail [dot] com> wrote:
You're absolutely right, Ctrie is less than self-explanatory. Maybe it would be defensible if it were in a package called "concurrent" or otherwise explanatory, but it's in scala.collection.mutable.
Re: Ctrie naming
I agree that we should have a self-explanatory name, and I'm open to ideas.
I would however prefer something which is easy relatively short and easy to write.
ConcurrentHashMap seems long to me.
Re: Ctrie naming
On Thu, Feb 16, 2012 at 7:52 AM, Aleksandar Prokopec <aleksandar [dot] prokopec [at] epfl [dot] ch> wrote:
I too am easily annoyed by long names, but I think that's solving the problem at the wrong level. Give it a self-explanatory canonical name, and let's make a package with a standard set of aliases for lovers of terseness. Otherwise this tug of war goes on forever and nobody is ever happy (the same name cannot satisfy both camps, but a hybrid is unlikely to satisfy EITHER camp.)
Re: Ctrie naming
On Thu, Feb 16, 2012 at 14:18, Paul Phillips wrote:
>
>
> On Thu, Feb 16, 2012 at 7:52 AM, Aleksandar Prokopec
> wrote:
>>
>> I agree that we should have a self-explanatory name, and I'm open to
>> ideas.
>> I would however prefer something which is easy relatively short and easy
>> to write.
>>
>> ConcurrentHashMap seems long to me.
>
>
> I too am easily annoyed by long names, but I think that's solving the
> problem at the wrong level. Give it a self-explanatory canonical name, and
> let's make a package with a standard set of aliases for lovers of terseness.
> Otherwise this tug of war goes on forever and nobody is ever happy (the
> same name cannot satisfy both camps, but a hybrid is unlikely to satisfy
> EITHER camp.)
The recently added rewrite of RedBlack does this:
class RedBlack ...
import ....{RedBlack => RB}
And then use RB elsewhere. I have noticed that ScalaDoc doesn't undo
such import renames, but, other than that, would there be any
problems?
Re: Ctrie naming
On Thu, Feb 16, 2012 at 9:56 AM, Daniel Sobral <dcsobral [at] gmail [dot] com> wrote:
This forces you to issue the import in every file where you use it.
You might think, OK, I will define aliases at the package level and all will be well. Then you will run into this, one of my least favorite wontfixes.
https://issues.scala-lang.org/browse/SI-3836
So you think OK, I will define package-private aliases at the package level and all will be well. Then you run into this one:
https://issues.scala-lang.org/browse/SI-3160
So you go back to repeatedly renaming by way of import, a route which guarantees you'll see a nice mix of names for the same thing in any given source base.
Re: Ctrie naming
I would be in favour of this aliases package idea.
Re: Ctrie naming
concurrent.Trie
and those who like brevity can
Trie
?
--Rex
On Thu, Feb 16, 2012 at 11:23 AM, Aleksandar Prokopec <aleksandar [dot] prokopec [at] epfl [dot] ch> wrote:
Re: Ctrie naming
On 2/16/12 5:56 PM, Rex Kerr wrote:
Re: Ctrie naming
concurrent.TrieMap
or with the import, just:
TrieMap
On 2/16/12 6:02 PM, Aleksandar Prokopec wrote:
Re: Ctrie naming
--Rex
On Thu, Feb 16, 2012 at 12:12 PM, Aleksandar Prokopec <aleksandar [dot] prokopec [at] epfl [dot] ch> wrote:
Re: Ctrie naming
Also, if we put them directly in the `mutable` package, the docs might help, but ideally the name should communicate the fact they are concurrent, imo.
On 2/16/12 6:24 PM, Rex Kerr wrote:
Re: Ctrie naming
--Rex
On Thu, Feb 16, 2012 at 12:30 PM, Aleksandar Prokopec <aleksandar [dot] prokopec [at] gmail [dot] com> wrote:
Re: Ctrie naming
ConcurrentTrieMap?
On Feb 16, 2012 6:30 PM, "Aleksandar Prokopec" <aleksandar [dot] prokopec [at] gmail [dot] com> wrote:Re: Ctrie naming
People who want a shorter name can just import it by a name they like, but I think the defaults should be sane and follow the rules.
I'm not sure about creating a whole new package for basically one class...