Java or php web development

Java OR PHP Server Side Web App and Why? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.

I am creating a web app that involves a lot of DB access and parsing and analysing data , Java is the language i am most comfortable with but recently have been told that I should consider to use PHP as it makes DB access protocols a lot simpler. I dont have any great knowledge of PHP but would be willing to learn for use if it was going to be the better option as far as functionality , portability ect is concerned. The Web app will run against an Oracle DB and use Flex for the GUI, Please any experiences of similar projects and what made your chosen approach better would help or just opinions of any sort.

8 Answers 8

If you’re comfortable with Java, I don’t see the need to learn/use PHP. There is nothing that PHP can do that Java can’t.

It’s true that by and large, PHP is a much more permissive language, and some tasks can be fulfilled more quickly and with less code. PHP certainly has less built-in abstraction than Java has. But if you’re comfortable with Java, I’d say stick with it.

(I’m saying this as a PHP developer.)

ha ha thanks guys , efficiency was a point I was worried about but that’s reassuring . Thanks for your help

@Pekk, full disclosure: I’m a Java dev, and have never written a line of PHP. I just like continuing the stigma.

@org I can’t claim to be equally familiar with Java, not by a long shot. But from what I know, for anything that I want to be simple, portable and cheap to run / deploy and maintain, I will prefer well-written PHP any day. But this has been discussed numerous times on SO.

I see far more PHP engines on my shared hosting services than servlet containers. I will stick to PHP for small things.

There is a huge amount of difference between the syntax, phuilosophy and implementation of the 2 languages. I would suggest that «makes DB access protocols a lot simpler» is not a particularly good reason in isolation for choosing one language over another.

Читайте также:  Java puzzles to eliminate code fear

My background is as a PHP programmer, but I currently support several large Java web applications. If you were starting from the same point with both languages then I’d definitely favour PHP over Java — but a full discussion of the reasons why would take a lot more time and space than are available here. However if you already have strong Java skills, then you have to weigh up the costs of acquiring the right level of skill in PHP — due to the differences in the way these systems work, you’re going to find your knowledge of Java as much of a hindrance as a benefit in achieving proficiency in PHP.

Other factors I would suggest you have a look at are:

1) architecture — PHP requires far better understanding of the underlying protocols than Java (where a lot of functionality is provided by libs/ frameworks)

3) performance considerations — using an opcode cache means the difference between simple programs written in Java and PHP is small, since the former are usually written inside very complex frameworks, PHP can often have the edge. It certainly does not have the same complexity for memory mngmnt

4) TCO — PHPs ease of use is a double edged sword — you need to know a lot about Java just to get a program running, but the world and his dog think they can write good code in PHP. IME its more difficult to find competent PHP programmers than Java programmers.

IMHO if you know java, use JPA.

If you want to learn something new and fast prototyping, use python/django.

Replace the word Hibernate by JPA, as you should look at the API and not at one of the specific implementations.

For me this comes down to performance. When you look at PHP it has certainly been deployed on extremely large platforms (Facebook used it almost exclusively at the beginning), but in general it is used on smaller platforms. Java, for me, when you look at it’s scalability benefits is superior, but only when you know you’re going to be scaling.

Understanding the underlying life cycle of a request is very important. That is, knowing what a Java container is and how a Tomcat server runs helped me understand tremendously the performance implications.

Читайте также:  Css display img center

Don’t try to choose one over the other over single attributes such as «ease of coding» or «database connectivity»- they are different enough that by focusing on just a couple of «important» things you’ll be essentially selecting based off of biased information. That is, PHP makes it easier to connect to a DB if you look at them on a surface level- «Ugh! I have to install a JDBC, wtf is that. «, etc- but that’s the lazy man’s excuse. There is nothing Java can’t do that PHP can (that I’m aware of).

For me the question is how do you realistically (Read: realistically) see your application working- do you plan on getting thousands of visits per hour or are you talking a hundred hits a day like the grand majority of the little projects out there?

