[wplug] web programming

John Harrold jmh17 at pitt.edu
Tue Oct 28 09:38:51 EST 2003


Sometime in October Joe assaulted the keyboard and produced:

| I dont really consider this off-topic since this all relates to things 
| you can do with linux and apache..
| 
| There was a book review on slashdot earlier about EJB's and reading the 
| comments and other comments from the linked webpages I saw a lot of 
| people bash java for one reason or another. Granted, I've never done 
| anything with EJB's or J2EE, most people could very well be right on 
| saying its a horrible way to structure something. But at the same time, 
| theres a lot of people complaining about java, php, perl, and those ms 
| languages in general.

i don't know jack about java. i started a while back monkeying around in
php. after a while i found perl and cpan. at the time there wasn't a really
convenient way to to write command line scripts in php, so i switched over
to doing everything in perl. i understand that command line scripts are now
possible in php, but i've developed a "substance abuse" like dependency on
perl :).

| So if anyone here does or has done a great deal of web programming, I'd 
| really like to know your opinion on what you use and why. Personally, 
| I've used php, perl, and java and find pros and cons to all 3. While I 
| use perl everyday with basic system scripting, I've found it to be too 
| much of a hassle with making dynamic webpages. PHP is a much quicker 
| and easier solution to that. But I've found that the larger a project 
| gets with PHP, the more sloppy it gets too.. with having php code 
| nested here and there and stuff. I've found jsp and javabeans to be a 
| good solution to that... where you can take a block of code that was 
| embedded in html, shove it in a javabean, then use a tag to call the 
| output. Makes everything much cleaner.

when i switched over from php to perl it was hard. things are just done a
little differently. while you can embed stuff in html, that gets messy as
you noted. i tend to use templates with place holders for the information.
i use the perl scripts to create the content and then replace the place
holders with the content. 

another thing that really makes things messy is i've seen a lot of the php
projects do stuff like:

include(a_bunch_of_vars.php)

where the file a_bunch_of_vars.php set's a lot of variables. this tends to
clutter up the name space and for me gets really messy. in perl it's easier
to just use a configuration file like the stuff that you find in /etc and
there are many cpan modules which are written for this purpose. using the
cpan module Config::IniFiles for example you can write some wrappers to
easily extract config info from files without creating a bunch of variables
you don't really want to use in the current chunk of code.

in php's defence perl can get just as messy. typically speaking though, if
i use 'warnings' and 'strict', avoid embedding perl directly in html, and
encapsulate stuff things are much cleaner. of course if you have a hammer
everything looks like a nail, cpan just has so many different kinds of
hammers :).

-- 
--------------------------------------------------------------------------
                                               | /"\
 john harrold                                  | \ / ASCII ribbon campaign
      jmh at member.fsf.org                    |  X  against HTML mail
           the most useful idiot               | / \
--------------------------------------------------------------------------
 What difference does it make to the dead, the orphans, and the homeless,
 whether the mad destruction is brought under the name of totalitarianism or
 the holy name of liberty and democracy?
 --Gandhi
--------------------------------------------------------------------------
gpg --keyserver keys.indymedia.org --recv-key F65A739E
--------------------------------------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://penguin.wplug.org/pipermail/wplug/attachments/20031028/ca44f774/attachment-0001.bin


More information about the wplug mailing list