Many people do this for a variety of reasons. Don’t be one of them.
Why do people add unnecessary code? It can happen for several reasons.
Sometimes it’s a fun bit of extra stuff. Avoid this. Write code to create business value, not for your own amusement. If you have that kind of itch, start a side project.
Often you will see developers writing code in anticipation that it may need in the future. Don’t do this. Only code to the current requirement. Most of the time, anticipatory code goes unused. YAGNI – You Ain’t Gonna Need It.
For some, it is easy to add a little extra code rather than ask if it is really required. Please, if you’re not sure about the requirement, you’re not talking to your business partners enough.
Occasionally a programmer invents extra requirements that not documented or even desired. And the requirements turn out to be bogus. Work with the business and meet their needs, deliver working software that adds business value. Everything else just causes problems.