OO PHP explanation For a braindead n00b

前端 未结 7 1897
轮回少年
轮回少年 2020-12-15 09:05

I\'ve been writing PHP for about six years now and have got to a point where I feel I should be doing more to write better code. I know that Object Oriented code is the way

7条回答
  •  甜味超标
    2020-12-15 09:47

    Another pointer for learning OO:

    Most OO tutorials will focus on inheritance (e.g. class X extends class Y). I think this is a bad idea. Inheritance is useful, but it can also cause problems. More importantly, inheritance isn't the point of OO. The point is abstraction; hiding the implementation details so you can work with a simple interface. Learn how to write good abstractions of your data, and you'll be in good shape. Don't sweat the inheritance stuff right away.

提交回复
热议问题