Nine Clean Code Patterns

coding python go java kotlin October 17, 2021

Towards Data Science, a Medium site, posted “Nine Clean Code Patterns I wish I knew Earlier,” a series of things that you can apply while coding to help future-proof your code. You probably know a lot of them (or all of them) already but they’re good reminders.

They are:

  • Explanatory Variables - the art of using a reference to hold data that you use immediately; ordinarily not a useful variable, but one that holds state you can examine while designing
  • Follow Conventions and Style Guides
  • Type Checking (for those languages that struggle with strong types)
  • Consistent Terminology - define things well, then use those definitions consistently
  • Meaningful Names (which includes a lot about naming, like avoid short names, avoid LONG names, avoid data structures in names, and so forth)
  • The Step-Down Rule - keep functions at one abstraction level only, so avoid embedding presentation-level features in a persistence-level function
  • Remove Dead Code
  • Use Containers - referring to data structures, not runtime containers
  • Avoid Surprises
in architecture python go java kotlin

Reading time: 1 minute.