• 0

Java or php?


Question

Recommended Posts

  • 0
9 minutes ago, 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.

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
1 minute ago, 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).

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.7.2016 at 6:46 AM, Angel78 said:

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

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
1 hour ago, 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.

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
39 minutes ago, 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?

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

  • 0
3 hours ago, 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.

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
26 minutes ago, 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.

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

  • 0
19 minutes ago, adrynalyne said:

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

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

  • 0
1 hour ago, 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.

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
11 minutes ago, 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)

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

Edited by adrynalyne
  • 0
28 minutes ago, 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)

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
1 hour ago, adrynalyne said:

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

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
4 hours ago, 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.

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
9 hours ago, Fahim S. said:

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

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 2016-07-13 at 6:39 AM, 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...

"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

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.

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

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
9 hours ago, n_K said:

Lol right...

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

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
6 hours ago, 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.

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
7 hours ago, 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.

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

    • Microsoft confirms Windows 11 26H2 to finally get one of the most requested features by Sayan Sen This past week Microsoft officially confirmed Windows 11 version 26H2 with the latest build, 26300.8697, for testing in the experimental Insider channel. The company also published more details about it mainly directed towards IT admins and system admins. Essentially version 26H2 will be delivered via an enablement package (eKB) over Windows 11 25H2. If you are wondering about some of the upcoming features in the next Windows version, one of them is certainly very interesting as Microsoft has confirmed it is finally bringing one of the most overwhelmingly requested features ever. March Rogers, the Partner Director of Design at Microsoft, recently highlighted some of the Search improvements that the company is testing, and during the interaction with users on X where he posted it, Rogers also confirmed that the company is working on disabling web search results inside Search. This is something which many users find quite annoying as Windows would often serve them links to Bing which it feels could be more helpful rather than bringing up the actual object or app the user may be searching for on their PC. Finally though the company is prioritizing local file search over the web. However the feature could not be disabled for many users as not all new features are immediately rolled out to everyone. Image via phantomofearth (X) Windows enthusiast phantomofearth who likes to dig deep into new builds uncovered the IDs you will need to enable these features. Using the following feature IDs the new Search-related features landing in Windows 11 26H2 can be used. Follow the steps below to enable the new Search experience on Windows 11 build 26300.8697: Download ViveTool from GitHub and unpack the files in a convenient and easy-to-find folder. Press Win + X and select Terminal (Admin). Switch Windows Terminal to the Command Prompt profile with the Ctrl + Shift + 2 shortcut or by clicking the arrow-down button at the top of the window. Navigate to the folder containing the ViveTool files with the CD command. For example, if you have placed ViveTool in C:\Vive, type CD C:\Vive. Type vivetool /enable /id: and press Enter. Restart your computer. If you change your mind and want to restore, repeat the steps above and replace /enable with /disable in the commands on steps 5 and 6. Delightedly and perhaps also expectedly, once you disable web search and other such bloat, the Windows 11 Search is said to get snappier as remarked by another Windows enthusiast Xeno.
    • Makes me think of Family Guy - "Carl Sagan's Cosmos... edited for Rednecks" 🤣 https://www.youtube.com/watch?v=Ljt5iESYA7k&t=2s
    • Microsoft PC Manager 3.21.7.0 (Offline Installer) by Razvan Serea With Microsoft PC Manager, users can easily perform basic computer maintenance and enhance the speed of their devices with just one click. This app offers a range of features, including disk cleanup, startup app management, virus scanning, Windows Update checks, process monitoring, and storage management. Microsoft PC Manager key features: Storage Manager- easily uninstall infrequently used apps, manage large files, perform a cleanup, and set up Storage Sense to automatically clear temporary files. Health Checkup feature -scans for potential problems, viruses, and startup programs to turn off. It helps you identify unnecessary items to remove, optimizing your system's performance. Pop-up Management - block pop-up windows from appearing in apps. Windows Update - scans your system for any pending updates. Startup Apps - enable or disable startup apps on your PC, allowing you to optimize your system's startup performance. Browser Protection - rest assured that harmful programs cannot alter your default browser. Also enables you to change your default browser. Process Management - allows you to conveniently terminate any active process, ensuring optimal system performance and resource utilization. Anti-virus protection - Fully integrated with Windows Security. Safeguard your PC anytime. Quick Steps: Download Microsoft PC Manager Offline Installer (APPX/MSIX) with Adguard Adguard serves as a third-party online service, offering a user-friendly method for directly downloading appx, appxbundle, and msixbundle files from the Microsoft Store. Official download links will be generated for both the app's various versions and its dependency packages. How to download Microsoft PC Manager Offline Installer (APPX/MSIX) 1. Initially, you must find the app URL within the Microsoft Store. Access the Microsoft Store via your browser and search for "Microsoft PC Manager". Once located, copy the app URL, which includes the product ID, either from the address bar or from the provided link below. https://apps.microsoft.com/detail/9PM860492SZD 2. Now paste the app URL into the designated area, then click the check mark button to produce a direct download link. 3. To download, right-click the relevant link and select “Save link as…” from your browser's menu. Occasionally, Microsoft Edge may flag the download as insecure. In such cases, consider utilizing alternative browsers such as Google Chrome or Firefox to successfully complete the download. Microsoft PC Manager is a completely free tool optimized exclusively for use on Windows 10 (19042.0 and above) and Windows 11. Download: Microsoft PC Manager 3.21.7.0 | from Microsoft Store View: Microsoft PC Manager Home Page | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • jspaint is a lot better, if you like the classic mspaint experience and hate the new bloated Paint.
    • Amazon takes hundreds of dollars off its Kindle readers ahead Prime Day by Taras Buria Ahead of its Prime Day, Amazon brought its Kindle readers to all-time low prices, allowing you to save on various bundles across the entire lineup, from the most affordable Kindle to the flagship Scribe and its color-enabled variant. Kindle Essentials Bundle - $108.97 | 33% off This 6-inch Kindle is a portable reader with a front light, a brighter E-Ink display, and up to 6 weeks on a single charge. The bundle includes a protective case and a charger, so that you have everything you need for comfortable reading. Kindle Paperwhite Bundle - $154.98 | 45% off Kindle Colorsoft Bundle - $169.98 | 48% off The latest Paperwite is a 7-inch reader that features significantly faster page-turning, wireless charging, an ambient light sensor, 32GB of storage, and up to 12 weeks on a single charge. Right now, the bundle with a sling bag makes the Paperwhite 25% cheaper than the non-bundle variant. The same bundle is available for the Colorsoft version with a colorful E-Ink display. Kindle Scribe 32GB Bundle - $444.97 | 27% off Kindle Scribe Colorsoft 64GB Bundle - $574.97 | 27% off The Scribe is the biggest, flagship Kindle. It has an 11-inch texturized display with a stylus support, with a big emphasis on the note-taking experience. The built-in notebook has AI-assisted features for search, refinements, summarization, and more. The Scribe comes with 32GB of storage, and the bundle gets you a case, a stylus, and a protective case. Like with the Paperwhite, there is a Colorsoft version, which is also available with a massive discount. Note: These deals are available to Prime members only. If you do not have Prime, you can sign up using one of the links below. Good to know This Amazon deal is U.S. specific, and not available in other regions unless specified. We only use first-party seller links (at the time of article publishing); ensure that you purchase from a first-party seller link only. Check out Today's Deals on Amazon | or our recent tech deals. Become a Prime member (for Students or SNAP) via Neowin Get Prime Access - Prime for half price (for qualifying Medicaid, EBT, SNAP) Subscribe to Prime Video, Audible Plus, Music Unlimited or Kindle Unlimited via Neowin As an Amazon Associate, we earn from qualifying purchases.
  • Recent Achievements

    • Dedicated
      Almohandis earned a badge
      Dedicated
    • Dedicated
      JuvenileDelinquent earned a badge
      Dedicated
    • First Post
      DrWankel earned a badge
      First Post
    • Reacting Well
      DrWankel earned a badge
      Reacting Well
    • Week One Done
      Supreme Spray LV earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      505
    2. 2
      +Edouard
      174
    3. 3
      PsYcHoKiLLa
      84
    4. 4
      Steven P.
      76
    5. 5
      Michael Scrip
      76
  • Tell a friend

    Love Neowin? Tell a friend!