Code Smell 162 - Too Many Parentheses

Photo by Nick Fewings on Unsplash

Code Smell 162 - Too Many Parentheses

Parentheses are free of charge. Aren't they?

Maxi Contieri
·Sep 10, 2022·

1 min read

Subscribe to my newsletter and never miss my upcoming articles

Play this article

Table of contents

  • Code Smell 162 - Too Many Parentheses
  • Problems
  • Solutions
  • Context
  • Sample Code
  • Detection
  • Exceptions
  • Tags
  • Relations
  • Conclusion
  • Disclaimer
  • Credits

Code Smell 162 - Too Many Parentheses

TL;DR: Use as few parentheses as possible.


  • Readability

  • Syntactic complexity


  1. Remove all not necessary parentheses


We read code from left to right (at least in western culture).

Parentheses often break this flow, adding cognitive complexity

Sample Code


schwarzschild = ((((2 * GRAVITATION_CONSTANT)) * mass) / ((LIGHT_SPEED ** 2)))


schwarzschild = (2 * GRAVITATION_CONSTANT * mass) / (LIGHT_SPEED ** 2)


[X] Automatic

This is a fully automated code smell.

It is based on syntax trees.

Many tools detect it.


On some complex formulas, we can add extra parenthesis for terms readability.


  • Readability

  • Bloaters



We write code once and read it too many times.

Readability is king.


Code Smells are just my opinion.


Photo by Nick Fewings on Unsplash

If someone claims to have the perfect programming language, he is either a fool or a salesman or both.

Bjarne Stroustrup

This article is part of the CodeSmell Series.

Share this


Technical Opinions are my own. I don't have the revealed truth.

Software Design is a creative activity. These are hints and not rigid rules.

I write on BackEnd Business Systems and OOP Design. My advice/experience might not suit other systems.

You can write me at info(at)