Software Patterns in 2022

Greg L. Turnquist
6 min readJul 21, 2022

Once, long ago, a fledgling coder grasped a beautiful tome titled “Design Patterns: Elements of Reusable Object-Oriented Software”. Otherwise known as the “Gang of Four” book.

And it was good.

He read through it after hours, his ears perking up. Pattern after pattern. And in his very next project, he tried to USE the patterns. ALL of the patterns.

And it was bad.

If you didn’t catch on, that was me. What I did was wrong. 100% wrong. Spiritually, ecumenically, grammatically.

Arrrgh!!! Too many patterns!

And that’s when I realized that software wasn’t just about patterns. I began to learn that TRUE engineering is about tradeoffs. And so when I started writing my own software books, by golly, I included tradeoffs. I didn’t want another developer to suffer the same fate as me.

So what patterns should you look for in 2022? And what are THEIR tradeoffs? Let’s see!

1 — Templates

Templates offer developers shorthand ways to do stuff. They often arise when a full-blown API has too many options and lead to confusion. Templates can wrap such APIs and offer clear cut ways through the API confusion.

Spring is loaded to hilt with templates. One of my favorite being JdbcTemplate (the thing that drew me into the Spring Framework in the first place!) JdbcTemplate has a handful of operations including:

  • query(), update(), delete(), execute(), and call().
  • There are overloaded variations as well as things like queryForObject(), queryForList(), and queryForMap().
  • But NOT anything about opening and closing connections and cursors!

The whole POINT of JdbcTemplate is to take that off your hands. Use this template and you can focus on writing JDBC queries. Let the template handle resources.

Templates are still relevant today. Spring Data in recent months added a new fluent API to supporting modules to make it easier to express a query without getting bogged down in query language specifics. It’s basically another template.

RestTemplate is Spring Framework’s venerable tool to speak to remote services through HTTP. It’s creator, Arjen Poutsma, once presented to a packed…

--

--

Greg L. Turnquist

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