Guys is it a good practice to just throw all my da...
# getting-started
t
Guys is it a good practice to just throw all my data classes in a single file?
h
If the conceptually relate to each other, why not! If not grouping them into separate container files may be more readable in the long run.
t
Yeap they are conceptually related. But I was just having doubts about this because of my Java background. I think It is hard to trace those data classes later if they are put together in a single file.
h
I actually enjoy the option to combine types/classes in a single file. Especially for smaller utility it makes code more readable.
t
I could get used to it I guess 😁
n
if you come from a java background you might be used to put all your classes playing the same ā€œroleā€ into the same package controllers, services, entities, etc. i did that too now i’m putting all classes related to a feature inside the same package so i can eventually expand this package into a dedicated jar same with data classes...
t
@nfrankel Regarding the second approach in kotlin's case sometimes you won't even have to make a package since most of the feature-related data classes could be defined in the same file. Or would you just make the package and put that one file in?
n
my point was not about package vs file but about feature grouping vs layer grouping
t
I see. thanks for the tip.
šŸ‘ 1