Changes between Version 20 and Version 21 of HowtoGoodProgrammingTechniques


Ignore:
Timestamp:
Apr 22, 2014, 8:28:31 AM (11 years ago)
Author:
Thanatermesis
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • HowtoGoodProgrammingTechniques

    v20 v21  
    5050* Whitespaces improves readability a lot, use them, if you combine them with foldings in your editor you will not suffer the side-effect of removing contents visually
    5151
     52=== Think less ===
     53If you think less, you can read faster, for example:
     54* Don't say ''equal or less than 2'' if you want to say ''less than 3''
     55* Never use negatives, they are harder to think than afirmatives, for example:
     56  * ''if not accept'' becomes ''if ignore''
     57  * ''if is not disabled'' becomes ''if enabled'' (stupid but very common)
     58  *
     59* write shorter and clever sentences
     60
    5261
    5362== Convention Names ==
     
    911001. Convention names, take some time to decide the optimal names for your variables and functions
    92101
     102
     103== Wisdom ==
     1041. 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.
     1051. Reducing the amount of code in your product should be a goal.
     1061. If you are changing more than 25% of a class or method, consider simply rewriting it. You will write the code more cleanly.
     1071. 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.
     1081. 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
    93166== Extra ==
    94167