I see no problems whatsoever in utilizing an intermediary script to do processing of 
information.  However, there IS a problem when this script sets flags that are 
unwanted by the client.  An example of a good intermediary script application would be 
as below.

Person A and Person B both remotely log into their website's Content Management 
System.  They both navigate to the same file on the server, because their boss told 
them it needs updating.  Person A clicks on the link to edit the file first, thereby 
setting an intermediary script into action which sets a flag, say "checked_out" to 
true.  Person B across the hall is denied access to this file because Person A already 
has it "checked out".  This is much in the tradition of DreamWeaver FTP.

The above is a great example of how intermediary scripts can be used to help avoid 
critical misunderstandings.  You do NOT want two people to edit the same file at the 
same time, otherwise it'll get messed up REALLY fast.

In your example, though, if the agent simply wishes to view the customer's 
information, but has no interest in contacting the person at all (perhaps for research 
purposes), then the flag that says that the agent is, has or will be contacting the 
customer is obtrusive.

Overall, I think the coding style is very good, and you're right that it does in fact 
make code much easier to interpret.  However, there is a big difference between an 
intermediary script being helpful, and it being a hinderance.

Just my $20.00 (big mouth, you know)

Martin Clifford
Homepage: http://www.completesource.net
Developer's Forums: http://www.completesource.net/forums/

>>> "Jay Blanchard" <[EMAIL PROTECTED]> 07/12/02 09:40AM >>>
Howdy group,

   Over the past couple of days I have come under some fire for my "style"
of coding, most particularly the use of PHP scripts to process information
between "pages" or interfaces shown to various users. An example;

   An agent goes to an interface that reveals a list of customers from a
database. These customers have provided referrals which now reside in a
database. The agent selects a referral which is processed by an intermediary
script which sets a flag in the database saying that "this agent" is, has,or
will be contacting this referral (to prevent duplicate contact). Then this
redirects to the referral's interface where the details about this referral
are revealed.

    Interface A
   | Customer   |
   | Submitted  |
   | Referral   |
         |        +------------------+
         +------->| PHP Script       |
                  | (for processing) |
    Interface B             |
   +------------+           |
   | Referral   |           |
   | Info       |<----------+

While this is a rather simplistic example (I use some intermediary scripts
that are much more complex, some that call other script if the situation
warrents it) I have found that for many applications this makes the code
easier to maintain, gives me a way ID certain processes when something
breaks (I use a lot of error logging), and also prevents some code from
being aborted by the user when the results of doing something like that
might be undesirable.

I know that this might start a holy war, but it is likely that discussion on
this would enhance all of our coding styles. I realize that this may not
help me strengthen my position with regards to the fire I have come under,
but I had to ask. Thoughts?



* Want to meet other PHP developers *
* in your area? Check out:          *
* http://php.meetup.com/            *
* No developer is an island ...     *

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php 

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to