• 0

Java or php?


Question

Recommended Posts

  • 0
  On 13/07/2016 at 10:39, n_K said:

What a dimwitted view, let's just completely disregard that it runs one of the most popular and frequently visited sites on the internet... Sure PHP has it's problems but java isn't a perfect language either. I can spend 20 seconds making a quick script to do something in PHP which would take an hour to make in java, then there's java's ridiculous overhead: it is painfully slow and the memory usage is still a joke.

Expand  

Thank you. I'm glad that it not just me who also thinks that Java is slow and take much longer to create something (let alone more work involved).

  • 0
  On 13/07/2016 at 10:50, Danielx64 said:

Thank you. I'm glad that it not just me who also thinks that Java is slow and take much longer to create something (let alone more work involved).

Expand  

I'm not a fan of Java at all, but Java has been near native (performance is just slightly slower than C++ compiled code) in terms of speed for some time now.

I dislike Java because of the verbosity of the language and the amount of boilerpate it takes to achieve even the most simple of tasks.

 

I will still maintain that PHP is a horrible language, though.  If I wanted to create something quick, I would do it using Python well before I would even consider PHP.

  • 0
  On 12/07/2016 at 04:46, Angel78 said:

I'm planning to learn either java or php. Which language do you think will give better employment opportunity? 

Expand  

Don't learn a language just because of today's employment chances. They'll change any day.

By the way: PHP has always been a single-purpose language. Quickly set up a website on shared hosting? Chances are great that PHP will work. Good luck with { Java, Python, Ruby, COBOL, Assembler }.

  • 0
  On 13/07/2016 at 10:54, Fahim S. said:

I'm not a fan of Java at all, but Java has been near native (performance is just slightly slower than C++ compiled code) in terms of speed for some time now.

I dislike Java because of the verbosity of the language and the amount of boilerpate it takes to achieve even the most simple of tasks.

 

I will still maintain that PHP is a horrible language, though.  If I wanted to create something quick, I would do it using Python well before I would even consider PHP.

Expand  

I'd like to see proof of that because they've been claiming java is almost as fast as C++ for almost 20 years now, not even joking: http://www.javaworld.com/article/2076593/performance-tests-show-java-as-fast-as-c--.html?page=2. Anyone can tell when you're running a java program: slow startup and just general sluggishness of the whole thing. I hate to use minecraft as an example but just look at the specs required to run such a basic program that shouldn't be that demanding, then compare it to the original quake which will run fine on a 66Mhz original pentium?

  • 0
  On 13/07/2016 at 12:16, n_K said:

I'd like to see proof of that because they've been claiming java is almost as fast as C++ for almost 20 years now, not even joking: http://www.javaworld.com/article/2076593/performance-tests-show-java-as-fast-as-c--.html?page=2. Anyone can tell when you're running a java program: slow startup and just general sluggishness of the whole thing. I hate to use minecraft as an example but just look at the specs required to run such a basic program that shouldn't be that demanding, then compare it to the original quake which will run fine on a 66Mhz original pentium?

Expand  

What does Minecraft execution speed have to do with server side execution speed?

  • 0
  On 13/07/2016 at 10:39, n_K said:

What a dimwitted view, let's just completely disregard that it runs one of the most popular and frequently visited sites on the internet... Sure PHP has it's problems but java isn't a perfect language either. I can spend 20 seconds making a quick script to do something in PHP which would take an hour to make in java, then there's java's ridiculous overhead: it is painfully slow and the memory usage is still a joke.

Expand  

Dynamically typed languages are great for writing quick scripts. It's not surprising that it's easier to knock up scripts in PHP than in Java. However, if you're building large software, you want more safety. I'd rather do a refactor in a Java codebase than in a PHP one. Facebook felt the need to create Hack, which, surprise surprise, is meant to provide more safety than vanilla PHP.

 

As for performance, when Facebook created Cassandra they didn't choose to write it in PHP. Want to guess what language they used? The JVM is performant enough that it is currently the most popular technology in big data. Modern implementations often pick Scala over Java (e.g. Apache Spark), but it's still the JVM underneath.

 

I've written a fair bit of both PHP and Java in my career. These days I tolerate Java. I'd rather write Scala, Swift or even JavaScript (ES2015 with Flow is surprisingly enjoyable). PHP, however, I stay away from.

  • 0

