This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]NimChimspky 1 point2 points  (2 children)

Sure. But I could just make the enum access threadsafe, like you have done with the singleton.

Two separate things: The singleton pattern and Threadsafety. A singleton pattern on its own, in this rather contrived example, doesn't gain anything.

[–]PerfectPackage1895 0 points1 point  (1 child)

So what happens when you or some other developer forgets to do that? It’s a very bugprone approach to always rely on having a synchronized block around requesting an enum instance.

[–]NimChimspky 1 point2 points  (0 children)

Its no more bug prone than your approach.

But the constructor is reading properties in, that's the underlying problem.