Member-only story
The Programming World
3 Inconvenient Truths About Coding
Accept them in order to code pragmatically
When I studied computer science, my goal was to learn how to produce great software. Coding is a major part of that.
I love coding, as it is logical and analytical. It is “science” to me, which means there’s an ultimate truth out there that enables us to write the best and most enduring code.
After being in the field for two decades, I can now accept some coding facts that I wouldn’t in the past. Here are three of them.
1. There Is No One Right Way To Code
“In a room full of top software designers, if two agree on the same thing, that’s a majority.” — Bill Curtis
Throughout my career in software development, I have witnessed many insightful discussions and debates on different coding practices — whether they were about styles, patterns, or even just naming.
Sometimes I agree with one party, sometimes I see the viewpoints of both, and sometimes I don’t agree with any of them. There are also times when I first disagree with someone, and in hindsight, I realize how blind I was.
Now, one thing I’ve come to accept is that there are pros and cons in all ways of coding. One can defend their point forever.
Let’s see a simple Java example of if-else
and ternary…
if (a > b) {
print(a);
} else {
print(b);
}
// OR
(a > b)? print(a): print(b)
There can be countless debates on why one is better than the other. I’m sure there are even people who disagree with both of the above.
If we want to get everyone to fully agree with one single way of coding a piece of work, we’ll have no answer. There’s no one right way to code.
But if we are willing to set our ego aside, we can solve the problem at hand — even while thinking the code is not perfect. “There’s more than one right way to code.” Isn’t that liberating?
2. All Code Is Meant To Be Temporary
Hardware is made to…