anyone got some good info about why kotlin went wi...
# getting-started
c
anyone got some good info about why kotlin went with its companion object concept over just having static?
m
static was java’s way of connecting something to the class rather than an instance of the class. IMO, it’s harder to manage and read as a static can appear anywhere in a class. It was also added to provide utility functions/builders etc on a class. With kotlin, forcing all methods of that type into one place makes it much easier to find all the class methods/properties as they can only be in one place. And with top-level functions and extension functions, I very rarely have any use for a companion object anyway. It seems like it’s mostly brought up by people new to the language that have not absorbed some of the other approaches and strengths of the language and therefore they want their ‘comfortable’ static. But as always, this is just one person’s opinion/interpretation/experience.