miqbaldc
04/12/2022, 4:49 AMsealed class/interface
over top-level or nested inside declaration?
1️⃣
sealed interface StoragePermissionsFileType {
object Image : StoragePermissionsFileType
object Video : StoragePermissionsFileType
object Audio : StoragePermissionsFileType
object Document : StoragePermissionsFileType
}
2️⃣
sealed interface StoragePermissionsFileType
object Image : StoragePermissionsFileType
object Video : StoragePermissionsFileType
object Audio : StoragePermissionsFileType
object Document : StoragePermissionsFileType
gildor
04/12/2022, 7:30 AMGeorge
04/15/2022, 10:25 AMLeoColman
04/15/2022, 4:07 PMLeoColman
04/15/2022, 4:08 PMLeoColman
04/15/2022, 4:08 PMgildor
04/16/2022, 2:06 AMas they’ll introduce less spaces and bracketsI think most prefer option 1 not because of spaces and brackets, but because of naming, So when you see/write in your code StoragePermissionsFileType.Image it clearly explains what it does, it’s storage permission for images. But if you just see Image it’s unclear what does it mean. There are valid use cases when you actually don’t want to have internal class because of naming reasons
between sealed class/interfaceBut both of those cases are sealed interfaces
George
04/16/2022, 8:51 AMmiqbaldc
04/16/2022, 10:04 AMI think I like the second option more, as they’ll introduce less spaces and brackets➕ In the other hands, I do consider about moving this class or renaming. When doing the nested ones option 1️⃣, changes affecting the whole caller-side, otherwise not for option 2️⃣
Mark
05/02/2022, 1:31 AMclass StoragePermissionsFileType.Image
gildor
05/02/2022, 1:56 AMStoragePermissionsFileTypeImage
diego-gomez-olvera
05/11/2022, 10:16 AMenum
could also work