Note
|
|
I don’t care about the code!
I’m in a hurry,
what happens when I use it?
-
pre- & postconditions
-
return value range
-
side-effects
-
thread-safety
-
(im)mutability
I’m in a hurry!
-
good names, small methods, SOLID, …
only go so far -
how many interface implementations
am I supposed to check? -
what if I have to implement an interface?
I care about the code!
I have to change it,
why does it look like this?
-
considered alternatives
-
code-shaping requirements
-
overall architecture
-
design principles
I have to change it!
-
good names, small methods, …
are almost useless -
SOLID helps! 👍
-
ubiquitous patterns help;
what about lesser known ones?
Still, most information
not expressible in code!
I care even less about the tests!
How do you test this?
-
"for all" propositions
-
thread-safety
-
(im)mutability
-
interfaces
Test coverage better be > 90%!
Tests are observations:
-
take time to generalize
-
are not a contract
-
only explain what, never why
Self-documenting code and tests are great for:
-
understanding little pieces of code
-
editing code
They are really bad for:
-
quickly determining expected behavior
-
understanding larger concepts
-
conveying rationale for decisions
A common fallacy is to assume authors of incomprehensible code will somehow be able to express themselves lucidly and clearly in comments.
A common fallacy is to assume developers incapable to express themselves lucidly and clearly in a natural language will somehow be able to write lucid and clean code.
That’s like saying
"Cars crash".
So? Do we get rid of them?
Crashes:
-
are caused by negligence
-
are often punishable by law
-
are acceptable given the benefits