[wplug] web programming

Bill Moran wmoran at potentialtech.com
Tue Oct 28 08:02:16 EST 2003


Joe wrote:
> 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.

Every language gets complained about.  I think it boils down to "you can't
design a perfect language."

> 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.

I agree with you on this point.  perl was never intended to write web
pages with ... they've done a nice job of adding on stuff for doing so,
but it's still not as nice as a language that was designed for web
pages.  On the flip side, perl is _very_ fast for a scripted language.

> PHP is a much quicker and 
> easier solution to that.

Agreed.  If you need raw speed, however, PHP is not the best solution.

> 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.

You can do the same thing with PHP.  Just define a function that does
exactly what you want in a specific instance, and use:
<?php function_name(); ?>

It may not be quite as nice as a JavaBean, but it works great in a pinch.

I've also found it easier to structure PHP projects if I look at them as
an application instead of a set of web pages.  Most of the code ends up
in included files, most of the formatting is handled by those includes,
and redundant stuff (such at the <HTML></HTML> tags, the <HEAD> section,
and even <BODY> tags, and CSS and stuff) is handled by those includes.
Each individual page ends up being a process of setting up variables and
calling functions to create the page.  It starts to look very clean.

I won't argue that it can get messy at times, but all programs can do
that.  Keeping them organized is an art form.

-- 
Bill Moran
Potential Technologies
http://www.potentialtech.com




More information about the wplug mailing list