3 ms·
What code would you rather maintain: // A const int giraffe = 1 + 1 + 1 + 1 + 1; // B const int number = 5; At some moment, you will meet som
by 29athrowaway 5y ago
What code would you rather maintain:
// A
const int giraffe = 1 + 1 + 1 + 1 + 1;
// B
const int number = 5;
At some moment, you will meet some disagreeable person that will say they are the same and it doesn't matter which one you pick.
A is similar to Roman numerals. We all know that Roman numerals are no longer used for most purposes and were replaced by the numeral system we currently use. Not only the new numeral system is more convenient for various reasons but it allowed people to advance math further. So A is better than B in that sense.
Then, A uses an identifier that doesn't represent its value. We can also say it's bad because of that reason.
You can try to seek ways to compare and improve code. Not all of them will be effective, but at least you will be trying. That is better than being that disagreeable, nihilistic guy that thinks that everything is subjective and relative and won't agree with anything you say.
You have to learn how to treat your code with respect and prevent it from becoming a tech debt dumpster.
There is code that is objectively bad. And you will know when you try to maintain, debug or profile it, or when you have to explain it to someone else. Or when it keeps breaking over and over again and many defects are connected with it. Or when it becomes a product limitation and you have to apologize to customers about it.