justudy
V2EX  ›  PHP

PHP 常用的一些设计模式总结

  •  
  •   justudy · Aug 10, 2016 · 3641 views
    This topic created in 3738 days ago, the information mentioned may be changed or developed.

    不知道各位开发工程中对设计模式运用多少

    不过有时候一些设计模式可以让代码更加健壮

    地址: https://github.com/igo9go/phpDesignPattern

    4 replies  •  2016-09-06 15:40:10 +08:00
    cxbig
    cxbig
    Aug 10, 2016
    1
    野路子出身,听到“设计模式”这个词第一反应是这个人是不是 Java 的背景。
    按我的理解就是 OOP 思维,功能分块做 Abstract 和 Interface ,实例 extends 或 implement ,再用 Service Provider 串起来。

    随便翻了一下这个 repo ,还用 mysql function 做例子+字符串拼接 SQL 似有不妥
    https://github.com/igo9go/phpDesignPattern/blob/master/Dao.class.php
    justudy
    justudy
    OP
    Aug 11, 2016
    2
    嗯,是的。这个只是一种思想,别太在意具体实现
    AbrahamGreyson
    AbrahamGreyson
    Aug 17, 2016
    3
    写的挺好的, 只是目前以大写开头的文件名一般都是类,所以 .class.php 的写法建议换一换,有四五年没见过这种写法了,实话说还是很不习惯。
    cayley
    cayley
    Sep 6, 2016
    4
    写的不错,学习了,赞
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1237 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 22:08 · PVG 06:08 · LAX 14:08 · JFK 17:08
    ♥ Do have faith in what you're doing.