On 22 Sep 2002 at 10:23, Michael Sims wrote:

> of creating this application.  I decided (for various reasons) to
> implement this application in Perl.

I began programming in Perl back in 1995. Took up mod_perl (the only 
way to seriously use Perl btw on web apps) but as I work primarily on 
virtual servers mod_perl was just too sophisticated for most 
environments, so I settled for just Apache::Registry which would also 
run as plain cgi. Well  ... I've finally found a nice framework using 
PHP (using smarty.php.net) with Pear and then private classes for the 
App at hand. Works like a charm. I'm a fan of Perl but you can't beat 
PHP for ease of deployment and PHP does everying Perl does (all that I 
need) (although not all that mod_perl allows but then those conditions 
are pretty rare, for instance, like taking command at any of the apache 
request phases, especially good for custom auth stuff).

> in my Perl script.  Worse yet, I realized that if any of this business
> logic changes (which it often does), I was going to have to remember to
> change it in TWO places.  Up until this point there was only the
> website, but now that I had two completely seperate applications that I
> have to maintain whenever anything changes.

Oh yeah, avoid that at all costs. Sounds like something like SOAP etc. 
could have been an answer, but then it depends on how you write your 
apps. 

I write both Perl and PHP to manipulate data. Every function has input 
and output and those are just arrays. I ran into a similar problem with 
NUKE. My customer wanted me to allow a user to join via a multi-
newsletter module I was writing. Well I got it to work but it was not 
as easy as it should have been imho. I should have been able to call 
CreateNewUser and pass it the require input and gotten back a user id 
and then I could have called soemthing like GetUser and pass it a user 
id and get back an associative array (my pref) of that user. It was not 
like that, not at all, or I missed it. It seemed that the creation of a 
new user was tightly *coupled* with an html signup process. 


> I realized at this point that I would be really nice if the business
> logic that determines how to construct the queries and which bits of
> data to display were completely seperated from the presentation logic
> that existed in my PHP pages.  If I had some sort of component that
> merely accepted search parameters and returned data then I could access
> this component from both the PHP page and the Perl script.  If the
> business logic changed later I could simply update the component and I
> (theoretically speaking) wouldn't have to touch the PHP page or the Perl
> script.

Ummm .... like the other guy said, why bother? You can do that. Of 
course. But what are you doing in Perl that you cannot do in PHP? Maybe 
a cron script? I've not written any cron stuff in PHP and I'm not 
calling lynx to do it as I've seen advertised :( ... 


> I've been doing research into this kind of application design.  From my
> limited and inexperienced perspective, it does appear that Microsoft
> does offer some advantages in this area.  But COM is not an option for
> me, for several reasons, not the least of which is the fact that our
> servers run Linux and I cannot access PHP's COM functions.

SOAP, XML-RPC 

http://php.weblogs.com/xml-rpc

I just did a search on Google. I have not written anything along these 
lines but given XML you could write your own but I'd always go the 
public route if I were to do this. 

I'm reading an interesting book called "Software Architect Bootcamp" 
where components is the big word. It's interesting. I'm not sure if 
I've got a full grasp but it defintiely seems to have an emphasis on 
decoupling (something going back to I read about in McConnell who is 
very good).  But how to implement?  In the book I'm guilty of what he 
calls the Stovepipe System :( but I'm working on it.

> I have considered setting up a PHP page that runs on a seperate port.
> This page would accept search criteria via a query string, and then
> return listing data in XML format.  Then on the PHP presentation side
> (or my Perl script), I would parse the XML and either display it
> manually, or use XSLT.

> I don't have a lot of experience with this, however.  It seems that XML
> support in PHP is still in a state of infancy.  

I don't know about that. Works well for me. I take an Amazaon XML feed 
and run it through my smarty templates with no problem here:

http://www.readbrazil.com/books/amazon.php?mode=books

please note that above site has been more of a php playground than 
anything else.

No need to go the XSLT route although that is interesting. I use 
Template::Toolkit in Perl and have templates in html, xml, or plain 
text.

> the best thing to do is to wait a bit until XML support in PHP
> solidifies a little more.

I really don't now enough about this. Seem strong to me but I have'nt 
done much.

> Another technology I was toying around with is Java servlets and Java
> Beans.  I'm a complete newbie when it comes to this stuff too, but from
> what I've read it seems that Java Beans are designed to wrap up business
> logic in reusable components.  Money is an issue, however, so if I
> implemented anything in Java I would have to use Apache's Tomcat, and
> not one of the commercial Java platforms.  I realize this is wildly
> off-topic for this list, but if anyone here has any experience with
> Tomcat I'd appreciate any advice (off-list if necessary) as to whether
> I'm barking up the wrong tree or not. :-)

I think you can do all of this in PHP. But I don't think there is any 
easy answer. I have a website I work on now and then (using geeklog) 
http://www.smartarchitectures.com/ and I plan it to be about just what 
you are talking about. I don't think your question is really language 
specific. A lot of these books and what not are big on the strategic 
but then they leave the details out of the picture.

It sounds like to me you are looking for a framework. This what I 
looked for in PHP and I've got one now that is equal or better to my 
Perl framework. I use the same pattern I do in Perl. Isolate data 
manipulation, functions are the sort of "programming by contract" where 
functions expect input and return output. It gets messy when I have to 
handle errors ... I'm trying to componentize my stuff to decouple it 
all ... 

Peter

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

Reply via email to