开发者

How/Why use PHP classes on a simple page [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopene开发者_运维知识库d, visit the help center for guidance. Closed 12 years ago.

I want to create a simple PHP website containing quite a number of pages. The content of the pages will be editable by the admin(s) of the website using a simple online html text editor.

There should also be members, managed by the admin. (No self-registration)

There is also a members section with login.

Obviously this is not complicated to do procedurally, but I would like to try using classes.

Why should I even use PHP classes in this case? And where would they be useful? Or is there no good reason to use them for such a site?

Thanks


Using OOP principles even in small projects can help you fully understand the benefits of such Programming principles. Although the problem may be easy to solve procedural, it would be an extension and maintenance nightmare.

So:

  • Think about your classes and their relations before coding (Maybe even draw some UML charts)
  • Have a look at various design patterns, maybe one fits your problem here
  • Stick to your design while coding ;)


To use classes makes sense if it is easier to use a class than to do something without (and for reusability if needed). Sure you could go without classes, but for example for your user management (your members) there are some helpfull classes to use.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