|
Posted by kenoli on 05/18/07 18:33
This doesn't get to your question in an abstract way because I am just
learning the concept of patterns, and may not get to it at all, but it
is my experience with structuring php scripts. I've been coding for
acouple of years, off and on, because of a need to have an interactive
web application for a project I am involved in. I suspect that while
I have used various scripting structures, they all more or less fall
under the the MVC model.
I started out trying to keep pages organized into several categories:
those that are mostly html, includes that provide libraries of
functions and, my goal, one script that handles all the processing.
This latter involved a lot of switches and other control structures to
get the data processed appropriately. This pretty much followed the
MVC pattern, the html pages being the view and the processing script
being the control. I designed my database, I guess you would call
this the M part, based on a conceptual analysis of my project needs
and some guidelines from "Database Design for Mere Mortals," which I
found to be a very useful book.
Over time, I found my processing script growing to a size that it was
hard to manage. I faced more and more challenges regarding how to
send my html data to the right parts of the script. What I finally
resolved to, which serves me pretty well now, is a model where the
script that processes an html page is placed between php tags at the
head of the document. The html on that page, which I try to keep as
pure html as possible, is placed "below" the script tags and any
action it triggers refers back to the same page, activiting a switch
or some control mechanism to process the data appropriately. Once the
data is processed, the user is sent to the same or another html page
as appropriate, sending along any necessary data in post, get or
session variables.
I'm finding myself modfiying my database schema as we use the
application and as I see how it interacts with my scripting needs.
Thus it is being modified to adapt to practical scripting issues and
to the end use requirements. In this way I provide increased
flexibility and efficiency all all levels.
As my scripts develop, I find ways to reuse them and re-organize them
so that they are growing into modules and more readable scripts.
This seems to be a useful development model for me, though it may not
work for an enterprise sized application or a design project involving
a team of developers.
I am not doing OOP, though I am looking into it. I'm not sure there
are advantages for the size of the project I am involved in. I use my
functions and includes in a similar way to which one might use objects
and have thought about experimenting with developing them into
objects.
I'm very interested in other responses to your query.
--Kenoli
On May 17, 2:27 pm, anal_aviator <analavia...@pornolizer.com> wrote:
> Hi,
> I'm looking to develop a web-site with both database and php access.
> Personally I'm familiar with the MVC design pattern , are there any quick
> pointers on other suitable patterns, that will cover both web & database?
Navigation:
[Reply to this message]
|