louiscad
06/08/2020, 7:07 PMalllowercasepackagenames
from Java? What was the rationale? I'm about to name a package in camelCase because it's much more readable that way, but I'm wondering why I should follow that specific convention.
EDIT: Same question for underscores (_
) in package names.pavi2410
06/08/2020, 7:12 PMlouiscad
06/08/2020, 7:14 PMBen
06/08/2020, 7:16 PMpavi2410
06/08/2020, 7:17 PMlouiscad
06/08/2020, 7:17 PMlouiscad
06/08/2020, 7:19 PMPascalCase.pas
and some directories as well, like Desktop
. So why would there be such a lowercaseonly
convention just for packages?Patrick Lannigan
06/08/2020, 7:24 PMlouiscad
06/08/2020, 7:24 PMPatrick Lannigan
06/08/2020, 7:30 PMPatrick Lannigan
06/08/2020, 7:32 PMlouiscad
06/08/2020, 7:33 PMPatrick Lannigan
06/08/2020, 7:37 PMlouiscad
06/08/2020, 7:39 PMchristophsturm
06/08/2020, 7:42 PMchristophsturm
06/08/2020, 7:42 PMchristophsturm
06/08/2020, 7:45 PM-
should definately be allowedlouiscad
06/08/2020, 7:45 PM-
, maybe you have the quite obvious use case for #C0B9K7EP2?Casey Brooks
06/08/2020, 8:08 PMchristophsturm
06/08/2020, 9:19 PMchristophsturm
06/08/2020, 9:24 PMuser.notification
instead of user-notification
adk
06/09/2020, 6:47 AMadk
06/09/2020, 6:49 AMadk
06/09/2020, 6:49 AMlouiscad
06/09/2020, 7:06 AMuser_notification
and user-notification
are not class name candidates as per naming conventionMatteo Mirk
06/09/2020, 11:28 AMsrc/my-file.kt
having a declaration package foo.bar.baz
.
Package declarations can include underscores or be camel case, I don’t know of any conventions on the matter, but hyphens are not allowed by the compiler.
Also, there is one convention in Kotlin that helps you simplify directory structure (if you want to follow it) that you can start your source tree root eliminating your common package prefix, that is if your packages are like:
x.y.z.model
x.y.z.service
x.y.z.util
...
your source tree should be like:
src/
├ model/
├ service/
└ util/
https://kotlinlang.org/docs/reference/coding-conventions.html#directory-structuregildor
06/17/2020, 3:40 AMA lot of projects (especially small libraries/applications and OSS projects) are not associated with any website, so trying to come up with some meaningful domain doesn’t make senseIt makes a lot of sense for artifact group, it’s the only way to proof that some library belongs to the same domain. It also common practice to use packages like com.github.myproject, it also supported by github pages But should artifact group be the same as package? not necessary, but it’s often quite useful to have consistent name