Yea, I think it depends on what you want to do.

If it were me, I'd probably go with JavaScript and Node.js. If you haven't programmed before, Java has a steep learning curve.

Neither Java or JavaScript is going away soon but you might get "up and running" faster with JavaScript and that will give you a good base to learn other languages when you need to.

  • 0
  On 13/07/2016 at 15:18, tompkin said:

Yea, I think it depends on what you want to do.

If it were me, I'd probably go with JavaScript and Node.js. If you haven't programmed before, Java has a steep learning curve.

Neither Java or JavaScript is going away soon but you might get "up and running" faster with JavaScript and that will give you a good base to learn other languages when you need to.

Expand  

Knowing both, i would say that JS has a far steeper learning curve than Java. 

  • 0
  On 13/07/2016 at 15:45, adrynalyne said:

Knowing both, i would say that JS has a far steeper learning curve than Java. 

Expand  

Agreed, but once you know it you can work on (web based) client and serverside code.

  • 0
  On 13/07/2016 at 15:02, vhane said:

Dynamically typed languages are great for writing quick scripts. It's not surprising that it's easier to knock up scripts in PHP than in Java. However, if you're building large software, you want more safety. I'd rather do a refactor in a Java codebase than in a PHP one. Facebook felt the need to create Hack, which, surprise surprise, is meant to provide more safety than vanilla PHP.

 

As for performance, when Facebook created Cassandra they didn't choose to write it in PHP. Want to guess what language they used? The JVM is performant enough that it is currently the most popular technology in big data. Modern implementations often pick Scala over Java (e.g. Apache Spark), but it's still the JVM underneath.

 

I've written a fair bit of both PHP and Java in my career. These days I tolerate Java. I'd rather write Scala, Swift or even JavaScript (ES2015 with Flow is surprisingly enjoyable). PHP, however, I stay away from.

Expand  

PHP has had optional strict typing support for years now http://php.net/manual/en/functions.arguments.php

Of course they didn't write a backend server in PHP, that's not what PHP was designed for. That would be like using PHP to render the interface for a desktop: it's probably possible, would anyone sane ever do it? No. Is that even remotely like PHP's intended purpose? No.

"What does Minecraft execution speed have to do with server side execution speed?"

It gives you an overall view of the performance, and the performance of java is nothing short of shite. Not to say native PHP is much better, I've personally found PHP faster (and there's multiple different execution engines which again can vastly improve performance) not to mention every time you change something you don't have to recompile it (hiphop-vm for example will automatically cache the bytecoded version on the fly and redo this if the file changes)

  • 0
  On 13/07/2016 at 16:06, n_K said:

PHP has had optional strict typing support for years now http://php.net/manual/en/functions.arguments.php

Of course they didn't write a backend server in PHP, that's not what PHP was designed for. That would be like using PHP to render the interface for a desktop: it's probably possible, would anyone sane ever do it? No. Is that even remotely like PHP's intended purpose? No.

"What does Minecraft execution speed have to do with server side execution speed?"

It gives you an overall view of the performance, and the performance of java is nothing short of shite. Not to say native PHP is much better, I've personally found PHP faster (and there's multiple different execution engines which again can vastly improve performance) not to mention every time you change something you don't have to recompile it (hiphop-vm for example will automatically cache the bytecoded version on the fly and redo this if the file changes)

Expand  

The performance of Java is largely limited to the JVM running it. 

Edited by adrynalyne
  • 0
  On 13/07/2016 at 16:06, n_K said:

PHP has had optional strict typing support for years now http://php.net/manual/en/functions.arguments.php

Of course they didn't write a backend server in PHP, that's not what PHP was designed for. That would be like using PHP to render the interface for a desktop: it's probably possible, would anyone sane ever do it? No. Is that even remotely like PHP's intended purpose? No.

"What does Minecraft execution speed have to do with server side execution speed?"

It gives you an overall view of the performance, and the performance of java is nothing short of shite. Not to say native PHP is much better, I've personally found PHP faster (and there's multiple different execution engines which again can vastly improve performance) not to mention every time you change something you don't have to recompile it (hiphop-vm for example will automatically cache the bytecoded version on the fly and redo this if the file changes)

Expand  

Benchmarks show that JVM performance is actually pretty good. Certainly significantly better than anything on the PHP side. In practice this isn't likely to matter though since PHP programs aren't usually written to be asynchronous.

  • 0
  On 13/07/2016 at 15:45, adrynalyne said:

Knowing both, i would say that JS has a far steeper learning curve than Java. 

Expand  

Indeed. Things have moved very fast in JavaScript land. Java code from 10 years ago looks pretty much the same as today. Modern JavaScript is totally different from the bad old days when poking the DOM with spaghetti jQuery code was the state of the art.

 

I wrote this function today and it occurred to me that it doesn't even look like JavaScript to me.

// Create a new immutable model object for the protobuf message type
export const fromProto = (protobufType: () => Object): Object => {
  // Rename keys to be the same as what is defined in the .proto file that generated the imported JavaScript
  const toOriginalName = (key: string, value: any): string => {
    if (key.length > 4 && key.endsWith("List")) {
      return key.slice(0, -4)
    }
    return key
  }
  return u.freeze(fp.mapKeys(toOriginalName)(new protobufType().toObject()))
}

 

  • Like 2
  • 0
  On 13/07/2016 at 18:06, tompkin said:

Gees, I didn't know that. I'll probably be steering clear of JS unless I'm forced to.

Expand  

It's good to know. It's just a different beasty from a object oriented language. 

  • 0
  On 13/07/2016 at 17:13, vhane said:

Benchmarks show that JVM performance is actually pretty good. Certainly significantly better than anything on the PHP side. In practice this isn't likely to matter though since PHP programs aren't usually written to be asynchronous.

Expand  

Found a few benchmarks but they're all mostly old except this one, and no, it shows java is significantly slower than PHP (native, not even using hhvm): https://blog.famzah.net/2016/02/09/cpp-vs-python-vs-perl-vs-php-performance-benchmark-2016/

  • 0
  On 13/07/2016 at 12:56, Fahim S. said:

What does Minecraft execution speed have to do with server side execution speed?

Expand  

Java client side JVM is similar enough to the server JVM that benchmarks on the client would not be off by very much.

 

Minecraft runs on Java and yes that is a great example of the alice in wonderland thinking that is like a theme for this forum thread. Somehow, comparing Quake which is a 2.5D software BSP based dungeon game to an open world sandbox voxel based engine will provide insight on which web technology is better to learn!

 

To anyone who thinks Minecraft is somehow "trivial", it is doing something very hard. There are no voxel engines that work significantly better in some other programming language. Once you hit a GPU bottleneck it doesn't matter how you feed it! (Although all sorts of clever stuff goes on there as well)

 

  • 0

A lot of factors go into choosing programming technology and it is often additionally complicated because you don't get to start with a clean slate.

 

Some of the criteria for technology selection presented so far have been ROTFLOL

 

But if selecting the best bet for a career, then the performance and other factors of technical aesthetics just don't matter.

 

http://trends.builtwith.com/framework

 

PHP - 27%

ASP.NET - 21%

Java - 9%

Ruby - 9%

 

There are many ways to slice the data presented and really there is a lot of local variation in any career market so look at local ads and call up recruiters to get an idea.

 

That all being said, programming computers is HARD. And if you have to go to a forum and ask this question, the next question to ask yourself, is it something you crave? Famous Broadway Choreographer once said "I don't want people who want to dance, I want people who NEED to dance."

 

  • 0
  On 13/07/2016 at 10:39, n_K said:

What a dimwitted view, let's just completely disregard that it runs one of the most popular and frequently visited sites on the internet...

Expand  

"The reason Facebook hasn't migrated away from PHP is because it has incumbent inertia (it's what's there) and Facebook's engineers have managed to work around many of its flaws through a combination of patches at all levels of the stack and excellent internal discipline via code convention and style - the worst attributes of the language are avoided and coding style is rigidly enforced through a fairly tight culture of code review (failing to adhere to the style and "going cowboy" by writing sloppy code results in pitiless mockery by one's peers). (...)

There is also a lot of industry precedent indicating that re-writing an entire codebase in another language is usually one of the worst things you can do, so at all levels there is a reluctance to do that. The preferred strategy is to write new components in a de-coupled manner using a better language of choice (C++, python, Erlang, Java, etc); this is easily facilitated by Facebook's early development of thrift, an efficient multi-language RPC framework. This also helps avoid the worst effects of PHP: it can be totally avoided in subcomponents where the language is grossly-unsuitable. The broad effect is that the overall codebase slowly evolves away from depending as heavily on PHP, with the components that are still in PHP being written in tightly-controlled, disciplined ways by veteran members of the staff." http://www.zdnet.com/article/why-facebook-hasnt-ditched-php/

 

  Quote

Sure PHP has it's problems but java isn't a perfect language either. I can spend 20 seconds making a quick script to do something in PHP which would take an hour to make in java

Expand  

If you write anything large-scale then the syntactic overhead is quickly dwarfed by the advantages (maintainability, modularity, etc) of using a more strictly typed and better designed language. Sure PHP is ok for hacking small things quickly; today's web of rich applications has evolved well beyond that however and PHP is no longer an appropriate tool for handling that level of complexity.

 

  Quote

then there's java's ridiculous overhead: it is painfully slow and the memory usage is still a joke.

Expand  

Hum... this is likely spoken from ignorance, or perhaps "Minecraft is slow" meme. Java is highly optimized for server-side performance and uses state-of-the-art VM and GC technology.

  • 0
  On 14/07/2016 at 13:24, Andre S. said:

Hum... this is likely spoken from ignorance, or perhaps "Minecraft is slow" meme. Java is highly optimized for server-side performance and uses state-of-the-art VM and GC technology.

Expand  

Lol right...

mem-use.png

  • 0

Java is a better language to start learning anyway. Writing php shouldn't be an issue for a good java programmer. Writing java as a php programmer on the other hand...

 

I started with php and I regret not starting with java or C#. Starting with php made me a lazy programmer that just copy pasted snippets of code without knowing how it works... It took a while to learn proper programming.

  • 0
  On 14/07/2016 at 15:45, n_K said:

Lol right...

*posts graph from http://cppcms.com/wikipp/en/page/benchmarks_all*

Expand  

You're not leading the discussion anywhere. What exactly is being measured here? "Memory" could be many things, many of them meaningless (is it private bytes? reserved memory?) The JVM pre-allocate huge chunks of memory because it manages memory itself; this is a very effective strategy in general and especially for server-side programs.  What version of Tomcat is used? Is the app representative of a real-world scenario? All this benchmark could mean is that some version of Tomcat pre-allocates about 100MB on app startup, for all we know.

  • 0
  On 15/07/2016 at 00:55, Andre S. said:

You're not leading the discussion anywhere. What exactly is being measured here? "Memory" could be many things, many of them meaningless (is it private bytes? reserved memory?) The JVM pre-allocate huge chunks of memory because it manages memory itself; this is a very effective strategy in general and especially for server-side programs.  What version of Tomcat is used? Is the app representative of a real-world scenario? All this benchmark could mean is that some version of Tomcat pre-allocates about 100MB on app startup, for all we know.

Expand  

If you want to see how bad it is with memory management go and get the trial vcentre centos virtual machine and half the RAM (It's either 8GB or 16GB by default) and watch it fall over - it can't adapt at all to the lower memory constraint and it isn't even doing much, it just sits idle until a server is added but woah that's too much for to it apparently.

  • 0
  On 15/07/2016 at 07:05, n_K said:

If you want to see how bad it is with memory management go and get the trial vcentre centos virtual machine and half the RAM (It's either 8GB or 16GB by default) and watch it fall over - it can't adapt at all to the lower memory constraint and it isn't even doing much, it just sits idle until a server is added but woah that's too much for to it apparently.

Expand  

If Java had serious memory usage issues then I would expect to easily find information about this such as stackoverflow questions, blogs discussing workarounds, github issues, etc. If you have sources to share then please do, otherwise I'm not really willing to keep trying to track down what you're referring to, or run experiments by myself.

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • NWinfo 1.4.2 by Razvan Serea NWinfo is a lightweight tool designed to give a quick look at your computer's key details, from hardware to software specs, without any fuss. You don't need to install it; just download, run, and see everything you need on one screen. It displays essential info about your CPU, memory, disk drives, network, and even the system's operating details. Since it’s portable, you can carry NWinfo on a USB stick and use it on any Windows machine, making it a handy tool for both tech enthusiasts and troubleshooting. NWinfo key features: Lightweight and portable—no installation required Simple, user-friendly interface for easy navigation Displays detailed CPU information, including model and speed Shows memory (RAM) specifications and usage Provides disk information, including storage capacity and usage Lists network adapters and IP addresses Displays motherboard details, including model and manufacturer Shows system uptime and operating system version Detects graphics card information and driver details Includes battery status for laptops Provides monitor specifications, including resolution and refresh rate Displays BIOS version and other firmware details Offers a summary of active processes and services Generates detailed logs for sharing or troubleshooting Open-source and free, allowing for customization and community support NWinfo 1.4.2 changelog: Add Polish language support Add support for EFI key options Refactor EFI boot menu enumeration Add FACS table parsing Add SMBIOS support for types 37-39 and 42 Note: NWinfo might trigger a few antivirus alerts or show up with warnings on VirusTotal due to its low download frequency. If you have any concerns, you're welcome to review the full source code available on the developer’s repository. Download: NWinfo 1.4.2 | 2.2 MB (Open Source) View: NWinfo Website | NWinfo@GitHub | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • TSMC's trade secret meltdown exposed by internal monitoring by Paul Hill Taiwan Semiconductor Manufacturing Co. (TSMC) has detected unauthorized activities using “comprehensive and robust monitoring mechanisms”. The chip maker said that it believes trade secrets have been leaked as a result and has taken disciplinary action against the personnel involved and initiated legal proceedings explaining that it has a zero-tolerance policy for compromising trade secrets or harming company interests. As the case is under judicial review, it is unable to provide further details about the case. While TSMC is not speaking on the matter, the leak allegedly involves critical proprietary information on 2-nanometer chip development and production. Production of the 2-nanometer chip is among the leading-edge manufacturing processes in the semiconductor industry right now, which explains why an actor would want to steal related information. TSMC is one of the world’s leading chip makers, with companies like Apple and Nvidia being among its clients. It is also the world’s biggest chip maker and among the most advanced. After this leak, the company has reaffirmed its commitment to safeguarding its core business competitiveness and the shared interests of all its employees. The jury is still out on the motivations behind the leaking of the trade secrets, but those involved have been fired, according to Nikkei. TSMC, similarly to Nvidia, has found itself in the geopolitical struggle between China and the US in recent years. As you likely know, the last several years have seen America really go hard after Huawei over national security concerns, and in more recent years, the US has sought to limit China’s access to AI hardware. Earlier this year, Neowin reported that TSMC faces a $1 billion fine for breaching export controls against Huawei. TSMC had made a chip for the Chinese firm Sophgo, but that same chip was later discovered to be used in Huawei's high-end Ascend 910B AI processor. This discovery was made by TechInsights, a Canadian company, and as a result, TSMC stopped shipments to Sophgo, and the US added Sophgo to its blacklist to prevent further circumvention along that route. It will certainly be fascinating to learn more about the motivation for the theft of trade secrets as more information comes to light. Via: CNBC | Image via Depositphotos.com
    • Apple will probably reciprocate by advertising their home products and mocking Google Home's continued debacles.
    • Files still rely on classic windows indexing rather than methods that 'everything' uses. So search is suboptimal. The compression algorithm list is really lacking not comparable to winrar, 7zip and peazip... The gui looks nice, but windhawk is a thing. I don't understand what files brings in 2025. Just a less efficient, less customizable file explorer. https://i.imgur.com/afVKXBj.png
  • Recent Achievements

    • Week One Done
      Zojaji earned a badge
      Week One Done
    • First Post
      Soeaker4thedead earned a badge
      First Post
    • First Post
      kryptickid earned a badge
      First Post
    • First Post
      Nemesis-IV earned a badge
      First Post
    • First Post
      Aidan Helfrich earned a badge
      First Post
  • Popular Contributors

    1. 1
      +primortal
      759
    2. 2
      ATLien_0
      187
    3. 3
      +FloatingFatMan
      151
    4. 4
      Xenon
      117
    5. 5
      wakjak
      113
  • Tell a friend

    Love Neowin? Tell a friend!