3 Java Patterns that died in 2022

Greg L. Turnquist
6 min readOct 6, 2022

If there’s something we LOVE when it comes to software development, it’s finding ourselves some fun little shortcuts.

Of course, we don’t call them that. We call them patterns. Patterns are like recipes for baking up software solutions. Solutions we see appear more than once. After all, if we’ve solved a problem, why not re-use the solution? Isn’t that what Object-Oriented Programming (OOP) is all about?

However, some of these patterns we solved for long ago, have turned out to be HORRIBLE and the source of misery. And so we’re going to see some of the most vile patterns that died a deserved death in 2022 starting with…

1 — Static Global Objects a.k.a. Singleton Pattern

This is that beast of a pattern where we use trickery and hacks to ensure that No More Than One of these things could exist. Often, they involved external resources, for which there can be only one!

Now what is bad about these things?

Well, the trickery used to implement them often involved statics and taking advantage of when static initialization happens. HOT TIP: It’s early in an application’s lifecycle when static initialization happens.

Static objects have certain side effects that make them truly detestable including:

--

--

Greg L. Turnquist

Sr. Staff Technical Content Engineer at CockroachDB • YouTube Content Creator at https://youtube.com/@ProCoderIO • Best-Selling Author • Coffee Lover