I ran across this on Kevin's blog. Great stuff I have to add my slant to it.
Minimize code complexity
Maximize API ease-of-use
Maximize the chance another dev will use an API correctly (see Pit of Success)
Minimize code size
Minimize unnecessary code churn
Maximize code readability
Maximize correctness
Maximize robustness
Maximize flexibility
Maximize code maintainability
Maximize CPU performance characteristics
Maximize Memory performance characteristics
Opt for immutable data structures
Opt for thread-safe data structures and APIs
Verify pre-conditions
Follow design guidelines
Get it done yesterday!
These are all but the same rule to me. It's the first goal listed,
Minimize code complexity. Maybe I should say rules 2 through N are how to get to minimal code complexity.
Levels of ComplexityIf you have a component with no interrelations, at most it will take you W^1 units of work. Put your slowest or fastest dev on the component, it won't change you project completion date.
Now, if you have a component that rely's on something else. This is pretty much going to take you 4 times as long. W^2
W^3? That's right.... 9 times as long.
On the way to reaching you minimal code complexity, item's 2 and 3 are super important. Maybe we should change it to
minimal api complexity. I will take tons of code in a class with a super easy api. That all but takes you from 9 work units down to 4.
Either way, a great list to use as talking points.
Some crazy extreme's come to mind. boost's Spirit (www.boost.org). A very neat parsing library. Almost nothing in the classes is directly tied to any other class.
The use of templates and the fact that every compiler error and call stack is a good 20 lines long makes it just impossible to use. Impossible unless you know about all the classes that exist to help everything compile. If VC9.0 would just let you turn off namespaces, and even template parameters in the debugger it'd be 100 times easier.