| My Notes
- Little-endian: in least significant byte first order (the data is represented
"little-end-first"). Intel and VAX machines. 0x1234 =
- Big-endian: the most significant byte first ("big-end-first"). Unix workstations (Sun boxes).
- Network byte order: big-endian.
Rules Of Thumb
- When queuing, always provide backpressure.
- Never hide a change in level in the memory hierarchy. It is better to make things look
more expensive than they are than to make things look cheaper than they are.
- When you have an active object that takes a listener as a constructor parameter, don't start
immediately - provide a start method instead.
- When you have an async request (especially a "stop" request), support detecting when the
request is complete. There are three cases: don't care, block, and callback. If the callback case
is supported, the other two can be implemented in terms of it.
- When doing subscriptions, there are three methods: subscribe, unsubscribe, and refresh.
Refresh is not strictly required, but is useful - it is needed if subscriptions are muxed
- In event driven systems, an object whose update is an event should be immutable.
- When throwing exceptions, if the caller could reasonably have detected the error condition
ahead of time, then the caller is buggy and the exception should be a runtime exception
(e.g., parameter validation). If the caller could not reasonably have detected the error
condition on its own, then the exception should be a checked exception.
- Don't die forward; die back. If deep in processing you encounter a fatal error, don't
call a fatal error handler that makes blocking calls to stop the system; throw a runtime exception
to unwind the stack, then stop the system. Don't hide (eat) unexpected exceptions; rather,
make sure they get propagated up as soon as possible. (Think Erlang.)
- As a corollary, use
finally blocks to ensure invariants
are sufficiently restored during an unexpected exception to allow a service to be successfully
- More thoughts on exceptions.
C o m m e n t s :