Of the 40 common bad habits of PHP programmers how many have you got?

  • 2021-08-03 09:49:30
  • OfStack

1. Don't write comments

2. Do not use IDE tools that can improve production efficiency

3. Do not use version control

4. Do not write code according to programming specifications

5. Do not use the method of unification 1

6. Don't think and plan before coding

7. Do not perform coding and security detection before executing sql

8. Do not use test-driven development

9. Do not turn on automatic error reporting when coding (error_reporting)

10. Do not use a good debugging tool

11. Do not refactor your code (refactor)

12. Do not adopt the hierarchical structure such as MVC

13. I don't know the following concepts: KISS, DRY, MVC, OOP, REST

14. Output something directly with print or echo in a function or class instead of returning it (return)

15. Do not use or understand unit tests

16. Returns HTMl instead of data, strings, objects, etc

17. Bad code and configuration parameters (hard code messages and configuration parameters)

18. Do not optimize sql queries

19. Do not use __autoload

20. Automatic error operation is not supported (it should be intelligent error correction)

21. Use $_GET instead of $_POST for dangerous parameter passing (remember these 40 things are all wrong)

22. Don't know how to use regular expressions

23. I have never heard of sql injection and cross-site scripting (in terms of security, I should know the English of these two things: sql injection, cross-site scripting)

24. Do not support simple configuration, pass parameters to class constructors, set/get methods, define constants

25. Can't understand the advantages and disadvantages of OOP

26. Use OOP no matter how small the thing is

27. It is considered that reusable software is OOP

28. Do not use the default value (don 't choose intelligent defaults)

29. Do not use a single 1 profile

30. Replace. php with. inc instead of letting others see the code

31. Do not use the database abstraction layer (persistence layer)

32. DRY (Dont repeat yourself) at development time. (That is, something that is always repeated in development)

33. Do not develop reusable classes or methods

34. Do not use abstract classes or interface classes, inheritance, polymorphism and encapsulation.

35. Optimize your program without using existing design patterns.

36. The user is not allowed to define the basic directory (this seems that PHP is not suitable, after all, it is not based on the operating system)

37. Wrong use of namespace, using commonly used words as prefixes. (This will cause conflicts when others use it later. For example, define one function called array_push ())

38. Do not use table prefixes when using databases (this is important...)

39. Do not use or use a strange template engine (it is convenient for team development, and everyone should use common templates)

40. Don't look at the framework of PHP (most frameworks contain excellent code and advanced concepts. It is worth learning)

Almost all the entries of this site are in, and if you have less than 30 entries, don't leave a message to stimulate me ~


Related articles: