设为首页 收藏本站
查看: 437|回复: 0

[经验分享] 不知道这些,一定是php菜鸟

[复制链接]

尚未签到

发表于 2017-4-9 08:24:54 | 显示全部楼层 |阅读模式
  1. 不会利用如phpDoc这样的工具来恰当地注释你的代码
2. 对优秀的集成开发环境如Zend Studio或Eclipse PDT视而不见
3. 从未用过任何形式的版本控制系统,如Subclipse
4. 不采用某种编码与命名标准,以及通用约定,不能在项目开发周期里贯彻落实
5. 不使用统一开发方式
6. 不转换(或)也不验证某些输入或SQL查询串(译注:参考PHP相关函数)
7. 不在编码之前彻底规划你的程序
8. 不使用测试驱动开发
9. 不在错误开启状态下进行编码和测试(译注:参考PHP函数error_reporting)
10. 对调试器的好处视而不见
11. 不重构你的代码
12. 不使用类似MVC模式把程序的不同层次划分开
13. 不知道这些概念:KISS, DRY, MVC, OOP, REST
14. 不用return而是直接在你的函数或类中输出(echo/print)内容
15. 对单元测试或通用测试的优点视而不见
16. 总是返回硬编码的HTML,却不返回纯粹的数据,字符串,或对象
17. 总是对“消息”和“配置参数”进行硬编码
18. 不对SQL查询语句做优化
19. 不使用__autoload(译注:参考PHP手册相关描述)
20. 不允许智能错误处理(译注:参考PEAR的ErrorStack)
21. 使用$_GET替代$_POST来做具有破坏性的传递操作
22. 不知道怎么利用正则表达式
23. 从未听说过SQL注入或跨站脚本
24. 不允许简易配置,也不允许类的构造函数接受参数传递而后执行set/get方法,或运行时的常量定义
25. 不理解面向对象编程(OOP)的优势和劣势
26. 不视情形大小而滥用OOP
27. 自认为实现可复用的软件一定等于/需要让你的代码遵循OOP
28. 不利用智能缺省值
29. 没有单一的配置文件
30. 不想暴露文件源码,却用.inc后缀名取代了.php
31. 不使用数据库抽象层
32. 不能保持DRY作风,即不重复自己,如果你总是在复制粘贴一些东西,说明你设计得很差劲
33. 没有实现让一个函数/类/方法只做一件事,也不能组合利用它们
34. 没能尝试OOP的特长,如抽象类、接口、多态、继承,访问控制修饰符(译注:如public, private, protected)
35. 不用现有的设计模式优化你的程序体系设计
36. 不允许你的用户在你拥有很多文件或目录的情况下定义基础目录
37. 污染了名称空间,比如用常见字符串命名你的库函数
38. 使用数据库表时不使用表前缀
39. 不使用统一的模板引擎
40. 不关注已有的PHP开发框架,懒于探索;其实先进的开发理念和美妙代码就蕴含其中。
  1. don't comment your code properly with something like phpDoc
  2. don't see the need and/or benefits of a good programming IDE like Zend Studio or Eclipse PDT
  3. have never used some form of version control like Subclipse
  4. don't adopt some coding & naming standards and general conventions and stick to to them at least throughout the project
  5. don't use a consistent methodology
  6. don't escape and/or validate properly input or sql queries
  7. don't plan your application thoroughly before starting to code
  8. don't use test-driven development
  9. don't program & test with error reporting on
  10. don't see the benefits of a debugger
  11. don't refactor your code
  12. don't keep the different layers seperated using something like MVC
  13. don't know what these stand for: KISS, DRY, MVC, OOP, REST
  14. don't return content but echo or print it from your functions or classes
  15. have never seen the advantage of unit tests or testing in general
  16. return HTML, not data, strings, or objects.
  17. hard code messages and configuration parameters
  18. don't optimize your sql queries
  19. don't use __autoload
  20. don't allow intelligent error handling
  21. use $_GET instead of $_POST for any destructive actions
  22. don't know how to use regular expressions
  23. you've never heard of sql injection or cross-site scripting
  24. don't allow simple configuration, can be parameters passed to a class’s constructor, set/get methods called later, or constants defined at a runtime.
  25. don't understand the benefits and limitations of Object Oriented Programming
  26. misuse OOP / everything you write , no matter how small is OOP
  27. you think reusable software equals/requires your code to be OOP
  28. don't choose intelligent defaults
  29. don't have one single configuration file
  30. don't want the file contents to be seen, but give it a .inc extension instead of .php
  31. don't use a database abstraction layer
  32. don't keep it DRY, Don't repeat yourself. If you have to copy and paste or duplicate something your design may be off.
  33. don't make a function/class/method do just one thing and don't make them interact.
  34. don't try to take advantage of OOP specific features like abstract/interface classes, inheritage polymorphism & access modifiers.
  35. don't optimize your application design with established design patterns
  36. don't allow your user to define a base directory if you have multiple files and/or directories
  37. pollute the global namespace, one option is to prefix the functions in your library with a common string
  38. don't allow a table prefix when using database tables
  39. use a separate template engine
  40. don't take a look at established php frameworks for inspiration, most of them have advanced web dev concepts and good code
  
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/mayongzhan/archive/2008/02/15/2096975.aspx

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-362215-1-1.html 上篇帖子: 传说中的腾讯php程序员面试题目,学习一下 下篇帖子: php的IDE(集成开发环境)选用指南[1]
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表