| 102 | |
| 103 | == Wisdom == |
| 104 | 1. The secret to building large apps is never build large apps. Break your applications into small pieces. Then, assemble those testable, bite-sized pieces into your big application. |
| 105 | 1. Reducing the amount of code in your product should be a goal. |
| 106 | 1. If you are changing more than 25% of a class or method, consider simply rewriting it. You will write the code more cleanly. |
| 107 | 1. Accept that you have no idea how this will grow. The key is to acknowledge from the start that you have no idea how this will grow. When you accept that you don't know everything, you begin to design the system defensively... You should spend most of your time thinking about interfaces rather than implementations. |
| 108 | 1. Write all your functions to be able to work independently without requiring extra data like global variables, this let's you to test them independently, or even re-use them elsewhere. ''Thanatermesis'' |
| 109 | |
| 110 | ==== Common Excuses For A Software Rewrite ==== |
| 111 | * The Code Sucks |
| 112 | * "We're So Much Smarter Now" |
| 113 | * We Picked The Wrong Platform/Language |
| 114 | |
| 115 | ==== Why Rewriting Is (Almost) Never A Good Idea ==== |
| 116 | * It Always Takes Longer Than You Expect |
| 117 | * Markets Change |
| 118 | * Existing Customers Become Frustrated |
| 119 | * Refactoring Can Cleanup The Code |
| 120 | * You Don't Control The Rewrite, It Controls You |
| 121 | |
| 122 | |
| 123 | === The Zen of Python === |
| 124 | * Beautiful is better than ugly. |
| 125 | * Explicit is better than implicit. |
| 126 | * Simple is better than complex. |
| 127 | * Complex is better than complicated. |
| 128 | * Flat is better than nested. |
| 129 | * Sparse is better than dense. |
| 130 | * Readability counts. |
| 131 | * Special cases aren't special enough to break the rules. |
| 132 | * Although practicality beats purity. |
| 133 | * Errors should never pass silently. |
| 134 | * Unless explicitly silenced. |
| 135 | * In the face of ambiguity, refuse the temptation to guess. |
| 136 | * There should be one-- and preferably only one --obvious way to do it. |
| 137 | * Although that way may not be obvious at first unless you're Dutch. |
| 138 | * Now is better than never. |
| 139 | * Although never is often better than *right* now. |
| 140 | * If the implementation is hard to explain, it's a bad idea. |
| 141 | * If the implementation is easy to explain, it may be a good idea. |
| 142 | * Namespaces are one honking great idea -- let's do more of those! |
| 143 | |
| 144 | === Art of Unix programming === |
| 145 | * Rule of Modularity: Write simple parts connected by clean interfaces. |
| 146 | * Rule of Clarity: Clarity is better than cleverness. |
| 147 | * Rule of Composition: Design programs to be connected to other programs. |
| 148 | * Rule of Separation: Separate policy from mechanism; separate interfaces from engines. |
| 149 | * Rule of Simplicity: Design for simplicity; add complexity only where you must. |
| 150 | * Rule of Parsimony: Write a big program only when it is clear by demonstration that nothing else will do. |
| 151 | * Rule of Transparency: Design for visibility to make inspection and debugging easier. |
| 152 | * Rule of Robustness: Robustness is the child of transparency and simplicity. |
| 153 | * Rule of Representation: Fold knowledge into data so program logic can be stupid and robust. |
| 154 | * Rule of Least Surprise: In interface design, always do the least surprising thing. |
| 155 | * Rule of Silence: When a program has nothing surprising to say, it should say nothing. |
| 156 | * Rule of Repair: When you must fail, fail noisily and as soon as possible. |
| 157 | * Rule of Economy: Programmer time is expensive; conserve it in preference to machine time. |
| 158 | * Rule of Generation: Avoid hand-hacking; write programs to write programs when you can. |
| 159 | * Rule of Optimization: Prototype before polishing. Get it working before you optimize it. |
| 160 | * Rule of Diversity: Distrust all claims for “one true way”. |
| 161 | * Rule of Extensibility: Design for the future, because it will be here sooner than you think. |
| 162 | |
| 163 | |
| 164 | |
| 165 | |