De-Clutter Your Code

Keep it clean guys

Here is an opinionated presentation on how to clean up some code. It’s based on my own take on the Clean Code principles. In particular, I think code can often get a bit detaily. In other words, the detail is taking a higher status than the overall approach. Baked into that is unnecessary detail where something that’s optional is put in – for example, the final keyword or fully qualified paths to method names.

When you remove the extraneous low-level stuff from a function and either ditch it completely, or delegate it to a lower level function, then you express your intent clearly and more manageably. Similarly, if you know how to refine your code and don’t spend the time applying those refinements then though you might save a few seconds right now, you’re wasting minutes and hours of everyone later as they revisit your code.

Here’s my Google slides presentation showing an illustrative refactor.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s