Im learing php have been for a while and while i have kind of put this topicat the back of my head to move on i am still wondering , i dont see the massive use fullness of using classes in a web design. This being said there obviously is one because its what everybody does so i know I AM missing something. Its it all really just for the sake of making more modular code packets ?
Php classes
If you do a web search on "object-oriented programming" you'll find many in-depth explanations of the reasons and methodologies -- probably more accurate than anything I would type up in a forum response.
It's not just for the sake of more modular code, but rather using that modularity and resulting separation and compartmentalization of concerns to create more robust, testable, reliable, and maintainable code.
PS: Looks like Jeffrey has a tutorial series on PHP/OOP, but only the first lesson is free. Might be worth a look to decide if you want to pay for a month or whatever. (His video tutorials are usually very good.)
https://laracasts.com/series/object-oriented-bootcamp-in-php
gimli29;11065696 wrote:Im learing php have been for a while and while i have kind of put this topicat the back of my head to move on i am still wondering , i dont see the massive use fullness of using classes in a web design. This being said there obviously is one because its what everybody does so i know I AM missing something. Its it all really just for the sake of making more modular code packets ?
I think in some cases it might be a tad over the top, but I've found that in many cases it's quite useful, including, but not limited to:
reusing database access code
our web site has listed over one million widgets; my Widget and miniWidget classes/objects are useful for handling these
a Page class/object is useful for quickly creating pages with generic content
we have thousands of users, a User class/object is useful for these
I'm not Bill Gates or Linus T. or God's gift to programming in any way, but I've certain found some benefit from thinking in objects, at least in the cases above. ;-)