PHP设计模式
面向对象的目标
- 高内聚,低耦合
面向对象设计的基本原则
- 单一职责:一个类只做一件事
- 开闭原则:对扩展开放对修改关闭
- 里氏替换:子类必须能替换所有父类的使用
- 依赖倒置:设计依赖于抽象而不是实现
- 最少知识:对象应当尽可能少的去了解其他对象
- 接口隔离:接口倾向于小而多
- 组合优先:优先使用类的组合而不是继承
抽象类和接口的使用
- 当类中有共同的行为或属性时,可以考虑使用 abstract calss
- 当类别中有共同的操作界面,但是在实现上有所差别,可以考虑使用 interface
PHP中常用的设计模式的一些小demo
抽象类和接口的使用
现在的Readme..3.里氏替换:之类必须能替换所有父类的使用
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.