• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JSP/Servlet VS PHP

 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I had to do a web site using PHP for work. And I have to say that I really dig PHP. I used a templating engine called Smarty to help seperate model and view. It's nice and easy.
My question is not one of Which is better but more a question of what can JSP/Servlets do that PHP can't or can't as easily. I like both technologies, however, after working with PHP, I don't see myself using JSP/Servlet unless requested by a customer. Reasons why (And these are my reasons)
1. No special web container. Just need the PHP libs installed to work with almost any web server. And that part is easy
2. No special configuration required, i.e. web.xml files, etc
3. It's fast. So is JSP/Servlets, don't know if one is faster than the other.
4. No restarting Web Servers while testing. Make a change, test it. Simple.
5. personally, I like the syntax. It's close to PERL which I like.
Those are probably the top 5 reasons why I would choose PHP over JSP/Servlets.
I would like to hear to arguments though.
 
Ranch Hand
Posts: 251
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A few reasons come to mind:
(Keep in mind these are all opinions)
1) Scalability - I don't have any solid evidence on this, but PHP doesn't scale as well as JSP/Servlets
2) Java vs. PERL - I think Java is one of the easiest languages for learning and using other ppl's code. I don't know of anything comparable in other languages to Javadoc. A well-written javadoc can make most learning curves trivial.
3) Architecture - I can't see PHP pages having as good a model for loosely-coupled web applications like JSP/Servlets. But then again, I don't have much experiencing developing PHP.
You mention that you like PHP because it's easier to develop in. What then is the difference between PHP and JSP (no servlet)? Little/no configuration, no restarting servers, etc.
PHP does have its benefits, I think mostly being easy development for small projects, and speed. However, I believe JSP/Servlet takes the crown when it comes to OOD, medium-large applications and scalability.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for you input Phil. I do have a couple of things I wish you would elaborate a bit on.
Scalability - I don't have any solid evidence on this, but PHP doesn't scale as well as JSP/Servlets
and
Architecture - I can't see PHP pages having as good a model for loosely-coupled web applications like JSP/Servlets
In regards to your mention of JAVA being one of the easiest languages for learning, that's a tough call. Why then is Sun trying to make it easier if it's already so easy? As far as PHP is concerned, there is a huge community for PHP and tons of modules and libraries already packed with it.
PHP is more like if you used pure JSP without using Servlets (I know JSP's get turned into Servlets) but it would be like using scriplets all over your JSP code. Which I agree is messy and should not be done. But people have realized this with PHP and designed Template Engines written in PHP to resolve this issue. So you really seperate your content from your presentation. I use one called Smarty and I think it is really nice and easy.
 
Ranch Hand
Posts: 937
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
GREG:In regards to your mention of JAVA being one of the easiest languages for learning, that's a tough call. Why then is Sun trying to make it easier if it's already so easy? As far as PHP is concerned, there is a huge community for PHP and tons of modules and libraries already packed with it.
I agree with that. why structs and taglib.
Those who are having a tight budget, php is the answer and its very very easy to develop. check www.hotscripts.com . php and mysql runs on linux so basically no need to spend any money.
php and cfml is very easy to maintain debug and develop and also understanding somebodys code.

here is the code which is used to select record set frm db . im not sure of the php syntax I havent used that for a while. Gregg can correct that. For php no of lines of code is less when compared to JSP.

*************************************************************************************
Connection con = null;
Statement stmt = null;
ResultSet rs = null;
String qry = "";
try{
Driver myDriver = (Driver)Class.forName("weblogic.jdbc.pool.Driver").newInstance();
con = myDriver.connect("jdbc:weblogic ool:xxxxxxx", null);
}catch(Exception e){
System.out.println("DB Connection Error: " + e);
response.sendRedirect(response.encodeURL("/error.jsp"));
}

String [] sections = {"","","","","","","","",""};
int i = 0;
try{
qry = "Select * from customers where CUSTOM_NUM < 10";
stmt=con.createStatement();
rs=stmt.executeQuery(qry);

while(rs.next()){
sections[i] = rs.getString(3);
if(sections[i].equals("")){
sections[i] = "No information at this time. This section is under construction.";
}
i++;
}
rs.close();
stmt.close();
}catch(Exception e){
response.sendRedirect(response.encodeURL("ErrorPage.jsp"));
}

FOR COLDFSUION
CFQUERY
Name="qryAppJobs"
Datasource="*****"
Username="#****#"
Password="#application.App#"
DBTYPE="#application.appDBType#"
DBSERVER="#application.appDBSERVER#" >
SELECT
DISTINCT JOSKILLKEY0 JOB_COUNT
FROM APPLICANT_RANK_HITS
WHERE APPLICANT_ID = '#session.appAppID#'
AND
PROCESSID=#session.CFID#
CFQUERY
>?php $connMysqlbookstore = mysql_pconnect("+++", "+++", "mypassword") or die(mysql_error()); mysql_select_db("bookstore", $connMysqlbookstore); $query_rsGetOrders = "SELECT CustomerID, OrderDate FROM Orders"; $rsGetOrders = mysql_query($query_rsGetOrders, $connMysqlbookstore) or die(mysql_error()); $row_rsGetOrders = mysql_fetch_assoc($rsGetOrders); $totalRows_rsGetOrders = mysql_num_rows($rsGetOrders); ?%lt;
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nice comparisons sunitha.
 
Phil Chuang
Ranch Hand
Posts: 251
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I gotta admit I'm just naturally biased because I love good OO programing
Java might not be easy in the sense of learning it brand new, it's more of a one-time cost. IMHO, properly designed java components are pretty easy to pick up and learn once you know OOP well.
You also have to factor in how well you can google
 
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sunitha and Greg,
One very good reason to use JSPs i can tell u. Ask for 1 JSP opening and u get 100s of applications. Ask for 1 PHP opening and i bet u will hardly get 10 people. Chances are high that u will get better JSP developers than get 1 good PHP developer out of the 10.
And Dear, JSP is not as tough as it looks to be.
BTW, being a web developer, Greg/Sunitha, i wont mind if u'll could gimme some cool links to learn PHP...
[ July 09, 2003: Message edited by: Deepak Acharya ]
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ask for 1 JSP opening and u get 100s of applications. Ask for 1 PHP opening and i bet u will hardly get 10 people
You are probably right. But I wonder why this is.
Chances are high that u will get better JSP developers than get 1 good PHP developer out of the 10.
I don't agree at all with that.
The 2 places I started learning PHP:
http://www.php.net
http://www.phpbuilder.com
 
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
After perusing through mySQL cookbook, I too found myself admiring the simplicity of the PHP code in comparison to the Java code. In addition, dealing with servlets, jsps, and xml in order to get things running, the 5 lines of code in PHP that do the same thing seemed much more agreeable to the lazy beer drinker in me. However, I find Java much easier to digest then the scripting languages I've come across, and since that is the path I've chosen to learn right now I'll not allow myself to be seduced by PHP until I've learned the ins and outs of JSPS/Servlets.
However, the lazy beer drinker in me roars his ugly head ever so often and makes suggestions like, why not check to see if you can integrate that PHP code into a JSP... so I decided to find out if such a concept was already being integrated into PHP and lo and behold.. http://us2.php.net/java
Regards, Michael
 
Bartender
Posts: 1844
Eclipse IDE Ruby Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The main problem I have with PERL is that one experienced PERL developer can write something in PERL and another experienced PERL developer picks up that code and says, "What the #@!! is going on here?" and has to spend time figuring out what the previous developer did. JAVA does not provide the same TMTOWTDI capacibilities of PERL; the upside of this is that the resulting code is much more catholic.
I have nothing against PERL, however; I feel each Programming Language has its place (even C#--its place is to spur SUN to improve Java ) If PHP is simpler to implement than Java, more power to it. I'm pulling my hair out trying to get a web server configured correctly, especially since I have to work though technical support of the hosing company to do it...
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Perl, The Write-Only Language.

[ July 12, 2003: Message edited by: Bear Bibeault ]
 
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I like PHP, but I prefer servlets/jsp. It can take a bit longer to develop a web app using java, but in the long term I'm pretty sure you'll see the benefits of spending that time (maintainance, etc).
PHP is dangerous. It's sooo easy to use that you don't need to be a programmer to develop a web application. I've seen PHP applications that all the code is residing in the PHP page itself, making it a nightmare to maintain.
I'd also agree saying that many *big* companies don't use this technology because is not scalable. For example, The JBoss guys couldn't use nukes because it wasn't scalable, so they had to rewrite their own framework (JBoss-nukes, I think it's called).
my $0.02
[ July 13, 2003: Message edited by: Andres Gonzalez ]
 
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
there is another aspect no one had addressed...
jsp & servlets are not a stand-alone perl-kind scripts, but a part of a huge family of java related technologies.
jsp/servlet advantage is an advantage of entire OO architecture on the everything-in-one-method-mess of scripting languages. comparing jsp/servlets with php, you can't look only at
"V" and "C" of the "MVC". you should mainly look at that "M"...
 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
YO. I watch them opinions flows...
I can handle both technologies and there's my simple conclusion.
If I created my web, I used PHP. But if I developed web application (or little larger web) I do prefere JSP. And JSP I take like "V" in MVC for Java classes.
PHP:
  • fast to develop (only small webs)
  • no security
  • no debuging


  • JSP:
  • security
  • reuse: You can make frontend in swing too.
  • speed: Once compiled, then much faster.
  • persistence
  • thread-save
  • load: It can serve more users.
  • debug: classes could be debuged well.


  • ... and I probably forgot something.
    YO guys. Java on the server-side rules. There are some problems in client applications but server Java has only positives...
     
    Ranch Hand
    Posts: 314
    2
    Android VI Editor Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Hi there,
    I'll add my two cents worth to this discussion -- mainly by way of commenting on points raised in this thread:

    > 1) Scalability - I don't have any solid
    > evidence on this, but PHP doesn't scale as well
    > as JSP/Servlets
    Actually, this thread reads like a discussion about Perl and Java vs. PHP and Java. So with that in mind, Perl scales amazingly well. Some comments and provisos though:
    1. One key to optimizing Perl performance is to view it within the larger context of the web server that it is going to run under. If you configure your web server to cache Perl code, then it won't be recompiled at every one and this improves performance. If you make use of mod_perl, then even better. Some very high performance sites like skibanff.com, winter2010.com, calgaryflames.com, etc. all use Perl as their back-end scripting environment and each get in the millions of hits a day.
    2. You can use Perl's autoloader capabilities to load only those methods (as opposed to modules) you need to work with at run time. This is a good performance booster.

    > 2) Java vs. PERL - I think Java is one of the
    > easiest languages for learning and using other
    > ppl's code. I don't know of anything comparable
    > in other languages to Javadoc. A well-written
    > javadoc can make most learning curves trivial.
    True. Perl has perldoc and, although it makes your code nice and readable, it has the potential of making your code AWFULLY hard to read.

    > 3) Architecture - I can't see PHP pages having
    > as good a model for loosely-coupled web
    > applications like JSP/Servlets. But then again,
    > I don't have much experiencing developing PHP.
    I can't speak much for PHP but I imagine it has some nice presentation frameworks available for it. With Perl, some nice and effective presentation modules like HTML::Mason, HTML::Template, etc. exist that you can use to break presentation markup from business logic. But it is nothing like Struts, for example.

    > In regards to your mention of JAVA being one of
    > the easiest languages for learning, that's a
    > tough call.
    I agree. Java is one of the toughest languages to learn. Once you move to Java to develop web pages you're no longer working within the context of simple client/server request/response object models. Instead you're working within a MASSIVE architecture of packages, frameworks, interfaces, patterns, classes, etc. However, now that I have made the move and can see why that this complexity has its place, it's a bit of a disappointment to go back and work with Perl-based applications -- although it's sure nice to be back in regexp country!

    > php and cfml is very easy to maintain debug and
    > develop and also understanding somebodys code.
    ColdFusion is BEAUTIFUL! And the new MX and soon-to-be-released 'RedSky' versions are integrated into a servlet or web container depending on the version you buy. Not only is ColdFusion easy to learn but it's fast and can substitute for JSP. If Jakarta came up with a version of Struts that worked with CFML instead of JSP -- well, wow! THAT would be a nice presentation framework to work with.

    > The main problem I have with PERL is that one
    > experienced PERL developer can write something
    > in PERL and another experienced PERL developer
    > picks up that code and says, "What the #@!! is
    > going on here?" and has to spend time figuring
    > out what the previous developer did.
    True. But I think this reflects more on the maturity and character of the developer than it does on Perl. Bad code is bad code wherever you find it and anyone whose worth his salt in Perl will be able to pick up on it with a little bit of study.
    To turn the tables a bit, One thing we Perl coders hate about Java is having to figure out the gol-durned object hierarchy of an application, by jiminy! There is nothing worse, when trying to learn a piece of code, than tracing method invocations from method to method, class to class, interface to interface, package to package, configuration file to configuration. Things don't get that complex in Perl because it's the syntax that will get you, not the object hierarchy.

    Cheers,
    Darryl
     
    Gregg Bolinger
    Ranch Hand
    Posts: 15304
    6
    Mac OS X IntelliJ IDE Chrome
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    I can't speak much for PHP but I imagine it has some nice presentation frameworks available for it
    PHP has a very nice framework called Smarty. It is not the only one, the best IMHO.
    It's sooo easy to use that you don't need to be a programmer to develop a web application.
    I agree that PHP is easy, but I think you either overestimate it's ease of use, or you are an experienced PHP user. And what is wrong with something being sooo easy to use? Isn't that what Sun is trying to do with Tiger? And isn't that what M$ is trying to do with .NET? It's all about making things easier for the developer.
    I've seen PHP applications that all the code is residing in the PHP page itself, making it a nightmare to maintain
    And you have never seen the same JSP code? As Darryl said: Bad code is bad code wherever you find it and anyone whose worth his salt in Perl will be able to pick up on it with a little bit of study. I'll just replace the word PERL with PHP there.
    And I am still waiting for some evidence as to the scallability issue. Would anyone care to elaborate a bit more on this in regards to why PHP isn't scallable? I am not sure I understand the term anyway, so...

    And to turn the tables a bit more than Darryal did...I have been playing around with ASP.NET and holy cow is that crap simple. And the Web Controls are nice....Did I just say that??
     
    Darryl A. J. Staflund
    Ranch Hand
    Posts: 314
    2
    Android VI Editor Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    > And to turn the tables a bit more than Darryal
    > did...I have been playing around with ASP.NET
    > and holy cow is that crap simple. And the Web
    > Controls are nice....Did I just say that??
    I TOTALLY agree. I've spent the last nine months developing a J2EE-based application using Struts, JBoss, and a lot of other technologies and development time is SOOOOOO much longer compared to ASP.NET. Why is this the case? Here are some of my observations:
    1. Java lacks a serious server-side web GUI component framework. Sure JSF promises to provide this, but a final release of JSF isn't available at present so we developers have to impelement basic versions of these components. And, although Swing and AWT offer GUI components, the event models that drive them don't make them readily usable in a JSP/servlet-based environment.
    2. Since Java lacks this, it also lacks the accompanying drag and drop, cut and paste technologies that go with it. Again, you have to re-invent the wheel and build these things.
    3. Java lacks web-GUI theme/skin management capabilities. I thought I had read that upcoming versions of J2SE will include this a bit more, but right now these features are lacking.
    4. Lack of 'serious' integration at the IDE level. Sure I can buy an enterprise level IDE that provides some important features. But I have never used a J2EE IDE that offers the features, ease of use, seemless integration like Visual Studio .NET.
    That's my initial list for now. Any additions? Rebuttals? ;-)
    Darryl
    [ July 13, 2003: Message edited by: Darryl A. J. Staflund ]
    [ July 13, 2003: Message edited by: Darryl A. J. Staflund ]
     
    Asher Tarnopolski
    Ranch Hand
    Posts: 260
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Darryl ,
    you are sooooo right! java's gui just sucks.
    i really belive sun has to think about it,
    before it will be too late.
     
    sunitha reghu
    Ranch Hand
    Posts: 937
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Darryl:ColdFusion is BEAUTIFUL! And the new MX and soon-to-be-released 'RedSky' versions are integrated into a servlet or web container depending on the version you buy. Not only is ColdFusion easy to learn but it's fast and can substitute for JSP. If Jakarta came up with a version of Struts that worked with CFML instead of JSP -- well, wow! THAT would be a nice presentation framework to work with.
    Of course its so beautiful...so easy to develop and maintain.if the web site is a highly db driven then cf is the answer. MX also have Flash remoting. Applets are totally out.New version, Red sky will be very fast as it converts the cf files to Java byte code so no intermediate javacode and its a free upgrade to those who have purchased MX.
     
    Greenhorn
    Posts: 3
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    I'm not sure if I can agree with ColdFusion MX. It is much much much much (well, you get the picture) better than the previous CF - but I'm not sure if I'd use this over Java. Depends on what you wish to do. BTW, with Flash Remoting - it's not as simple or well documented as it should be. Macromedia really *needs* to improve in this area - hopefully Red Sky can fix many of the previous bugs.
     
    Darryl A. J. Staflund
    Ranch Hand
    Posts: 314
    2
    Android VI Editor Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    > I'm not sure if I can agree with ColdFusion MX.
    > It is much much much much (well, you get the
    > picture) better than the previous CF - but I'm
    > not sure if I'd use this over Java. Depends on
    > what you wish to do.
    Hi there,
    Apart from Flash Remoting, what moves you to JSP over CFML? Just curious!
    My reasons for CFML as opposed to JSP are as follows:
    1. Built-in templating capabilities.
    2. FAST FAST FAST development time.
    3. Relatively small learning curve.
    4. The ColdFusion server abstracts so many implementation technologies out of the codebase including:
    a. Datasource connectivity.
    b. Security infrastructure.
    c. COM/EJB integration.
    d. Search collections.
    e. LDAP connectivity.
    f. HTTP connectivity.
    g. Syndication APIs.
    h. ...etc...
    5. Accounts for many levels of scoping such as Application, Server, Request, Response, Form, URL, etc. There are many.
    6. Nice rich collection of functions.
    7. FAST rendering.
    8. Cam integrate with both COM and EJB.
    9. Runs on top of J2EE and can integrate with the application server.
    10. Built in search capabilities.
    11. Built in security capabilities (enterprise version)
    12. Easily extensible.
    13. Affordable servers (when compared to some app server pricing/licensing models.)
    14. Tags can be written in C++ (for speed) or Java (for portability / integration)
    15. ...etc...
    And so much more :-)
    Darryl
    PS: Did I say I like ColdFusion? ;-)
     
    sunitha reghu
    Ranch Hand
    Posts: 937
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Originally posted by Amy Moonser:
    I'm not sure if I can agree with ColdFusion MX. It is much much much much (well, you get the picture) better than the previous CF - but I'm not sure if I'd use this over Java. Depends on what you wish to do. BTW, with Flash Remoting - it's not as simple or well documented as it should be. Macromedia really *needs* to improve in this area - hopefully Red Sky can fix many of the previous bugs.


    Some bugs are there in MX version esp CFHTTP so redsky is actually is a bug fix version ie why MM
    is giving as a fre upgrade for MX licensed users.
    When compared to other cf need only 80% less code. CFCOMPONETS act like objects also easy to develop. I also like wddx for serilizing and deserilizing and its very easy to implement.
     
    Ranch Hand
    Posts: 41
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    I've read through most of these replys and thought I'd add in a few of my thoughts.
    I learned PHP while working for the school I was attending. I made a relatively simple web application that would track all of the computer resources (CPUs, Monitors, etc). It went to a database for updates, deletes, reports, etc. I had never worked with PHP until they asked me to do this. The learning curve was very small. In fact, learning PHP was, to me, as easy as learning HTML. I found a site that had the API (much like Java's site) and was able to do just about everything I needed wothout any help from my supervisor. To me, it is a great way to do some powerful stuff with just a little bit of learning.
    That being said, I don't think it is a great language for large applications. It is similar to any sequential language - it does not promote code reuse so developing and maintaining large sites could be difficult. I can't tell you how many times I used the same lines of code throughout each of my pages to connect to the DB, etc. (If there was a way to reuse this, I didn't know about it).
    I also learned J2EE on my own, and found the learning curve to be substantially higher. However, considering I had to learn Java and JSPs, I think that was to be expected. I just completed a fairly large application using J2EE and found that we could do a lot more with it than we could have with PHP. We were also able to reuse common code, leverage the architecture for expansion, and we separated out the presentation, business, and data layers from each other.
    So, if I had my choice, I would use J2EE (or at least the Servlets and JSP part) over PHP for anything with real meat.
    As far as .net is concerned, I don't know. I understand some people's frustration with a good IDE. Darryl mentioned that he hasn't seen one for Java. Not that I like to plug anything, but I have found the WebSphere product to be exceptional at creating J2EE stuff. It will create Data Objects based off the DB schema, You can then make web pages off of these, has a nice GUI builder for html and jsp, etc.
    It also has a GUI builder for Java GUI applications, but I haven't used it much, so I can't comment on it here.
    Well, that's about $0.03 worth...
     
    Ranch Hand
    Posts: 1479
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Originally posted by Ron Perich:
    That being said, I don't think it is a great language for large applications. It is similar to any sequential language - it does not promote code reuse so developing and maintaining large sites could be difficult. I can't tell you how many times I used the same lines of code throughout each of my pages to connect to the DB, etc. (If there was a way to reuse this, I didn't know about it).


    A simple : include("file.php");
    will alow code reuse. Put your DB connection logic in file.php and/or add whatever functions you want to reuse. You can have as many include()s as you want on a page.
    Also, php does have OO features, and you can create classes, etc.
    Php has been used on large web sites; I think the scalability issue is bogus - on the same hardware I bet Php can go beat JSP on speed AND scalibility. Face it, php is simply better all around - development speed, execution speed, readability/maintainability, and scalability.
     
    mister krabs
    Posts: 13974
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Scalability: Neither Perl nor PHP can scale the way Servlet/JSP solutions can for one simple reason... application servers. I can run my servlet/jsp application on 20 servers with high usage parts of my application distributed to more servers than low usage parts. I can add new servers with ease. I can get failover. I get all this without writing a line of code.
     
    Gregg Bolinger
    Ranch Hand
    Posts: 15304
    6
    Mac OS X IntelliJ IDE Chrome
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Originally posted by Thomas Paul:
    Scalability: Neither Perl nor PHP can scale the way Servlet/JSP solutions can for one simple reason... application servers. I can run my servlet/jsp application on 20 servers with high usage parts of my application distributed to more servers than low usage parts. I can add new servers with ease. I can get failover. I get all this without writing a line of code.


    Finally!! Someone gives an explination of the term Scalability. Thanks Tom. About time you chime in.
     
    frank davis
    Ranch Hand
    Posts: 1479
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Originally posted by Gregg Bolinger:

    Finally!! Someone gives an explination of the term Scalability. Thanks Tom. About time you chime in.


    Which site gets consistently the highest amount of traffic of any site on the internet ???
    Yahoo!
    And what language did they rececently convert to???
    Guess! , and then look at :
    http://www.imakenews.com/badblue/e_article000113803.cfm
    You can load balance with multiple servers using PHP also, which is what Yahoo does. Face it, PHP is superior in all real world aspects, and our lives have been wasted learning Java.
     
    Gregg Bolinger
    Ranch Hand
    Posts: 15304
    6
    Mac OS X IntelliJ IDE Chrome
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Originally posted by herb slocomb:
    Face it, PHP is superior in all real world aspects, and our lives have been wasted learning Java.


    This doesn't make it superior. It just makes it AS GOOD.
     
    frank davis
    Ranch Hand
    Posts: 1479
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Originally posted by Gregg Bolinger:

    This doesn't make it superior. It just makes it AS GOOD.


    I think most people will agree development speed is quite a bit faster with PHP over JSP and I think exeuction speed is faster using the PHP Zend engine. In any other categories, JSP and PHP may be equal (I'm being generous here), so when you add it all up PHP is the winner overall. Of course specific projects may have specific needs so that you can use your niche jsp skills for some occassional use .
    [ July 29, 2003: Message edited by: herb slocomb ]
     
    Thomas Paul
    mister krabs
    Posts: 13974
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Originally posted by herb slocomb:
    And what language did they rececently convert to???


    Let's not get carried away:
    Yahoo declined to comment on its use of PHP beyond its released statement. "With recent advances in PHP, we have decided to adopt it for some of our new developments, in preference to some of our internally developed technologies," the company said in the statement.
    When I do a search on yahoo, I see /bin/ not php.
     
    frank davis
    Ranch Hand
    Posts: 1479
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Originally posted by Thomas Paul:

    When I do a search on yahoo, I see /bin/ not php.


    You're pointing out another plus for PHP; you can set up options in the initialization file (php.ini) so that when pages are returned they do not have the .php extension. Making it less obvious what language you are using helps at least a little when hackers are looking for sites with specific languages to target and/or specific vulnerabilities. I think you can even return .asp extensions on your php pages.
    In any event, the fact that the world's most heavily traficced web site uses php should put aside most arguments against php not being scalable. In the prior article I cited there were also other large companies with large web sites using PHP. The growth rate of PHP continues to soar while jsp stagnates with modest growth (or even begins to lose market share to .NET).
    [ July 29, 2003: Message edited by: herb slocomb ]
     
    frank davis
    Ranch Hand
    Posts: 1479
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    JSP is so pathetic javaranch doesn't even use it!
    Ha Ha, javaranch doesn't use jsp for its forums, ROFL LMAO

    In a few years JSP will be as dead as the one-eyed moose, killed by
    PHP and .NET.
    [ July 29, 2003: Message edited by: herb slocomb ]
     
    Ranch Hand
    Posts: 1056
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    You're pointing out another plus for PHP; you can set up options in the initialization file (php.ini) so that when pages are returned they do not have the .php extension.


    Can't you use web.xml to do the same thing for JSPs ?
     
    Ranch Hand
    Posts: 618
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    This doesn't automatically make JSP/servlets as good as PHP, but it should give one pause to realize that Apache, the developers of PHP, actually develop numerous Java-related products, about half a dozen of which relate to Java server technologies.
    It is clear that JSP on its own provides nothing PHP can't provide, but as someone else pointed out, it was meant to be used in conjunction with the J2EE platform, which is substantially more powerful than PHP on its own. JSP shouldn't have to compete with PHP because it's not intended to--it's merely a helper technology, if you will.
    So what if Yahoo is using PHP over J2EE. Are they really the standard for comparing sites providing web apps? Think about it--all their site needs to do is retrieve mail and weather and sports news for users--a little database interaction and voila: you have what you need on the page.
    I think I would love to obtain a J2EE job, but seeing as how I haven't had the pleasure of one yet, I'd welcome any J2EE developers out there to provide specific examples of the kinds of applications they've worked on that seem to necessitate something like J2EE. Of course, many of them probably won't respond to this post because they are too busy getting paid by the energy industry, or financial services, or some other major player needing a complex system to handle its data.
    Don't forget that it's 2003. Maybe PHP can do a whole lot right now, but so far, I only hear about its use with certain kinds of websites. Moreover, as web services and such become much more prevalent and organizations' systems need to more easily interact with other systems, I think we'll see why PHP isn't the best option (in its current condition).
    Have fun arguing...
    Stephen
     
    Gregg Bolinger
    Ranch Hand
    Posts: 15304
    6
    Mac OS X IntelliJ IDE Chrome
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Originally posted by herb slocomb:
    JSP is so pathetic javaranch doesn't even use it!
    Ha Ha, javaranch doesn't use jsp for its forums, ROFL LMAO

    In a few years JSP will be as dead as the one-eyed moose, killed by
    PHP and .NET.
    [ July 29, 2003: Message edited by: herb slocomb ]


    Javaranch doesn't use it because there wasn't a product available when Javaranch came to be. We are in the process of reviewing some software that is JSP/Servlet based that is damn good. The problem has always been getting our current data into the new database. Not an easy task for any technology conversion.
    As far as your jsp is pathetic remark; Why are you participating at Javaranch to begin with? This is a JAVA site. If you hate JAVA so much, why are you still hanging around?
    It's funny, Thomas Paul and I were just talking the other day about how we didn't really have a problem with people comming onto the Ranch and bashing JAVA. Hmmm, we stand corrected.
    [ July 29, 2003: Message edited by: Gregg Bolinger ]
     
    Gregg Bolinger
    Ranch Hand
    Posts: 15304
    6
    Mac OS X IntelliJ IDE Chrome
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Now, speaking as a Bartender, one sentence in the opening post in this thread I would like to point out:
    My question is not one of Which is better but more a question of what can JSP/Servlets do that PHP can't or can't as easily
    So let's try and stay with this line of discussion and retreat from the mundane "which one is better" routine.
    Thanks.
     
    frank davis
    Ranch Hand
    Posts: 1479
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Originally posted by Gregg Bolinger:
    Now, speaking as a Bartender, one sentence in the opening post in this thread I would like to point out:
    My question is not one of Which is better but more a question of what can JSP/Servlets do that PHP can't or can't as easily

    Thanks.


    What PHP can do that JSP "can't as easily" :
    PHP can execute faster (3-4 times faster).
    PHP can be developed faster (2-3 times faster).
    http://www.imakenews.com/badblue/e_article000080431.cfm
     
    Gregg Bolinger
    Ranch Hand
    Posts: 15304
    6
    Mac OS X IntelliJ IDE Chrome
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Originally posted by herb slocomb:

    What PHP can do that JSP "can't as easily" :
    PHP can execute faster (3-4 times faster).
    PHP can be developed faster (2-3 times faster).
    http://www.imakenews.com/badblue/e_article000080431.cfm


    I would be very interested in seeing actual numbers on this. But after that whole Java Pet Store, .NET faisco, it is harder to trust benchmarks. But if anyone has numbers, I would still love to see them.
    I did find the following interesting:
    4 PHP has better community support
    No community is better than Javaranch.
     
    Thomas Paul
    mister krabs
    Posts: 13974
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Originally posted by herb slocomb:
    In any event, the fact that the world's most heavily traficced web site uses php should put aside most arguments against php not being scalable. In the prior article I cited there were also other large companies with large web sites using PHP. The growth rate of PHP continues to soar while jsp stagnates with modest growth (or even begins to lose market share to .NET).

    Yahoo does not use PHP. They use PHP for some trivial internal work that they used to use some specialized scripting. They do not use it for their search pages. PHP sucks. I have used it. It has no transactional support. No asynchronous messaging capability. No built-in security features. It is pathetic for mission critical applications. Trying to split php into a Model 2, MVC architecture is an excercise in futility.
    As far as the list of companies that use it, that is irrelevant. My company, for example, used it for a quick and dirty throw-away web site that we put up to support 2 customers while we developed the real distributed application to support all of our customers. So I assume that you would consider us one of the big wins for PHP. Big Whoop!
    But the real proof is the job search. Go to any site and do a search for Java vs. PHP. I just did a search on hotjobs for my area. 6 PHP (one job was actually for a Java programmer to replace their php app). 206 Java jobs.
    So go learn PHP and join the rank of unemployed high school drop outs showing off their PHP skills on their mom's refrigerator.
    And Herb, no one is impressed when you quote figures like "runs four times faaster" from a site that sells PHP products. And I thought after the blond joke fiasco that you were leaving the ranch? "My work here is done,and like the ancient apostles, I shake the sand from my sandals and leave this city."
    [ July 30, 2003: Message edited by: Thomas Paul ]
     
    Ranch Hand
    Posts: 365
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Can someone tell me if PHP can access objects remotely? Can PHP code reside and run on one server and access and use objects located on another? What are it's messageing capablities? Can I write a batch application or a FAT app with PHP? What type of XML support does PHP have? Can I create a web service with PHP that is portable and interoperable, secure, supports open standards (XML, SOAP, WSDL), and supports the SOAP message processing model and extensions?
    I ask these questions only because I don't know anything about PHP but have found EJB's extremely beneficial at every place I have been because they can be accessed remotely and therefore maintained in one spot. Also, they represent a clean separation of reusable business logic which is generally code that is already written and therefore, I do not have to.
    JMS has also been extremely useful. We have vendors that request information from our database. With JMS we can supply them with the data they need without giving them access to our mainframe. They can request this information without ever knowing what tables they need to hit or even if they are getting data from a legacy system. And message delivery is guaranteed even if the server goes down and messages are not duplicated. We can encrypt this message in order to secure highly sensitive data as well.
    Our apps rely on a set of xml configuration files so that when certain aspects of the application change, such as the name or location of a pdf report or a database lookup name, all we have to do is change a config file without ever touching the code running on the server. We have a highly dynamic environment. Our apps change on an almost daily basis according to user needs. The ability to do this is invaluable.
    And, as mentioned already several times, security is a sticking point for IT managers and is one reason they shy away from .NET and MicroSoft.
    We can do all this without spending big $$$ to cross-train everyone in multiple languages and without worrying what platform our applications will be running on 2 years from now or even longer.
    Can PHP do all of that?
     
    I am going down to the lab. Do NOT let anyone in. Not even this tiny ad:
    a bit of art, as a gift, that will fit in a stocking
    https://gardener-gift.com
    reply
      Bookmark Topic Watch Topic
    • New Topic