Skip to main content
20 events
when toggle format what by license comment
Nov 8, 2017 at 7:09 history tweeted twitter.com/StackSoftEng/status/928157578634448897
Nov 2, 2017 at 15:56 comment added mortalapeman @Jesper It's not a singleton if it's stateless. That defeats the entire purpose of a singleton. Unless your program is just one giant function that takes no user input while it's running, you need state. In OO land, singleton services work quite well to manage state.
Nov 2, 2017 at 15:49 answer added mortalapeman timeline score: 1
Nov 2, 2017 at 15:13 comment added Jesper "As we all know, singletons are evil and should never be used." - I'd disagree with that. Singletons can be and often are bad, but they have their uses. They should be stateless, though.
Nov 1, 2017 at 22:37 comment added Stop harming Monica @JacobBrown "This is where I want to use that data that was stored earlier" I guess it should be available trhoughClassC.state?
Nov 1, 2017 at 21:54 history edited candied_orange CC BY-SA 3.0
We hates horizontal scroll. We hates it. Nasty evil scroll.
Nov 1, 2017 at 21:22 history edited Jacob Brown CC BY-SA 3.0
added 1263 characters in body
Nov 1, 2017 at 20:39 comment added Stop harming Monica @JacobBrown Then what does "that part of the stack no longer exists and maybe there are no references to the object of ClassA" mean? Either the object does not exist or there is a memory leak.
Nov 1, 2017 at 20:25 comment added Jacob Brown I think I'm going to have to add a source code example to this question. I didn't want to at first because the problem is not specific to any programming language. Maybe I'll give a few examples in different languages.
Nov 1, 2017 at 20:24 comment added Jacob Brown @JimmyJames, yes you are right, I mean storing the data in objects that are instances of classes. I'll have to update my question.
Nov 1, 2017 at 20:22 comment added Jacob Brown @Goyo, no, I do want the object to exist. I just don't know a way of passing the object from one place to another.
Nov 1, 2017 at 17:19 history edited MetaFight CC BY-SA 3.0
Removed some potential snark, and clarified the issue is with IoC *Containers* rather than DI
Nov 1, 2017 at 16:44 comment added JimmyJames I think in 1. you mean you are using an instance of ClassA and you want to store state in that instance. If you are storing state in the class, well don't do that but you should be able to reference ClassA whenever.
Nov 1, 2017 at 16:23 answer added Thomas Junk timeline score: 1
Nov 1, 2017 at 15:54 comment added Stop harming Monica So you want to access the state of an object that does not exist any more? I do not think you can do that.
Nov 1, 2017 at 15:28 answer added Jon Raynor timeline score: 1
Nov 1, 2017 at 15:25 review Close votes
Nov 8, 2017 at 3:02
Nov 1, 2017 at 14:51 answer added candied_orange timeline score: 6
Nov 1, 2017 at 14:13 review First posts
Nov 1, 2017 at 14:21
Nov 1, 2017 at 14:13 history asked Jacob Brown CC BY-SA 3.0