good code may not look like you expect
- duplicate code isn't always bad
Sometimes* the same code copy/pasted or repeated is much easier to understand than pulling it all into a subroutine. It seems logical when writing code, but kills understanding when reading code. Predictable is better than compact a lot of times.
- code should fail early
Sometimes* "being robust", correcting errors or continuing after an error is the wrong thing to do. When something unexpected happens, failing, and failing quickly might be important.
- explicit is better than implicit
Sometimes* it is much better hardcode a list of things instead of constructing the list from whatever is there.
concrete example would be a makefile that compiles .c vs a makefile that compiles one.c two.c three.c. Hardcode the list. Make it hard fail if something is missing or something is added. Yeah, it is more work, but the madness it prevents is worthwhile.
there are probably thousands of these things. All are opinion, like camelcase sucks and indent should be 4, but not with tab characters.
* not always
- duplicate code isn't always bad
Sometimes* the same code copy/pasted or repeated is much easier to understand than pulling it all into a subroutine. It seems logical when writing code, but kills understanding when reading code. Predictable is better than compact a lot of times.
- code should fail early
Sometimes* "being robust", correcting errors or continuing after an error is the wrong thing to do. When something unexpected happens, failing, and failing quickly might be important.
- explicit is better than implicit
Sometimes* it is much better hardcode a list of things instead of constructing the list from whatever is there.
concrete example would be a makefile that compiles .c vs a makefile that compiles one.c two.c three.c. Hardcode the list. Make it hard fail if something is missing or something is added. Yeah, it is more work, but the madness it prevents is worthwhile.
there are probably thousands of these things. All are opinion, like camelcase sucks and indent should be 4, but not with tab characters.
* not always