Whether one is an optimist or pessimist is dictated by genetics. Wise people say that you can give your genetics a run for the money by making happiness a conscious choice and learn to be deliberately happy.
What does this have to do with coding?
How do you decide whether a code is good or not?
There are many parameters, but a definitive indicator is the number of bugs – lesser the bugs, better the code.
What is the definition of a bug?
A bug is a problem with the code, which makes it not work correctly.
Why do bugs occur?
The person who authored the code did not anticipate that particular condition, and the code does not know how to handle that situation.
How does one prevent bugs?
Anticipate all that can go wrong and take care of them while coding.
To do this, one needs to take a bleak look at things – exhaustively think of all that can go wrong and take care of these. To put it shortly, you need to wear a pessimist’s cap.
Then, do pessimists make better coders?
There is another way to look at this.
To create something, you need to be an optimist; coding is about creating something new. To write code devoid of bugs, you need to take care of edge cases and boundary conditions and account for them.
Is a better coder someone who can balance optimism and pessimism?
Follow @abhyrama
Photo by Christophe Hautier on Unsplash