Quantcast
Channel: Is utilizing a singleton for a cache an antipattern? - Software Engineering Stack Exchange
Browsing all 8 articles
Browse latest View live

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 Article


Answer 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 Article

Answer 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 Article

Is 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 Article

Answer 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 Article


Answer 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 Article

Answer 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 Article

Answer 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

Browsing all 8 articles
Browse latest View live