Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

developing web applications using java ee or php [closed]

Tags:

php

jakarta-ee

well I'm trying to understand which could be the benefits in the development a web application using java ee or using php.why a programmer should choose java ee or php? I usually develop web application in php working with some framework.what are the difference in terms not of language (that obviously are totally different) but in terms of project aspects.

like image 651
eng_mazzy Avatar asked Feb 21 '23 08:02

eng_mazzy


2 Answers

The two most significant distinctions are deployment models and hosting options.

Regarding deployment models, since PHP is (mostly) a language that's interpreted at request time, the turn around during development can be quite fast -- you readily make your change "in place" behind the server, and your changes are instantly available as soon as you refresh your browser. In contrast, Java can get caught in a change - deploy cycle which can take longer, and also be more invasive (the deploy could, perhaps, log out of your session as an example).

A lot of that can be mitigated with Java using different techniques, different containers, 3rd party extension (such as JRebel), but you don't get that capability "out of the box" or from the off the shelf tutorials. I also don't want to overplay it, the process is manageable, it's not that awful. But it is a noted difference between the two platforms.

Hosting options come in to play since just about any random web host out there can host PHP applications at some level. PHP can be deployed as lowly CGI on over saturated super cheap hosts to larger, more complicated configurations.

Java CAN be deployed as a simple WAR to a shared host, and that works "OK", but shared Java environments CAN be less stable as the different applications within the shared environment can unfriendly to each other and have undue impact. This is less of a concern in a PHP deployment.

Therefore, most semi-serious Java deployments instead go with a VM instance as a standalone deployment. The game there would be to contrast costs and such between the different options.

On the whole, I think that Java deployments, as a rule, are easier to manage and work with because of the packaging nature and the nice tools that Java servers come with, but that's a matter of taste and experience. Someone with a lot of PHP hosting and deployment experience would, rightly, shrug that issue off. But out of the box, for someone coming new to it all, I think Java is much easier to work with.

like image 144
Will Hartung Avatar answered Feb 23 '23 21:02

Will Hartung


Assuming you're comfortable with both languages, the difference primarily is in your server environment. PHP runs on Apache (usually) which isn't a java server, while Java will run on Jboss or Tomcat.

This question is going to get closed pretty quickly because the moment you ask it, people feel the need to chime in with their opinion as to which approach is "better". The reality is that both approaches have their positives and negatives, obviously, so, you should choose based on what environment you wish to support and what language you are most comfortable with. Additionally if you have some very specific needs, you can investigate which approach suits those needs best. Once you have such requirements you should ask about them individually.

For what its worth, straight Java makes separating your business logic from your presentation logic VERY difficult since there isn't even the notion of a multi line quoted String with parameters. That problem is solved with JSP, of course, so if you're comfortable with THAT language, then you really do get into a 6 of this 1/2 dozen of the other of that.

like image 39
Yevgeny Simkin Avatar answered Feb 23 '23 21:02

Yevgeny Simkin