What is code polishing…and why YOU should be doing it!

Greg L. Turnquist
5 min readJan 26, 2023

One of the most amazing things I’ve discovered since joining the Spring team…was their affinity for polishing code. In fact, at the 2014 GOTO conference, Rod Johnson mentioned Juergen Holler’s “unearthly commitment to code quality”.

What, exactly, is that? And by the end of this article, I hope you’ll realize not just WHAT this is…but why you should take up this mantle.

In its simplest incarnation “code polishing” is when you ensure that your entire code base has a consistent, equivalent, uniform nature. Speaking of Java code, this can include things like:

  • Consistent sorting of import statements
  • If you use wildcards in import statements, expand at the same amount (Spring Data requires 11+ imports before using a wildcard)
  • Curly braces begin and end at the same place, everywhere
  • Wrap ALL code blocks with braces (no single-line/no braces)

That’s not the whole list, but you perhaps can see the value in having every Java classfile adopt this same style. Thankfully, like many of software’s challenges, there are tools to help with that. The Spring Data team uses the Adapter for Eclipse Code Formatter, a plugin that lets us read an Eclipse code formatting file and apply it inside IntelliJ. This lets us share a common set of formatting choices.

If we’re all using the same formatting choices, it becomes a hotkey combo to reformat any source file we’re…

--

--

Greg L. Turnquist

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