That is an excellent question, and one we could discuss for a month and not have an answer! For code to be truly "excellent" it must meet a large number of criteria. And it's not just about what the lines of code look like, but how they fit into the large software ecosystem, how they were crafted, and more...
It's probably easiest to think of what some of the characteristics of "excellent" code are. And equally easy to think of some of the characteristics of "bad" code.
Perhaps that's something we should think about in this thread?
For example: "excellent code" is
- correct (how do you prove this?) - idiomatic (what idioms?) - maintainable (what does that mean, and is it impacted by the nature and capability of the team you're currently working with) - well tested (is this programmatic "unit tests" or user-testing? Or both?) - you suggest more!
And "bad" code is: - incorrect - not working all the time (the worst is when it looks like it works most of the time, but occasionally falls over in a screaming heap) - badly designed - hard to follow - commented too much - not commented enough
And that's not even scratching the surface! I wrote 600 pages on the topic, and I'm still not done yet :-)
Joined: Mar 07, 2006
you are right. we can carry this this discussion never ending.
And we always have to compromise one aspect when we need to improve on other.for example if we want to improve maintainability of code may be we need to compromise performance.
but which aspect is most important for a excellent code. ofcourse, an excellent code would be optimized mix, balancing all aspects and fitting in the software ecosystem to best. but I always feel that apart from the correctness of code(which depends on correctness requirement :roll: ) performance is most important.