View Single Post
Old 08-17-2004, 10:13 AM   #2 (permalink)
Belisarius
Java fanboy
 
Belisarius's Avatar
 
Join Date: Aug 2003
Posts: 1,161
Belisarius is on a distinguished road
As you move into scripting languages such as PHP or ASP, there is a tendency to mix and match elements of the design patterns.

The goal is total seperation, so you don't worry about database logic in the same page as you're attempting to display a table. You think it's obvious, but way too often you'll see people (especially newbies) including an SQL query in a webpage.

I'm going to go OOP a bit, as that's how I think. Let me know if you don't follow.

I have a website (theoretically). I handle form validation through Javascript, content through HTML, and layout through CSS. I store session data (user, permissions, stats, form information) in an Object for later retrival. I use JSP/ASP/PHP to display different content based on this Object. I use a seperate object to perform background database logic (or e-mail logic or what have you). I keep SQL queries in another object.

By doing this, everything in comparmentalized. You can bring in someone to change the look of your site without the need of them to know Java/VBScript/PHP. You can have a DBA admin your queries with a minimum of programming knowledge. You can get someone who knows programming but not SQL.

It will also make things easier in the long run, as boundaries are clearly defined and hacking is far less frequent. A current project of mine didn't start with that model, but I adopted as I went on later, and the quality of the code has really improved.
__________________
GitS
Belisarius is offline   Reply With Quote