Developer on Alibaba Coud: Build your first app with APIs, SDKs, and tutorials on the Alibaba Cloud. Read more ＞
The English copyright belongs to ReinholdWeber, translated by yangyang (akadavidkoree ). The bilingual version can be used for non-commercial communications, but must contain the English version of the author, copyright information, and the Chinese translation of the author. The translation level is limited. Please correct PHPer. I would like to include this article in my "programming chores" series. Although I have been engaged in software engineering, enterprise-level software architecture and database design in formal university courses, I still feel the "evil" of the following facts from time to time. of course, these are my subjective feelings and are oriented to Eclipse:
You are a PHP rookie. if you:
1. do not use tools such as phpDoc to properly comment your code
2. turning a blind eye to excellent integrated development environments such as Zend Studio or Eclipse PDT
3. never used any form of version control system, such as Subclipse
4. some coding and naming standards, as well as general conventions, cannot be implemented during the project development cycle.
5. Uniform development is not used
6. do not convert (or) or verify some input or SQL query strings)
7. do not thoroughly plan your program before coding
8. do not use test-driven development
9. coding and testing are not performed when the error is enabled. For more information, see The PHP function error_reporting)
10. turning a blind eye to the benefits of the debugger
11. do not refactor your code
12. do not use MVC-like pattern to divide different layers of programs
13. do not know these concepts: KISS, DRY, MVC, OOP, REST
14. output (echo/print) content directly in your function or class instead of return.
15. turning a blind eye to the advantages of unit testing or general testing
16. hard-coded HTML is always returned, but no pure data, string, or object is returned.
17. always hard coding of "messages" and "configuration parameters"
18. do not optimize SQL query statements
19. do not use _ autoload)
20. intelligent error handling is not allowed)
21. replace $ _ GET with $ _ POST for destructive transfer operations.
22. I don't know how to use regular expressions.
23. I have never heard of SQL injection or XSS
24. simple configuration is not allowed, and constructors of classes are not allowed to accept parameter passing and then execute the set/get method or constant definition during runtime.
25. do not understand the advantages and disadvantages of object-oriented programming (OOP)
26. abuse of OOP regardless of the situation
27. Self-think that implementing reusable software must be equal to/need to make your code comply with OOP
28. do not use smart default values
29. there is no single configuration file
30. I don't want to expose the file source code, but I replaced. php with the. inc suffix.
31. do not use the database abstraction layer
32. do not keep yourself DRY, that is, do not repeat yourself. if you are always copying and pasting something, it means you are poorly designed.
33. a function, class, or method cannot be used together for only one thing.
34. failed to try the advantages of OOP, such as abstract classes, interfaces, polymorphism, inheritance, and access control modifiers (such as public, private, and protected)
35. optimize your program system design without existing design patterns
36. your users are not allowed to define basic directories when you have many files or directories
37. the namespace is contaminated. for example, use common strings to name your library functions.
38. no table prefix is used when database tables are used.
39. do not use the unified template engine
40. don't pay attention to the existing PHP development framework, so you are too lazy to explore. In fact, advanced development concepts and wonderful code are included.
Also translated by Ma Yongzhan, "40-point bad habits for PHP programmers", is concise and includes comments from translators.
This article is an English version of an article which is originally in the Chinese language on aliyun.com and is provided for information purposes only. This website makes no representation or warranty of any kind, either expressed or implied, as to the accuracy, completeness ownership or
reliability of the article or any translations thereof. If you have any concerns or complaints relating to the article, please send an email, providing a detailed description of the concern or
complaint, to firstname.lastname@example.org. A staff member will contact you within 5 working days. Once verified, infringing content will be removed immediately.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
and provide relevant evidence. A staff member will contact you within 5 working days.