(^92) 97 Things Every Programmer Should Know
Know Your Limits
Man’s got to know his limitations.
YOUR RESOURCES ARE LiMiTED. You only have so much time and money to
do your work, including the time and money needed to keep your knowledge,
skills, and tools up to date. You can only work so hard, so fast, so smart, and so
long. Your tools are only so powerful. Your target machines are only so power-
ful. So you have to respect the limits of your resources.
How to respect those limits? Know yourself, know your people, know your
budgets, and know your stuff. Especially, as a software engineer, know the
space and time complexity of your data structures and algorithms, and the
architecture and performance characteristics of your systems. Your job is to
create an optimal marriage of software and systems.
Space and time complexity are given as the function O(f(n)), which for n
equal the size of the input is the asymptotic space or time required as n grows
to infinity. Important complexity classes
for f(n) include ln(n), n, n ln(n), ne, and
en. As graphing these functions clearly
shows, as n gets bigger, O(ln(n)) is ever so
much smaller than O(n) and O(n ln(n)),
which are ever so much smaller than
O(ne) and O(en). As Sean Parent puts it,
for achievable n, all complexity classes
amount to near-constant, near-linear, or