Please enable JavaScript.
Coggle requires JavaScript to display documents.
Clean Code (Functions (function arguments (flag arguments (terrible),…
Clean Code
Functions
tiny
blocks & indenting
one task
one level of abstraction
top to bottom
descriptive names
switch statements
polymorphism
function arguments
niladic
monadic
dyadic
triadic
polyadic
flag arguments
terrible
argument lists
verbs & keywords
intent of
function
arguments
most naturally interpreted as inputs
no side effects
command query separation
do something or answer something
expections > returning error codes
extract try/catch blocks
error handling functions
do nothing else
don't repeat algorithms
structured programming
1 entry & 1 exit
write them, refine them
comments
do not make up for spaghetti code
explain in code
legal comments
should not be contracts
refer to standard license
informative comments
informative comments
sometimes usefull
better to use name of the function
explanation of intent
decisions
clarification
risk: clarifying comment could be incorrect
warning of consequences
perfectly reasonable
might be better ways to solve
TODO comments
"to do" notes
not an excuse to write messy
amplification
amplify the importance
javadocs
public API
comments that shouldn't be there
mumbling
spend the time necessary to write a comment
redundant comments
takes longer to read
clutter and obscure the code
misleading comments
expecting incorrect behaviours from a function
mandated comments
not everything should have a comment
journal comments
source code control systems didn't exist
nowdays it's more clutter
noisy comments
frustration could be resolved by improving the code
scary noise
pay attention when comments are pasted
use a function or variable instead of a comment
position markers
rare times it makes sense
in general they are clutter
closing brace comments
clutter well encapsulated functions
atrributions and bylines
source code control systems are good at remembering
no need to pullute code with bylines
commented-out code
source code control systems will remember the code for us
HTML comments
make comments hard to read
nonlocal information
just describe near code
too much information
inobvious connections
connection between coments and code should be obvious
function headers
good name is better for tiny functions
javadocs in non public codes
not generally useful