Programming principles and Python Philosophy

Programming principles

  1. DRY – Don’t repeat yourself
  2. Abstraction Principle
  3. Keep It Simple and Stupid
  4. Avoid Creating a YAGNI (You aren’t going to need it)
  5. Do the simplest thing that could possibly work
  6. Don’t make me think
  7. Open/Closed Principle
  8. Write Code for the Maintainer
  9. Principle of least astonishment
  10. Single Responsibility Principle
  11. Minimize Coupling
  12. Maximize Cohesion
  13. Hide Implementation Details
  14. Law of Demeter
  15. Avoid Premature Optimization
  16. Code Reuse is Good
  17. Separation of Concerns
  18. Embrace Change


Python Philosophy


  1. Beautiful is better than ugly.
  2. Explicit is better than implicit.
  3. Simple is better than complex.
  4. Complex is better than complicated.
  5. Flat is better than nested.
  6. Sparse is better than dense.
  7. Readability counts.
  8. Special cases aren’t special enough to break the rules.
    Although practicality beats purity.
  9. Errors should never pass silently.
    Unless explicitly silenced.
  10. In the face of ambiguity, refuse the temptation to guess.
  11. There should be one — and preferably only one — obvious way to to it
    Although that way may not be obvious at first unless you’re Dutch
  12. Now is better than never.
    Although never if often better than right now.
  13. If the implementation is hard to explain, it’s a bad idea.
  14. If the implementation is easy to explain, it may be a good idea.
  15. NameSpaces are one honking great idea — let’s do more of those.

1 条评论

  • 惡搞新聞 2016年12月25日 回复



电子邮件地址不会被公开。 必填项已用*标注