05-05-2008, 06:44 PM
|
#7 (permalink)
|
|
The Acquainted
Join Date: May 2008
Posts: 175
Thanks: 9
|
Very nice sock. I personally use OOP programming as well and couldn't have delivered it more clearer then you have here. Above anything else, OOP helps keep things extremly clean, especially when mixed with a templating engine.
For instance, I use smarty. Smarty is wonderful, and I do not have a single line of HTML code in any of my PHP files. Using this it is possible to truly seperate presentation from the logic layer.
I have a page class, which its sole purpose is to handle sessions, user authentication, and database connections. This class does all the pre-processing for each page without me needing to hard code it into any page. If a page has unique circum stances, I can manipulate the object from the page calling it to make sure it is doing what I want it to do.
I also have a basic form class, that every single one of my forms calls. This form class sets up abstract methods like processForm() and drawForm(). This class also handles auto-protecting against several security issues. So when the child form class is used, I know I do not need to worry about protecting against SQL injection or XSS attacks, as my the parent class takes care of all of this dynamically.
Trust me .... once you go OOP you never go back :) Things are just so much easier to control and organize with it.
|
|
|