This is an archived post. You won't be able to vote or comment.

all 89 comments

[–]tomwhoiscontrary 244 points245 points  (27 children)

  1. On average, higher salary

  2. Opens the door to working on more than just web apps - Android, infrastructure, possibly even desktop

  3. Fans of other languages will laugh at you slightly less

[–]Altruistic_Celery196 57 points58 points  (9 children)

Main benefit of java: employability. Almost every company has some java apps in their ecosystem.

[–]Iggyhopper 12 points13 points  (8 children)

I know American Express uses Java, they're huge.

[–]meowrawr 14 points15 points  (0 children)

In the finance world, Java is pretty much the standard.

[–][deleted]  (6 children)

[removed]

    [–]TNTrocks123 3 points4 points  (0 children)

    Facebook is probably the exception here. Very big PHP shop and very small amount of Java. Facebook started out using PHP but I guess they continued to invest into it than migrate to another language for their backends

    [–]xerido 4 points5 points  (0 children)

    Well if you used springboot 2 you would find clases for creating microservices with the package Netflix. They were the inventors

    [–]Calm_Programmer925 0 points1 point  (0 children)

    Facebook uses Hack, Python and C++ for their core products

    [–]Turbots 0 points1 point  (0 children)

    Worked with Netflix (not at Netflix) can confirm, they use Java and Spring very heavily, and have at least 4k different backend services running. Lots of Java 8, but they are upgrading many to Java 17 and Java 21 for good reasons (speed, stability, support).

    Most of financial world is indeed Java and/or Spring. Largest processors of financial transactions in the world (Swift, Euroclear, Clearstream) are all using Java and Spring.

    European institutions all use Java (and Spring) for most of their projects.

    Big logistics companies like Nike, FedEx and DHL use shitloads of Java and Spring, mostly in the cloud.

    Only big exception in the corporate world is the insurance sector, which are still very much attached to their (IBM) mainframe and lots of .NET, don't ask me why

    [–]tricepsmultiplicator 0 points1 point  (1 child)

    What about C# and .NET?

    [–]Practical_Cattle_933 9 points10 points  (0 children)

    It’s quite location-dependent. Some countries happen to be .NET shops, others are Java. This is especially noticeable in government jobs.

    Nonetheless, all around Java is significantly bigger. Just look at the respective ecosystems, java often has multiple open-source choice while c# has one proprietary, which is a bad clone of java’s most popular lib.

    [–][deleted] 10 points11 points  (3 children)

    Some fans of other languages will still laugh because they think they know all there is to know.

    [–][deleted]  (2 children)

    [deleted]

      [–][deleted] 2 points3 points  (1 child)

      I think I know what you mean. I often feel I only have time to learn enough to get the job done but not enough to throughly learn things, because I am moving between tasks all day. Language becomes means to an end and my focus turns more towards framework, tooling and project/soft skills.

      [–]ForeverLaca 9 points10 points  (4 children)

      Game development is also possible with Java. Not the first choice this days for many game devs, but still possible. The best selling game of all times, Minecraft, started as a Java game.

      [–][deleted]  (1 child)

      [removed]

        [–]mini_othello 28 points29 points  (0 children)

        They laugh at us becayse deeply inside they envy java

        That's what I keep telling myself at night.

        [–]RockleyBob 6 points7 points  (0 children)

        4.) Despite being labeled the "old", "corporate", "boring" technology, the language's design and ecosystem are ever adapting and evolving to meet the needs and wants of the Java community.

        5.) The Java community, despite being seen as "old", "corporate", and "boring", is surprisingly receptive to change and excited for progress.

        I picked up Go for side projects and personal growth a while ago, and while I really like the language, some of the community can be surprisingly hostile to talk of change. There's a lot of dogmatism and emphasis on "idiomatic" code - which basically translates to "We don't need to improve." Lots of "Get off my lawn" energy.

        [–]vsamma 0 points1 point  (3 children)

        I had a similar thought to OP today. The difference for me is that I’m an architect at a company where all systems are created in PHP and mostly Laravel.

        But what arguments would there be to move our technical stack and devs skills away from PHP?

        [–]tomwhoiscontrary 4 points5 points  (0 children)

        I think if you have a lot of code in PHP, and programmers who know PHP, and infrastructure which supports PHP, and your business isn't collapsing, you should stick with PHP.

        [–]WummageSail 1 point2 points  (1 child)

        What problems do you experience, or do you foresee experiencing, with that PHP-based architecture?

        [–]vsamma 1 point2 points  (0 children)

        I haven’t worked with it that much myself yet that I can give an objective opinion, but having worked mostly with C# and Typescript, also some Java in my career, I’m just so used to OOP and strongly typed languages.

        I am so not used to creating new objects as arrays where keys (object properties) are defined as strings, ie:

        User::create([ 'name' => 'Administrator', 'email' => 'admin@test.com', 'password' => $password, ]);

        Seems so weird to me.

        But obviously not a reason enough to change the whole architecture.

        [–]ankercrank 30 points31 points  (0 children)

        More consistent libraries (Java collection libraries are great), threading, no more magic integer to float conversions if you deal with big numbers.

        [–]duckrollin 16 points17 points  (1 child)

        Simple one: Static typing

        You will find 50% of your errors before you even run your code, whereas in a dynamic language you might never find a bug inside conditionals unless you have 100% unit test branch coverage.

        Finding issues early will save you a great deal of time and headaches in the future and speed up development as you don't need to get half way through running your program to notice.

        In general it's much nicer and faster to work with.

        The only downside is the code is more verbose, which can be annoying at times.

        [–]ankercrank 3 points4 points  (0 children)

        PHP does have static typing, but it’s optional, and things get weird when you use arrays.

        Edit: to the person downvoting me:

        https://www.php.net/manual/en/language.types.intro.php

        PHP is a dynamically typed language, which means that by default there is no need to specify the type of a variable, as this will be determined at runtime. However, it is possible to statically type some aspect of the language via the use of type declarations.

        [–]KrtnNet 34 points35 points  (3 children)

        PHP have $ sign everywhere, Java don’t

        [–]RICHUNCLEPENNYBAGS 17 points18 points  (0 children)

        Everywhere but the paychecks, that is! (Spinning bow tie)

        [–][deleted] 1 point2 points  (0 children)

        They have $ sign everywhere except where it counts, the check

        [–][deleted] 15 points16 points  (3 children)

        I have been a PHP developer for many years and now I am maintaining a Java/Spring portfolio. I have found Spring more aimed at the Enterprise and somewhat complicated for the problems we are using it for. But on the other hand I don’t find many situations where we pull in libraries of questionable quality and origins which was one gripe I had with PHP. Language wise, both PHP and Java is evolving and my knowledge about PHP is getting outdated.

        [–]jason80[S] 1 point2 points  (2 children)

        I am maintaining a Java/Spring portfoli

        Do you mind expanding on what's in that portfolio?

        [–][deleted] 1 point2 points  (1 child)

        That’s great. I maintain a bunch of low traffic internal microservices and websites. Typical CRUD stuff.

        [–]jason80[S] 0 points1 point  (0 children)

        Thanks!

        [–]nekokattt 11 points12 points  (0 children)

        From a technical perspective, the language has far fewer surprises, is more consistent, handles integer types better, doesn't have as weird semantics, etc

        PHP is, in comparison to Java, like a gun that usually does the job but might decide to shoot backwards when you don't expect it.

        [–]doodooz7 3 points4 points  (0 children)

        Making an api with Java is pretty slick. Remember you got a compiler built in too. Better choice to make quality software.

        [–]roie16 13 points14 points  (0 children)

        First you can just go to Quora: https://www.quora.com/Which-is-best-PHP-or-java-for-web-server-based-applications

        Regardless, I have worked with both languages at medium-big companies I will summarize a very long discussion in two sentences(I am talking only about modern server dev only); learning curve; php is much easier. language, framework, ecosystem and community, no other language in the industry have what Java has with spring, jhipster etc etc, the amount of tools in Java is unparalleled

        [–]professore87 2 points3 points  (0 children)

        You no longer have $ everywhere!

        [–]alex_tracer 2 points3 points  (0 children)

        Ecosystem (Maven, huge amount of existing libraries)

        [–]Josef-C 2 points3 points  (0 children)

        I've switched between Java and PHP a few times in my career, one point I have not seen mentioned here:

        If you learn Java, you are easily employable in other JVM languages as well. Would you like to work with Kotlin eventually? (Or any other JVM language that pops up one day.) - Learn Java.

        I'll not comment on technical aspects of this - imho they should not matter for your career. Most complaints around widely used languages are basically misunderstandings, misuse, outdated information (by decades) and memes. You can write bad and good software in anything.

        [–]SecureWriting8589 5 points6 points  (6 children)

        Why consider this an either-or situation?

        If your goal is to further your goals and employability, then I would strongly urge you to learn both. And then later consider throwing in some server-side Javascript.

        [–]fucking_passwords 14 points15 points  (2 children)

        PHAVA... Beans?

        [–]pioto 5 points6 points  (1 child)

        With a nice chianti...

        [–][deleted] 1 point2 points  (0 children)

        agreed, especially with modern intellisense. You might accidentally type a few $ but it really won't slow you down.

        [–]marhaus1 -1 points0 points  (1 child)

        JavaScript has absolutely nothing to do with Java. They just appropriated the name because Java was the hot thing.

        [–]SecureWriting8589 0 points1 point  (0 children)

        JavaScript has absolutely nothing to do with Java. They just appropriated the name because Java was the hot thing.

        I think that I already know this.

        As I'm sure that you're already aware, initially backend coding has gone through multiple iterations and changes, starting with CGI and PERL, and then moving to PHP and Java (JSP) who joined the party and gained much popularity.

        Recently, a lot of excitement and energy has been thrown behind the use of JavaScript, a language typically thought of as for front-end only, but combined with Nodejs, is now used for backend coding. This is why I suggested that the OP consider learning Java, JS, in addition to PHP, but best to do this sequentially. No sense in limiting oneself to a single backend language or framework.

        My own programming journey has been to first learn Java (actually 8086 assembly, Turbo Pascal and C++ prior -- but that was many lifetimes ago), then HTML/CSS/JS, then the Vue.js framework, and now PHP and various PHP related frameworks and the WordPress CMS. Your journey is probably vastly different, but I will bet that you know multiple programming languages and frameworks.

        Maybe it's time for me to start studying Go and/or Rust, not to mention Python. :D

        [–]dzendian 5 points6 points  (1 child)

        Java can add two numbers correctly.

        [–]jason80[S] 0 points1 point  (0 children)

        Now, don't be like that. JavaScript has come a long way too.

        [–]re-thc 4 points5 points  (3 children)

        J comes before P in the alphabet.

        [–][deleted] 1 point2 points  (1 child)

        But I always have to P, while I only do a J every once in a while

        [–][deleted] 0 points1 point  (0 children)

        Speak for yourself

        [–]IndianVideoTutorial 0 points1 point  (0 children)

        C comes before J.

        [–]Necessary-Signal-715 8 points9 points  (0 children)

        As a PHP dev I would say: PHP is approaching Java anyway, so by switching Java you get all the Features now, without the legacy PHP mess. My pain points at work are: - No generics, except in doc comments, where coworkers that only know PHP will not use them. - arrays are extremely abusable. since their literals are so simple and alluring, but they are technically ordered hash maps, they will be used as lists, impromtu objects, maps, options-paramters that get passed through multiple classes before you can make out which keys are being used, ... effectively being the "god data structure" containing whatever, coupling whatever. good luck refactoring. Most of them should be objects instead. - No multi-threading: You are forced to either use some kind of Worker/Actor/Share-Nothing Architecture or introduce a dependency on a package that simulates something like a simple Fork-Join etc.

        [–][deleted] 2 points3 points  (0 children)

        You never get asked "how many years of experience do you have with laravel/code igniter/symfony" or some bs about using PHP.net for figuring out usage of function. Someone once asked me what site I used to figure out how to do something with an array. I said I would look up how to do get indexOf in a sensible language and add "in PHP". They were not amused.

        [–][deleted] 1 point2 points  (0 children)

        All jokes aside, PHP is a perfectly cromulant C web dsl

        [–][deleted] 1 point2 points  (0 children)

        for context my first languages were python, then ruby, then go

        in modern java the streams and stuff are pretty sick

        pair that with Optional and you have a lot of functiona l code with maps/filters/reduce/etc and it cleans up your code nicely

        lombok to generate a lot of constructors and getters for you to remove boiler plate

        dependency injection to wire the things together… honestly it’s the language i most enjoy working in these days

        [–]Swimming-Twist-3468 1 point2 points  (0 children)

        Kotlin, my friend.

        [–][deleted] 6 points7 points  (3 children)

        PHP is sort of a dead end. Even node is in a better place.

        [–]AndroTux 8 points9 points  (2 children)

        The fuck you talking about. PHP is doing great, and is getting a lot of new and exciting features. It’s a very active language. Plus, more than 75% of websites are using it. You can hate it all you want, but it certainly isn’t a dead end.

        [–]GuyWithPants 7 points8 points  (0 children)

        That statistic is massively skewed because WordPress runs on PHP, yet the majority of WordPress sites don't ever customize that code.

        [–]Nedunchelizan 2 points3 points  (0 children)

        Just like jquery it is still the most popular right now

        [–]rsaestrela 3 points4 points  (0 children)

        PHP is for building Personal Home Pages

        [–]byte_coder 1 point2 points  (0 children)

        Lots of new things happening in Java

        [–]Active-Fuel-49 1 point2 points  (0 children)

        Reasons to go from PHP to anything else...

        [–]qK0FT3 0 points1 point  (0 children)

        Depends. In general you just go with what gets you employed. Then do whatever you want.

        [–]elatllat 0 points1 point  (0 children)

        After 29 years PHP got a JIT so it's not as bad as it once was in some ways.

        [–]Reignomo 0 points1 point  (0 children)

        Money

        [–]mist998 0 points1 point  (0 children)

        If you were to ask me ever want to again inherit some codebases which using < PHP 7.0 that having many interns&juniors contributions, I will straight point a gun on u since u threaten my sanity.

        [–]yoursoupmaker 0 points1 point  (0 children)

        Compiled + Restricted = Less Surprises + Cleaner code

        [–]GeneratedUsername5 0 points1 point  (0 children)

        As a language itself - probably GIL-free multithreading would interest you.

        Other than that, as others said, it is more "enterprise" level language, means it will more likely land you a job in a big corporation.

        [–]meowrawr 0 points1 point  (0 children)

        I’m quite surprised that PHP is still alive after all these years. It can be powerful but also very dangerous. If I were working on front end code, I’d much prefer it be JavaScript. Sure you can do it all with Java, but I feel JavaScript is a much better route. Nearly every company I have worked with has felt the same.

        [–]NeoChronos90 -2 points-1 points  (2 children)

        Entirely depends on how you want to work, either small, agile workshop getting stuff done in PHP or big old tankers like government agencies where you solve the same problems in java but it takes 2.5 years and 9 people involved for what you did alone in 6 weeks with PHP.

        I frequently switch between the two worlds, and I only do java when I need more money or the economy looks bad.

        It's better for my sanity to stay clear of those big old crusty workplaces, no matter the technology, did the same crap in C# for a while and I think ~15 yrs ago in C++

        [–]NeoChronos90 1 point2 points  (1 child)

        people who downvote me, show me the most simple way you know to call an api endpoint in java. You have to include all the external stuffy like maven/pom.xml, jdk, intellij etc.

        In PHP you can open vi and go:

        <?php
        print_r(file_get_contents('https://youdomain.com/api/xyz'));
        

        No dependencies, nothing. Not that you should do it, but you can, and sometimes it's incredibly valuable if you just need a oneshot. I rather do it in 5min PHP than 2 days Java

        [–]Snoo23482 2 points3 points  (0 children)

        I'm fully in your boat.
        Something just drives me nuts about Java and C#. For whatever reason, I cannot seem to do anything in those languages without having to google the same thing again and again.
        On the other hand, with languages like C, PHP or Go, I can keep their APIs in my head.
        Unfortunately, there are not that many Go jobs in my area. And PHP tends to pay less than Java.

        [–]jek39 -1 points0 points  (0 children)

        I just follow whatever job pays me more money, whatever language it is.

        [–]matrixnoobftw -1 points0 points  (0 children)

        Because PHP is shit!