General principles
Last updated
Last updated
Any time spent writing the code is spent only once. Any time spent reading the code is spent every single time it is read.
Low level functions must do things and it should be minimal. HighLevel functions must call low level functions and avoid doing things themselves. Define Low level and hight level.
Naming is highly depends on context.
Importantly, this does not preclude anything which is not public from having header documentation.
Preferably with tests.
null
vs undefined
In languages with support for both null
and undefined
, undefined
means we have not set anything for this variable yet, such as when we are waiting for a response from a remote server, while null
means that something has been explicitly set to nothing, such as the response from the server said that there is no list of items to display (not an empty list, but there is no list at all).