Answer by JacquesB for Is utilizing a singleton for a cache an antipattern?
A singleton can mean two things:An object where only a single instance existA particular pattern (from the infamous Design Patterns book) for accessing singletons through a static method on...
View ArticleAnswer by mtj for Is utilizing a singleton for a cache an antipattern?
The singleton pattern, as described in the gang of four book, as it is mostly implemented in Java, can indeed be considered an antipattern. This includes static accessors, enum singletons, and so on,...
View ArticleAnswer by user442504 for Is utilizing a singleton for a cache an antipattern?
I'm curious as to possible alternatives?There are none.singletons are an anti-patternThat implies that connecting to a database through a JDBC driver is anti-pattern.Without being concerned about...
View ArticleIs utilizing a singleton for a cache an antipattern?
I'm currently writing an MVC application and I need a class that can:A: get, add and remove data(specifically a TreeSet of sorted strings that I want stored in memory, but I doubt the data itself is...
View ArticleAnswer by Chthonic One for Is utilizing a singleton for a cache an antipattern?
When I was first hired out of college, I started working with some software in the mil-sim sphere that is over 20 years old. Often times I was given a task and told to look at similar code in the...
View ArticleAnswer by JimmyJames for Is utilizing a singleton for a cache an antipattern?
I feel like the hate for the Singleton pattern is a little over-the-top. Yes, it can introduce some challenges, but it can also be a very simple solution in narrow circumstances. I think some of the...
View ArticleAnswer by AnoE for Is utilizing a singleton for a cache an antipattern?
No, singletons are not an anti-pattern, per se. Their function depends a bit on the programming language, especially on which features it provides to solve the problem of having a single instance of...
View ArticleAnswer by supercat for Is utilizing a singleton for a cache an antipattern?
While there are many situations where using a singleton cache may be more convenient than having to maintain and pass around a caching context, many situations may arise where such designs end up...
View Article