The benefits of PHP on smaller projects, particularly for the programmer that doesn’t fully grasp OOP architecture are enormous- but don’t get lazy and just take PHP because it’s easier out of the box. Java is extremely powerful and simply by learning it can teach you more than you realized you didn’t know about OOP and good programming practices in general (if you come from the self-taught realm like I do).

Basically, I’d say analyze your estimated project load plus ramp-up time if you have to learn one or the other, gauge your efficiency and scalability requirements, keep asking questions, and then decide which platform is better.

Источник

Что выбрать в 2021 году? Java или PHP?

Что выбрать в 2021 году? Java или PHP? главное изображение

Около 80% компаний в мире используют PHP для создания своих веб-приложений. Один из самых сложных вопросов для предпринимателя, который хочет открыть собственный стартап — какой язык программирования выбрать для своего проекта?

Выбор языка для своего проекта зависит напрямую от потребностей, бюджета и других параметров. Очевидно, что PHP больше всего подходит для разработки сайтов, но на самом деле и Java имеет целый ряд преимуществ и недостатков.

Я начну эту статью с нескольких интересных фактов о PHP:

— Гиганты электронной коммерции, такие как Amazon, Facebook и Wikipedia, заложили основу с помощью PHP, и до сих пор 80% из 10 млн веб-сайтов используют PHP. — С точки зрения бизнеса, особенно для вашего собственного стартапа, наем PHP-разработчика дешевле, чем Java-разработчика. — Популярные PHP-фреймворки, такие как Symphony и Laravel, чрезвычайно мощны и ускоряют процесс разработки веб-приложений.

Читайте также:  Наш первый сайт

Проще говоря, PHP был создан для интернета. Все основные CMS созданы с использованием PHP — сюда относятся Shopify, Opencart, WooCommerce, Magento, Drupal и Joomla.

С другой стороны Java — это клиентский язык, который более гибок для использования настольных приложений, вместе с серверным языком. Java — это объектно ориентированный язык программирования высокого уровня, который компилируется в байт-код и запускается на JVM.

PHP — это интерпретируемый язык, который компилируется в байт-код, а затем интерпретируется механизмом выполнения. Следовательно, с точки зрения безопасности памяти, Java безопаснее, поскольку защищает вашу систему от атак и ошибок. Поэтому, когда речь заходит о безопасности, конечно выбор падает на Java. +1 балл к java.

PHP анализирует файл и вводит поток для каждого вызова. В PHP нет процесса компиляции. Однако в модели CGI компиляция не имеет смысла. В то время как Java ранее описывалась как медленная, JVM сильно оптимизирована для скорости: только во времени компиляции. Java компилирует файлы JSP и горячие точки JIT аксиоматически.

Другими словами: PHP — это инструмент сценариев на стороне сервера с открытым исходным кодом, широко используемый для разработки отзывчивых порталов, тогда как Java — это язык программирования на стороне клиента, который в основном используется для сборки.

Сравнение дизайна

С точки зрения дизайна и архитектуры Java — это компилируемый язык, который быстрее PHP. Тем не менее, когда мы применяем оба языка на практике, PHP оказывается быстрее, чем Java в Интернете. PHP разработан для Интернета и представляет собой наиболее продвинутый, основной и серверный контент. И здесь PHP опережает JAVA, потому что фреймворки PHP предназначены для корпоративной сети. +1 в пользу PHP.

Что лучше выбрать для разработки веб-приложения

Оба они являются довольно старыми языками, но Java немного опережает PHP, предоставляя инструменты отладки и более богатый набор API.

Короче говоря, выбор между Java и PHP полностью зависит от требований вашего проекта. И Java, и PHP, используются для разработки специального программного обеспечения, включая веб-разработку и разработку веб-приложений. Но очень немногие стартапы предпочитают полагаться на Java.

Например, PHP Laravel широко используется для стартапов. Лишь небольшой процент современных веб-стартапов использует Java. Оба веб-решения одинаково важны и играют важную роль. PHP лучше подходит для небольших приложений, а Java лучше подходит для крупных веб-приложений.

Источник

Оцените статью