Good code versus bad code
Both good and bad code compile. There are reasons why code is labeled good code and bad code, as shown in the following comparison table:
Good Code |
Bad Code |
Proper indentation |
Improper indentation |
Meaningful comments |
Comments that state the obvious |
API documentation comments |
Comments that excuse bad code and commented-out lines of code |
Proper organization using namespaces |
Improper organization using namespaces |
Good naming conventions |
Bad naming conventions |
Classes that do one thing |
Classes that do multiple things |
Methods that do a single... |