• 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

Java vs PHP

 
Ranch Hand
Posts: 1402
3
Netbeans IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

i would like to know which are the main benefits that Java offers over Php when building an online application with a lot of users, a big database and concurrent queries.

Do you think that Mysql is a good fit when there lots of users....

Any comment?

Regards, Isaac

 
Greenhorn
Posts: 20
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes,MYSQL is good and powerful database which can be used to handle application with many users.

Java is much more powerful and widely used over internet and also it has java database capability by using JDBC Application programming interface(API).
Java has many features like:

1)Platform independent
2)Distributed and simple
3)Secure and robust
4)Object oriented.

For more features refer following link:
Features of java

PHP (Hypertext preprocessor) Very simpler and easier than JAVA.
There are inbuilt methods available to connect and retrieve data from Databases like Mysql etc. You will get code online available.

So to develop the application with mysql,go for PHP language as it is easier and simpler than JAVA.
 
Angus Ferguson
Ranch Hand
Posts: 1402
3
Netbeans IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Many thanks, but which benefits do you think I can get in the long run when using Java. For example less crushes when thousands of concurrent users??
 
Saloon Keeper
Posts: 27752
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
PHP is good for quick-and-dirty apps, although some very elaborate systems (Drupal, WordPress, and many others) have been built in PHP.

Java is not good for quick-and-dirty. It requires a lot more work to get things done - in fact, just to get set up. However, you do get some benefits.

First and foremost, you get Java's designed-in security features. Yes, Java has taken some criticism on security, but that's when it's used to execute applets. Java on the server has a much better security record. PHP, on the other hand, has struggled for years with security issues.

Java also has a rich set of tools and add-ons. Java database communications are almost always done via JDBC drivers, and that means that Java code for one brand and version of a database doesn't require - on average - much modification to run on another database. Use of an ORM system can provide further benefits, both in code portability and in performance. PHP originally came with a different set of functions for every different brand of database, meaning that considerable code rewriting was often required. Even today, there's really not as much of a unified approach to database code in PHP as one would hope.

One area where PHP is fundamentally different is in the Separation of Concerns. PHP, like Microsoft's ASP, was designed with the idea that there was no separate Model, View and Controller. MVC, however, became the de facto standard precisely because having these 3 very different types of functions all scrambled together made things hard to design, debug, and maintain. Most Java web frameworks make very clear distinctions between these functions (for example, JSPs for View Templates and Servlets for Controllers). You can kind of do this in PHP, but it's not inherent, and if you don't strictly adhere to view-only PHP and code-only PHP "pages", you can get into real trouble as you scale up and/or hand off for maintenance.

Java is Object-Oriented. Attempts have been made to shift PHP into being object-oriented, but they've not been all that successful.

There's no "silver bullet" one-size-fits-all solution. I use PHP when I need something in a hurry. I use Java when I need something industrial-grade. Both have their advantages.

As far as databases go, MySQL Is certainly popular, but Java doesn't really favor any particular database system. I've done Java apps in Oracle, DB2, SQL Server, MySQL, PostgreSQL, SQLite, and probably 2 or 3 other SQL platforms I've forgotten. I've also got apps using MongoDB and Node4j.
 
Saloon Keeper
Posts: 15484
363
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A fun opinionated piece on why PHP is a horrible language: http://eev.ee/blog/2012/04/09/php-a-fractal-of-bad-design/

I can’t even say what’s wrong with PHP, because— okay. Imagine you have uh, a toolbox. A set of tools. Looks okay, standard stuff in there.

You pull out a screwdriver, and you see it’s one of those weird tri-headed things. Okay, well, that’s not very useful to you, but you guess it comes in handy sometimes.

You pull out the hammer, but to your dismay, it has the claw part on both sides. Still serviceable though, I mean, you can hit nails with the middle of the head holding it sideways.

You pull out the pliers, but they don’t have those serrated surfaces; it’s flat and smooth. That’s less useful, but it still turns bolts well enough, so whatever.

And on you go. Everything in the box is kind of weird and quirky, but maybe not enough to make it completely worthless. And there’s no clear problem with the set as a whole; it still has all the tools.

Now imagine you meet millions of carpenters using this toolbox who tell you “well hey what’s the problem with these tools? They’re all I’ve ever used and they work fine!” And the carpenters show you the houses they’ve built, where every room is a pentagon and the roof is upside-down. And you knock on the front door and it just collapses inwards and they all yell at you for breaking their door.

That’s what’s wrong with PHP.

 
Marshal
Posts: 79151
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is always somebody who will say rude things about whichever language you care to name.
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One of the biggest websites, Facebook, is built on PHP. But they've done some quite extreme things to make it perform well, such as build their own virtual machine. PHP is normally not compiled; it's interpreted. But Facebook made a compiler that compiles it to bytecode for their own VM (the same idea, but not the same bytecode as Java).

(I haven't programmed anything serious in PHP myself).
 
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Stephan van Hulst wrote:A fun opinionated piece on why PHP is a horrible language: http://eev.ee/blog/2012/04/09/php-a-fractal-of-bad-design/


Brilliant link (only just discovered it), which led me on to this one, which spreads the muck even wider.

(It's possibly worth noting that Java is the only language other than JavaScript to have subsections )

I always like being informed and having a laugh, so eat a cow.

Winston
 
Stephan van Hulst
Saloon Keeper
Posts: 15484
363
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Winston.

In regards to comments made earlier about PHP and MVC, I have to admit that after discovering Laravel, it's become a *lot* more fun to develop web-applications in PHP. Laravel is a great MVC framework that includes an IoC container and tonnes of other goodies. If you're serious about PHP development, I really urge you to look at it: https://laravel.com/
 
Drove my Chevy to the levee but the levee was dry. A wrung this tiny ad and it was still dry.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic