#To not interrupt main chat

1 messages · Page 1 of 1 (latest)

dry surge
#

say I have a class which handles some stuff (mostly being a container, but also handles the use of this data), now, would it be fine to keep track of a specific instance of this class as static (the instance is not constant, its defined based on settings), I've seen people scream "STATIC ABUSE" for less than this so yk

azure stone
#

Is this specific class a singleton?

dry surge
#

not really

#

I have say 10 instances (varies based on conf), i want to keep track of one specific instance that was set as "default" you could say, would it be right to do it in a provider/manager or in the class itself?

azure stone
#

Hmm I guess

dry surge
#

yeah putting it in my provider

azure stone
#

Like

#

It might be fine to have it static assuming it’s a top level api object

dry surge
#

well you get it by passing from another class

#

so like

#

MyClassProvider#get -> MyClass

azure stone
#

Yeah fair enough

#

Can become tricky to maintain in the long run

#

But go for it

azure niche
dry surge
#

the provider*

#

wops

azure niche
#

Default value? Acceptable, if it is immutable

dry surge
#

not immutable

#

I kinda don't have other place to put it