I recently watched the talk that Jonathan Blow (creator of braid) gave at UC Berkley on "How to program independent games". I found it very interesting and I thought it was worth sharing. Below are some of the notes I took as I watched it so I could go back and reference things without re-watching the video.
- Impulse to optimize are often premature
- Makes the code harder to use
- Maybe become irrelevant on newer hardware or systems
- Takes too much time up front when it doesn't matter yet. You need to be brutally effective and efficient. Don't waste time!
- Most code is not performance-sensitive
- Data Structures
- Binary Tree, Hash Table, Skip List
- Data Structures are about optimization
- Using the right data structure is usually bad. Because it is premature optimization.
- He uses an array of records for almost everything. Because it really doesn't matter.
- Things you might optimize
- Seconds per programming execution (speed)
- bytes per program execution (size/space)
- Instead optimize - Years of life per program implementation (life) :)
- Complicated algorithms are not good
- A generalized system is usually worse than a specific hard-coded one.
- Hard to rip out of the code later b/c its hard to know when its not used anymore
- Requires more documentation and harder to wrap your head around which slows you down
- Adding new systems is bad! This should be a last resort
- Deleting code is always better than adding code.
- Don't over-complicate your code with functions versus just doing inline computations. It adds a node of complication to your code and doesn't add a lot of value.
- What is a good programmer?
- Gets things done quickly
- Gets things done robustly
- Makes things simple
- Finishes what he writes (for real)
- Broad knowledge of advanced ideas and techniques (but only uses them when genuinely helpful)
- "knowing" vs. deeply, intuitively understanding
- Its not enough to know these things are true, but you need to practice them as you work. Integrate them as part of your daily practice.