How do most of you construct your applications?
Do you break it up into sections based on the functions of the app?
example:
contact_add.php
contact_delete.php
contact_edit.php
.....
Do you write one long script, and then call parts of it using a variable?
example:
contact.php?action=add
Or do you do something else, like use a MVC design pattern? I'm interested
in rethinking the way I write stuff. Any suggestions would be helpful.
Thanks 6 2574
In article <NZ*****************@twister.tampabay.rr.com>,
"Jason" <js******@cfl.rr.com> wrote: How do most of you construct your applications?
Do you break it up into sections based on the functions of the app?
example:
contact_add.php contact_delete.php contact_edit.php
I prefer to do it like that, including shared code at the top of each
section, like this:
include('contact_defs.inc.php');
include('contact_functions.inc.php');
Do you write one long script, and then call parts of it using a variable?
example:
contact.php?action=add
I'd rather not do it like that. The 'one long script' has a tendency to
become spaghetti code with way too many 'if ... elseif ....' sections in
it pretty quick.
Also, to keep my scripts clean, concise and 'to the point', I usually
offload all HTML production to Smarty. (see http://smarty.php.net/).
JP
--
Sorry, <de*****@cauce.org> is een "spam trap".
E-mail adres is <jpk"at"akamail.com>, waarbij "at" = @.
On Sun, 14 Sep 2003 09:59:09 GMT, "Jason" <js******@cfl.rr.com> scrawled: How do most of you construct your applications?
Do you break it up into sections based on the functions of the app?
example:
contact_add.php contact_delete.php contact_edit.php ....
Many draw backs to this - mainly with duplicating large amounts of user
code (security at the top) of each script, and having to jump through
hoops to correctly handle "fall-back" scenarios.
Do you write one long script, and then call parts of it using a variable?
example:
contact.php?action=add
I tend to do it this way... but create an action class...
with methods such as ACTION_add, ACTION_delete, ACTION_edit...
The I have code which collections the action from the URL, checks to see
if the ACTION_{$action} method exists - and if so calls it...
This method has many advantages over the single script... you end up not
duplicating many of the "fall-back" actions many times...
It is much easier to add user level security at this sort of level.. (in
fact it becomes easy to set up configurable security levels)
AND you don't end up with the "spaghetti" code
My "class" heirachy often ends up as:
"application".inc
|
| (isa)
|
core.inc (central functions
|
| (isa)
|
site.inc (general templating code)
|
| (hasa)
|
dbhandle.inc (database interface code - like perl's DBI)Or do you do something else, like use a MVC design pattern? I'm interested in rethinking the way I write stuff. Any suggestions would be helpful.
Very useful! Thanks
"James" <ne*******@black-panther.freeserve.co.uk> wrote in message
news:3f***************@news.freeserve.com... On Sun, 14 Sep 2003 09:59:09 GMT, "Jason" <js******@cfl.rr.com> scrawled:
How do most of you construct your applications?
Do you break it up into sections based on the functions of the app?
example:
contact_add.php contact_delete.php contact_edit.php ....
Many draw backs to this - mainly with duplicating large amounts of user code (security at the top) of each script, and having to jump through hoops to correctly handle "fall-back" scenarios.
Do you write one long script, and then call parts of it using a variable?
example:
contact.php?action=add
I tend to do it this way... but create an action class...
with methods such as ACTION_add, ACTION_delete, ACTION_edit...
The I have code which collections the action from the URL, checks to see if the ACTION_{$action} method exists - and if so calls it...
This method has many advantages over the single script... you end up not duplicating many of the "fall-back" actions many times...
It is much easier to add user level security at this sort of level.. (in fact it becomes easy to set up configurable security levels)
AND you don't end up with the "spaghetti" code
My "class" heirachy often ends up as:
"application".inc | | (isa) | core.inc (central functions | | (isa) | site.inc (general templating code) | | (hasa) | dbhandle.inc (database interface code - like perl's DBI)Or do you do something else, like use a MVC design pattern? I'm
interestedin rethinking the way I write stuff. Any suggestions would be helpful.
"Jan Pieter Kunst" <de*****@cauce.org> wrote in message
news:de***************************@news1.news.xs4a ll.nl... In article <NZ*****************@twister.tampabay.rr.com>, "Jason" <js******@cfl.rr.com> wrote:
How do most of you construct your applications?
Do you break it up into sections based on the functions of the app?
example:
contact_add.php contact_delete.php contact_edit.php
I prefer to do it like that, including shared code at the top of each section, like this:
include('contact_defs.inc.php'); include('contact_functions.inc.php');
Do you write one long script, and then call parts of it using a
variable? example:
contact.php?action=add
I'd rather not do it like that. The 'one long script' has a tendency to become spaghetti code with way too many 'if ... elseif ....' sections in it pretty quick.
Also, to keep my scripts clean, concise and 'to the point', I usually offload all HTML production to Smarty. (see http://smarty.php.net/).
JP
-- Sorry, <de*****@cauce.org> is een "spam trap". E-mail adres is <jpk"at"akamail.com>, waarbij "at" = @.
I break mine up too....but I use patTemplate instead of Smarty :)
"Jason" <js******@cfl.rr.com> wrote in message
news:NZ*****************@twister.tampabay.rr.com.. . How do most of you construct your applications?
Or do you do something else, like use a MVC design pattern? I'm interested in rethinking the way I write stuff. Any suggestions would be helpful.
here is one possible approach with combination of templates and MVC http://www.templatetamer.org/index.p...trollerPattern
rush
-- http://www.templatetamer.com/
"Jason" <js******@cfl.rr.com> wrote in message news:<NZ*****************@twister.tampabay.rr.com> ... How do most of you construct your applications?
Do you break it up into sections based on the functions of the app?
example:
contact_add.php contact_delete.php contact_edit.php ....
Do you write one long script, and then call parts of it using a variable?
example:
contact.php?action=add
Or do you do something else, like use a MVC design pattern? I'm interested in rethinking the way I write stuff. Any suggestions would be helpful.
Thanks
I have very small scripts that perform a single function each, as in
your first example, as I find smaller scripts a lot easier to
maintain. I also use the 3 tier architecture which means that all my
business logic for each entity is maintained in a single class which
can then be shared by any number of scripts in the presentation layer.
All my HTML is generated from XML data files which are then
transformed using XSL stylesheets. I have found that I can place a lot
of my XSL code in small files which I can reuse by using the
<xsl:include> command.
For an overview of my environment check out http://www.tonymarston.net/php-mysql...structure.html
Tony Marston
http:/www.tonymarston.net/ This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Davey |
last post by:
I am planning on developing an application which will involve skills that I
have very little experience of - therefore I would appreciate comments on my
initial design thoughts.
Overview on...
|
by: Lane Beneke |
last post by:
All,
New to the list and a relative newbie to PostgreSQL. Please forgive stupid
questions.
Designing an application server for a work order processing (et al)
database. I have a good handle...
|
by: Saso Zagoranski |
last post by:
hi,
this is not actually a C# problem but since this is the only newsgroup I
follow I decided
to post my question here (please tell me where to post this next time if you
think this post...
|
by: Matthew Hood |
last post by:
My company has expressed a desire to convert an existing MS Access
application to a full VB.NET application. My experience is with VB6 so I
want to ask a few questions and get some input on the...
|
by: Oldie |
last post by:
I have built an MS Access Application under MS Office XP (but I also
own MS Office 2000). I have split the application in the pure database
tables and all the queries, forms, reports and macro's.
...
|
by: xcelmind |
last post by:
Hello Dev. Guru,
I want to at this time introduce myself. I am Stanley Ojadovwa by name.
I’m a freelance and a newbie in web application development. I’m
currently using ASP as my application...
|
by: salad |
last post by:
I have an application written in MS-Access. It is a complete
application that manages the day-to-day operations of a business.
The program is nearly ready to be used in other customer sites.
...
|
by: goraya |
last post by:
This is design level discussion about web applications. How I design
application that support 1 million concurrent requests??
|
by: abhijitbkulkarni |
last post by:
Hello,
I am designing a .NET database application that uses 3 tier architecture. Starting initially, this application will be desktop application but I will convert it into a website later but...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |