• 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

    • Shouldn't using "High Performance" mode prevent c-states from initializing? Maybe AMD hasn't built a proper power plan for their x3d processors like they used to for their ryzen chips.
    • Vivetool also has a GUI. Literally took me three clicks to enable this from there.
    • Microsoft Weekly: OneDrive horror stories, ramblings about Start menu, and more by Taras Buria This week's news recap is here, delivering you a roundup of the most important Microsoft stories, including a bunch of odd stuff and bugs in Windows, OneDrive horror stories, ramblings about the Start menu, a couple of new Windows 11 preview builds, important news from AMD, and a lot more. Quick links: Windows 10 and 11 Windows Insider Program Updates are available Reviews are in Gaming news Windows 11 and Windows 10 Here, we talk about everything happening around Microsoft's latest operating system in the Stable channel and preview builds: new features, removed features, controversies, bugs, interesting findings, and more. And, of course, you may find a word or two about older versions. Microsoft released a new out-of-band update to fix boot issues on certain Surface devices. The company announced certain Windows 365 updates, such as VBS and HVCI support (by default) and app provisioning in Windows 365 instead of entire cloud PCs. Microsoft is also removing legacy drivers from Windows Update in a new "strategic move." This is the default Windows 365 wallpaper On the negative side, we have the latest Patch Tuesday updates breaking the DHCP Server in all Windows Server editions. Also, there is some bad news for PC users with Windows Hello cameras: after the April 2025 Patch Tuesday updates, Windows Hello does not work in the dark. The change was quietly introduced to address security issues. Windows Goodbye That is not all, though. As it turned out, solid-state drives from WD could still block your computer from installing Windows 11 version 24H2, which was released in October 2024. Also, Microsoft's Family Safety feature is now blocking Chrome, for some reason. Here is an editorial from Usama Jawad (welcome back) about how, four years after the initial release, Windows 11 still does not offer strong enough reasons to upgrade from the outgoing Windows 10. Also, Usama shared his thoughts about the Start menu and why he had stopped caring about its changes altogether. Speaking of the Start menu, check out our overview of what users wanted from Microsoft and what the company delivered in the redesigned Start menu, which was recently announced. Windows Insider Program Here is what Microsoft released for Windows Insiders this week: Builds Canary Channel Build 27881 This week's Canary build introduced context menu improvements, new accessibility features, Settings app tweaks, and more. Dev Channel Nothing in the Dev Channel this week Beta Channel Nothing in the Beta Channel this week Release Preview Channel Build 26100.4482 (KB5060829) This build improves File Explorer and search performance, adds some changes to default browser settings, and fixes multiple bugs. Some hidden stuff in the recent Windows 11 preview builds includes a new adaptive battery saver. This feature dynamically adapts battery saver mode according to your workflow, but in its current form, it is not fully operational. Even though Microsoft acknowledged its existence, the adaptive part still needs improvements. Another useful change in the recent builds is the return of a clock in the notification center. This time, however, Microsoft makes it more customizable, and you can toggle it on or off. Also, the company is moving more Control Panel bits to the Settings app and adding a rather unexpected customization feature that will let you select where system indicators (flyouts and sliders) appear on the screen. Microsoft started rolling out a new update for the Snipping Tool app. The latest release lets you save screen recordings as GIFs. Shortly after that, we posted a guide with a bit more detail about the feature. Updates are available This section covers software, firmware, and other notable updates (released and coming soon) from Microsoft and third parties, delivering new features, security fixes, improvements, patches, and more. Microsoft is working on a Dashboard redesign for PowerToys. Developers published an early look at what is coming to the app in future updates, revealing a better-organized page with quick links, a shortcut overview, and a list of available modules. This week's Office updates are rather mixed. OneDrive, for one, is having problems finding files. Microsoft acknowledged the issue, which affects users on Windows, iOS, Android, and the web. Unfortunately, that is not the only negative story about OneDrive. A new report from a frustrated user revealed a scary tale of Microsoft locking them out of an account full of invaluable content. Outlook also has some issues, this time, with opening emails, and Microsoft 365 will soon disable outdated protocols for file access. Finally, Copilot in Excel received a major update for context awareness, which made the assistant more useful when answering questions about data. This week's browser updates include several releases. Firefox announced a new method for pinning and unpinning tabs. It is now available for testing in the Nightly channel. Microsoft Edge was updated with fixes for two security vulnerabilities (high severity) originating from Chromium. Finally, here is this week's Microsoft 365 Roadmap with an overview of all the new stuff that Microsoft added to the website. Here are other updates and releases you may find interesting: Microsoft 365 security in the spotlight after Washington Post hack. Microsoft expands European sovereign cloud offerings with new data and key controls. Microsoft Defender XDR received TITAN-powered Security Copilot recommendations. Microsoft reportedly plans more layoffs. Watchdog found Microsoft guilty of confusing advertising when it comes to Copilot. Here are the latest drivers and firmware updates released this week: AMD released a new chipset driver for Ryzen processors under version 7.06.02.123, which followed a security update for TPM-Pluton. Nvidia 576.80 WHQL with fixes for the RTX 5090 FE, new game support, and a long list of fixes. You can get some extra performance on certain AMD Ryzen chips with a simple system tweak. Surface Pro 11 and Surface Laptop 7 received big firmware updates with multiple fixes and improvements. Reviews are in Here is the hardware and software we reviewed this week This week, Steven Parker reviewed the TerraMaster D4 SSD, a palm-sized DAS with up to 32TB of storage that you can connect over USB4. This thing is rather impressive, and for a modest price tag, it delivers a tiny footprint, great looks, full RAID support in TOS 6, quick connection, and more. On the gaming side Learn about upcoming game releases, Xbox rumors, new hardware, software updates, freebies, deals, discounts, and more. AMD and Microsoft announced some big news this week. The two companies revealed a new multi-year partnership, which secures AMD as the future maker of chips for Xbox consoles and other hardware. Sarah Bond announced the partnership in a new video on the official Xbox media channels. Turn 10 Studios announced a new Forza Motorsport update. Update 21 brings IndyCar content, Career mode expansion, Featured Tours, new reward cars, and more. It is now available on Xbox and PC via the Microsoft Store and Steam. Minecraft is another Microsoft-owned game that received a big update this week. The long-anticipated graphics overhaul is finally here with directional lighting, volumetric fog, improved shadows, reflections, godrays, and a lot more. In addition, Mojang released Chase the Skies, the latest content drop, which adds happy ghasts, new music disks, a locator bar for players, environmental fog in the overworld, new background music, and all sorts of small gameplay changes. Microsoft announced new games for Game Pass. The latest additions include FBC: Firebreak, Crash Bandicoot 4: It's About Time, Start Trucker, Wildfrost, Rematch, Call of Duty: WWII, Rise of the Tomb Raider, and more. As usual, some games are leaving the subscription. Valve released a big update for the Steam overlay. The latest version introduced major upgrades to CPU and VRAM usage, temperatures, and other important metrics that you might want to track when playing games on your gaming rig. Deals and freebies Also, be sure to check out this week's Weekend PC Game Deals article, which features rhythm bundles, fishing festivals, DRM-free summer sales, and more. Other gaming news includes the following: Take-Two confirmed Borderlands 4 will not cost $80 for the base game. The Coalition expanded the Gears of War: Reloaded beta after its rocky start. Ara: History Untold 1.4 update delivered overhauls to AI, map generation, combat, and more. Star Citizen Alpha 4.2 update lands with radiation hazards, dynamic rain, and more. This link will take you to other issues of the Microsoft Weekly series. You can also support Neowin by registering a free member account or subscribing for extra member benefits, along with an ad-free tier option. Microsoft Weekly image background by steve_a_johnson on Pixabay
  • Recent Achievements

    • First Post
      Johnny Mrkvička earned a badge
      First Post
    • Week One Done
      viraltui earned a badge
      Week One Done
    • One Month Later
      serfegyed earned a badge
      One Month Later
    • Dedicated
      firey earned a badge
      Dedicated
    • Dedicated
      fettermanj earned a badge
      Dedicated
  • Popular Contributors

    1. 1
      +primortal
      635
    2. 2
      ATLien_0
      230
    3. 3
      Michael Scrip
      218
    4. 4
      Xenon
      149
    5. 5
      Steven P.
      140
  • Tell a friend

    Love Neowin? Tell a friend!