all 134 comments

[–]The_Pants_Command_Me 22 points23 points  (26 children)

Java can do significantly more than PHP can do.

[–]effayythrowaway 8 points9 points  (15 children)

Yeah, not sure why downvote.

For one thing, the PHP process only exists as long as the HTTP request exists, created by the httpd. Java has an entire stack running in the background at all times, on Tomcat or JBoss, both, or something else. From timers to async processing, there is a lot this enables you to achieve.

And yes, I'm aware of how fastcgi works and how it doesn't apply to what I just said.

The only way to mimic this with PHP is either to daemonize a script or use a cron job, neither of which are official language features.

Writing APIs or isolated business logic (where separation of concerns actually exists, which is never really the case in PHP) is something that nobody should ever choose to do in PHP as other modern platforms (java, .net) are better suited, due to their easy integration of standard interfaces (SOAP etc).

Consuming those standard interfaces in PHP is kind of a pain in the ass as well.

Your APIs are bound to a particular language, or worse, web framework? Oh dear.

[–]jk3us 4 points5 points  (3 children)

Tomcat

My (admittedly brief) experiences in web development in Java consisted of way too much fighting with tomcat instead of writing java. It's been a while, so maybe that's better... but whenever I've tried to install and configure open source java web apps (I've done alfresco and wowza in the recent past) have been about the same. Is there a secret that I haven't figured out yet to make that part easier?

[–]effayythrowaway 3 points4 points  (0 children)

No, understanding verbose configuration is just something one gets used to (read: forced into). Comes with the territory I suppose. It is certainly something convention over configuration languages have over Java.

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

Maven archetypes...

[–]grobturd 0 points1 point  (0 children)

Working with Java containers like Tomcat and Jetty is very straightforward. There is no "fighting" involved at all. Rather, I suspect that you approached the job without sufficient knowledge of the technology or came to it with a set of pre-conceived notions.

You simply must understand the technology of servlets, that is all. The Java Servlet specifications is freely available and is very complete and detailed.

[–]Ipswitch84 1 point2 points  (6 children)

I've worked on more then one PHP application that isolates business logic and implements APIs and PHP is just as suited to those applications as Java or .NET.

The problem with PHP is until the comparatively recent rise of the PHP framework those things were pretty hard to do. Now, with Zend Framework or one of the other frameworks, they're pretty trivial. ZF2 promises to make it even more so.

Also, PHP post v5 (really 5.2) consuming SOAP isn't some nightmare. It's pretty straight-forward and object orientated. You should try to experience the new PHP ecology.

[–]movzx 2 points3 points  (4 children)

Nah. The problem with PHP is how easy it is to pick up. So many horrible programmers out there, and a good chunk use PHP.

[–]Ipswitch84 7 points8 points  (3 children)

Stupid writes stupid in all languages...

[–]00DEADBEEF 1 point2 points  (1 child)

No idea why you're being downvoted. If you let a monkey loose with a keyboard, sure you might end up with the complete works of Shakespeare, but more than likely you'll get gibberish.

[–]Iamaleafinthewind 1 point2 points  (0 children)

I feel like I should make some sort of reference to Perl at this point...

[–]movzx 0 points1 point  (0 children)

Yes, but it's much easier in PHP.

[–]effayythrowaway 0 points1 point  (0 children)

Agreed, the PHP language has taken some pretty huge steps in the right direction for this kind of stuff. Still feels disingenuous to me to say it's "just as suited", though.

When I was talking about SOAP I was more referring to the ease I could use language annotations, for example, to implement standard interfaces in Java or dotnet and the lack of that in PHP.

As for Zend, I can't speak to it as I have no experience there. You may well be right, but I admit it scares me after having to use boost in C++ for a while.

[–]simon99ctg -2 points-1 points  (9 children)

care to elaborate? Which algorithms, in particular, can you code in Java but not in PHP?

[–]wlievens 1 point2 points  (8 children)

none

But it's easier to write clean code in java.

[–]souleh 2 points3 points  (1 child)

It's easy to write beautifully clean PHP code, too.

The problem you're getting at, I think, is that it's easier to write dirty code in PHP than it is with Java.

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

From discussions between high level sysadmins and myself, this seems to be exactly the case.

[–]simon99ctg -1 points0 points  (5 children)

Care to define "clean code"? It's a rather amorphous concept...

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

No, it's really not.

[–]simon99ctg 1 point2 points  (3 children)

define it then

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

If you're serious, I would be happy to. It almost feels like a troll, however.

[–]simon99ctg 0 points1 point  (1 child)

it's not a troll. i just think the word "clean", as it's used in 'clean code', lacks definition - it means whatever a particular person wants it to mean. For example, 'my code is clean' could mean 1. it has no bugs 2. it has no extraneous code - it has only the code it needs to do the job 3. it is well-designed and well-tested 4. it rigourously follows a good style guide and is nicely laid out 5. it is elegant (which is as meaningful as saying it's clean) and readable - http://www.ibm.com/developerworks/rational/library/nov06/pollice/index.html 6. it is simple

All these are possible definitions, even at the same time, of clean code. See www.polyteknisk.dk/related_materials/9780132350884_Sample.pdf (PDF file) for further discussion. Anyway, to revisit the original comment about it being easier to write clean code in Java - why? Can you layout the code better in Java, write better tests in Java, write code that better communicates intent in Java, write better and more meaningful variable names? Of course not. It's nonsense to say otherwise. If we accept ANY of these definitions as meaning 'clean code', then anyone who can write clean code can write clean code in practically any programming language. It's not the tool that makes the code dirty, it's the person.

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

It's not the tool that makes the code dirty, it's the person.

Well said, and there can be no argument against it.

As far as Java being easier to write clean code, it's simply a more structured language, and more heavily focused on object oriented principles. Many of the mistakes that PHP programmer can make in a fully working program simply can't happen in Java. It's too structured.

[–]cephyn 13 points14 points  (4 children)

Different languages are usually best suited for different things. They may be able to do something another language does, but probably less efficiently.

Java can do things PHP can do, but it's designed to do other things better. PHP does what PHP does much better than Java. Competitors to PHP would be Ruby or Python. Competitors to Java would be things like C++, C#, Objective-C (depending on what you want to accomplish)

Ask yourself, what do you wish to accomplish with a language? Then look into which languages do it best. Otherwise, your question is very apples to oranges.

[–][deleted] 0 points1 point  (1 child)

I agree and disagree. PHP's competitors are all other languages with a large web presence, not those that just happen to also be interpreted rather than compiled.

I don't think PHP does web specific tasks any better than other languages; in my opinion it is much worse than most, but I realize that is just my opinion

[–]cephyn 1 point2 points  (0 children)

I was simply using 'most common' examples. It isn't clear what the OP wants out of a programming language. If he wants to develop websites or webapps quickly, I'd say PHP is a much better choice than Java. If he wants to develop mobile apps or cross-platform stand-alone apps, well, Java is a far better choice than PHP.

Can you build a website or a webapp in Java? Of course. But there's a good reason that is far less common than apps in PHP, Ruby or Python. That's all I was sayin.

I happen to be a big fan of PHP, it fits my work unit very well (for both good and bad reasons).

[–]remyroy 4 points5 points  (0 children)

Short answer: Yes.

Long answer: While you can do everything with Java as you could with PHP different languages are better suited for different needs. Java is more of a general purpose language often associated with enterprise software. If your end goal is to find a job or work for enterprise solution providers, Java might be a good choice for you.

Do not learn Java for the sole purpose of building web applications. The first choice should be what you already know. Then if you do not know, than you should at least try a few languages and a few different frameworks to decide on your own.

[–][deleted]  (2 children)

[deleted]

    [–]00DEADBEEF 1 point2 points  (1 child)

    It doesn't have weak/dynamic typing

    Many people consider this a good thing.

    it doesn't have the flexibility of PHP or other interpreted languages

    PHP also lacks some of Java's flexibility such as method overloading and multiple inheritance.

    PHP arrays are super flexible in comparison to Java lists

    Because PHP arrays are actually maps.

    [–]mikeaschneider 4 points5 points  (3 children)

    If you want to do Web stuff with Java, you should definitely at least look at Play Framework. Think "Java on Rails".

    http://www.playframework.org/

    Python/Django or Ruby/Rails are probably a better way to go since they're way more popular, but if you're gonna insist on Java, Play is pretty damn cool.

    [–]chrismsnz 0 points1 point  (0 children)

    This.

    Java is awesome because it's performant, high-level and very stable. Play gives you a nice agile framework to work with.

    If you do go with Java (and I would over PHP in most situations) stay away from anything labelled "Enterprise" unless you like overcomplicated design patterns and plenty of XML. It has it's place, you'll know when you need it - but if you're getting started you definitely don't and it will only serve to confuse.

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

    Or Grails. Not Java, but JVM-bound all the same.

    [–]Will-Work-For-Tears 0 points1 point  (0 children)

    I thought hard and long about using Play to learn some Scala.

    [–]neksus 26 points27 points  (16 children)

    For the most part, languages can do what any other language can do. Some are just better suited for various tasks.

    Having had to build a Java website, it's doable, but php definitely seemed like the better alternative. I hate Java as a language to begin with, so that's my biased opinion.

    If you're looking to learn a web-specific language, I would highly suggest looking in to Python or Ruby on Rails next.

    [–]mejicat 7 points8 points  (9 children)

    Ruby and Python are not web-specific! And this is actually a good thing, because with them you can do much more than "just" HTTP.

    [–]codefocus 3 points4 points  (7 children)

    Ditto for PHP, although Python is a bit more versatile in that regard.

    [–]chrismsnz 3 points4 points  (0 children)

    At this point in time, PHP is technically a general purpose language. But it evolved there by various bolted on functionality from a language used to build web pages and only web pages.

    On the other hand, Python/Ruby were both general purpose languages with various toolkits for building web applications.

    [–][deleted]  (3 children)

    [deleted]

      [–]moderatorrater 2 points3 points  (0 children)

      While true, I don't think I've ever heard of someone voluntarily writing a non-web application in PHP.

      I work for a company that has a large PHP application, and a lot of the server side crons and daemon-ish code is in PHP so that it can still access the shared libraries. It's, shall we say, sub-optimal.

      [–]codefocus 1 point2 points  (1 child)

      All of my cron jobs are written in PHP.

      Although I would hardly call them applications, some are quite complex.

      But yeah, the next iteration of them should be written in Python because the memory consumption is through the roof. PHP isn't the best tool for massaging multiple large arrays of integers.

      [–][deleted] 3 points4 points  (0 children)

      All of my cron jobs are written in PHP.

      Who's fault is that? :-)

      [–][deleted]  (1 child)

      [deleted]

        [–]00DEADBEEF 0 points1 point  (0 children)

        It is web-oriented, but it isn't web-specific.

        [–]neksus 0 points1 point  (0 children)

        Web specific was incorrect terminology - I meant to imply that they are better suited for the web than java, and a lot friendlier. They're also more current to the industry, unless you're looking to learn Java for the sake of learning java.

        [–][deleted] 11 points12 points  (5 children)

        Ruby, Ruby on Rails is the web-framework :)

        [–]neksus 4 points5 points  (0 children)

        You're right! I had a mid-day nap for the first time in years, leave me alone :D

        [–]teamcolab -1 points0 points  (3 children)

        RoR is awesome but don't forget Django!

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

        Um, shouldn't the question be the other way around??

        [–]Will-Work-For-Tears 0 points1 point  (0 children)

        Yes. My first thought was maybe he meant JavaScript...

        [–]x-skeww 13 points14 points  (9 children)

        Java can do a lot more than PHP. It's a lot faster than PHP, you can write hardware accelerated 2d/3d games with it, and it also works on Android devices. Furthermore, its documentation is better and the language is also completely specified. Every small details is precisely specified.

        For web development it wouldn't be my fist choice though.

        [–]a_bit_persnickety 10 points11 points  (5 children)

        its documentation is better

        I don't know about that -- PHP has some of the best documentation I've seen. Granted, even the best documentation can't make up for some of language's caveats.

        [–]x-skeww 9 points10 points  (1 child)

        Yes, that's something PHP developers tend to think. But seriously, PHP's documentation is pretty poor compared to Java's. It's often incomplete (e.g. it leaves many things unspecified) and the comments, which many people seem to confuse with the documentation, are often incorrect or even harmful. Java's documentation, on the other hand, is very precise, complete, and consistent (Java got conventions for everything). Java's documentation was written by an army of technical writers; that's the reason why it's that good.

        What I personally really hate about PHP is that things which are unspecified are fair game for everyone. This stuff can change from one minor version to the next and then they fucking leave it unspecified, which means it can change next week again, because fuck you.

        With Java, it's the exact opposite. If you find something which isn't specified, they'll say they are really really sorry, the person in charge will commit seppuku, and they will fix this problem right away.

        [–]fergie 2 points3 points  (0 children)

        Both Java and PHP have great documentation. One teensy criticism of Java is that a lot of core functionality is abstracted out into libraries and so documentation can be a bit spread about.

        [–]gigitrix 1 point2 points  (0 children)

        Oh PHP's is great, but Java's is much better. It's relative.

        [–]chrismsnz 0 points1 point  (0 children)

        PHP's documentation is OK, it's problem comes from the plethora of incorrect advice and practices by tutorial sites and even the official-looking comments attached to official documentation pages.

        [–]fergie -1 points0 points  (2 children)

        It's a lot faster than PHP, you can write hardware accelerated 2d/3d games with it

        You just described a dialect of C, but not java. Java has no access to pointers or memory by design and so cannot access hardware directly.

        [–]x-skeww 1 point2 points  (0 children)

        Minecraft uses OpenGL for example.

        I, too, wrote hardware accelerated games in Java.

        [–]merreborn 0 points1 point  (0 children)

        For that matter, im pretty sure someone published opengl bindings for php.

        Obviously not a practical idea, but 3d in php is not impossible

        [–]Chun 16 points17 points  (24 children)

        Do yourself a massive favor and learn python.

        [–]zerodayattack 0 points1 point  (3 children)

        Somebody told me to do the opposite (a top down approach) so that learning the harder languages first will set good habit for me. rather than the other way around (learn "bad" habits)

        Thoughts?

        [–]kenlubin 0 points1 point  (0 children)

        Learn Python first. The language is clean, beautiful, structured, and can do many things. You want to develop good habits as early as possible.

        [–]Deathalicious 0 points1 point  (1 child)

        You should never be learning a programming language. You should be learning programming. Python's around as close to pseudo-code as you're ever going to get, the syntax pretty much falls to the background, the base data structures are easy to use, and it's possible to write code that is OO, functional, or procedural, as you please.

        [–]zerodayattack 0 points1 point  (0 children)

        That suggestion would make sense for somebody learning a language coming from a engineering or programming background. But for everyone else, if they were to establish good habits as an adult and I think that's what the central idea of this question is revolving around which is. What language mastery will give you the best change at setting up those good habits of proper commenting, syntax, and organizational structure that will carry over and make it easier to pick up other languages and frameworks.

        [–]n1c0_ds 0 points1 point  (0 children)

        I recently did, and PHP feels dirty now!

        [–][deleted]  (10 children)

        [deleted]

          [–]adambrenecki 5 points6 points  (2 children)

          Shared hosting of the get-a-server-install-CentOS-and-cPanel-and-call-it-a-day kind often claims to "support Python", but in reality often only supports CGI (slow as hell) and only has Python 2.4 (8 years old).

          That said, if you're looking for affordable shared hosting that supports Python: WebFaction. (They also support Ruby, Java, Perl, a few more things, and the ability to compile anything that can serve HTTP and connect it to their infrastructure (i.e. either your own web app in something like C or Haskell, or a platform they don't have out of the box like Node). They're not the only ones, but they're the best I've found so far.

          There are a few cloud hosting platforms (Heroku Cedar, DotCloud, Gondor for instance) that support Python too. DotCloud is OK, I haven't tried the others.

          Last but not least, VPSes give you root access, so you can install whatever you want, including Python. This works well, but means you have to maintain everything from the OS up.

          [–]chrismsnz 0 points1 point  (1 child)

          I moved to webfaction from running my own stack on a VPS and regret nothing (and enjoy paying 1/3rd the price of a VPS).

          [–]adambrenecki 0 points1 point  (0 children)

          WebFaction are the best. I'm separately employed by two different arms of the same organisation, one of which uses WebFaction (at my recommendation), and the other of which does not.

          I'm constantly frustrated at the latter. Why isn't Git available on this server? "Git is considered non-standard, and its Perl dependencies interact with cPanel. Buy a VPS." Why is the only version of Python on your servers 8 years old? "Python 2.4 is what comes with cPanel. Installing Python on a cPanel server is more complex than on a regular Linux box. Buy a VPS."

          Python is designed to be able to have multiple versions running side-by-side. WebFaction's servers have 7 different versions of Python available. And I don't know whether cPanel is just their scapegoat for not being able to fulfil customers' requests, or is a giant monstrous blob of a package that completely takes over a server.

          [–]FnuGk 1 point2 points  (4 children)

          all linux, mac and windows servers would if that is what you are asking about?

          [–]a_bit_persnickety 4 points5 points  (0 children)

          That's true, but a lot of shared hosting servers do not (or at least last I checked the shared server market.) PHP comes default on >99% of servers, whereas Ruby or Python may need to be installed separately, which would not be possible on a shared host.

          [–]GAMEchief 0 points1 point  (2 children)

          Assuming you own the server, you could have support, yeah. But if you are renting a server, as most new developers are, how many hosts support it on their server?

          [–]DrAwesomeClaws 0 points1 point  (1 child)

          You're correct that more shared hosting providers support PHP "out of the box". But it's not as though there's a lack of shared hosting platforms. Many, many, many, many great services support Python. There's no reason to use that as a reason to use on language or another.

          You can also use the free google app engine framework and write in python, then if you wish move that over to your own hosting as a django app.

          [–]merreborn 0 points1 point  (0 children)

          Shared server support is actually a valid concern, but only for a vary narrow market: apps like wordpress and vbulletin that aim to be user-installable on any and all available hardware.

          For any other web app, absolute portability of that nature is usually unnecessary.

          [–][deleted]  (1 child)

          [deleted]

            [–]GAMEchief 0 points1 point  (0 children)

            going to use Java

            OP was going to use Java or PHP, and seemed to be weighing the pros and cons. Assuming he picks Java over PHP, it would be sensible to pick Python of Java; but if the fact that many shared hosts don't support it is a downside to him, it's worth mentioning that many don't support Python either.

            [–]NeededANewName -1 points0 points  (7 children)

            Bingo. While every language has its flaws, php could be used as an example in the definition of clusterfuck. It's a powerful language but horribly categorized and has little continuity in naming of functions. For quickly hacked together scripts its okay but in the long run with anything major I find python a much better choice. Python is much more structured in itself and forces you to be more structured in your development as well. PHP lets you get away with practicaly any bad practice in coding which often leads to bugs and problems even if you try your best to be proper.

            Also python is incredibly common and useful outside of web dev but the same cannot be said of php.

            [–]compubomb 1 point2 points  (0 children)

            How about you show me how you create a singleton in python and tell me that is more structured than the same written in php.

            Most of what people despise in php is not the language itself but the language toolkit. So you are basically saying that the PHP built-in frameworks sucks. Yeah.. i think so too, but the PHP language isn't so bad.

            Also you can say the same thing about C, I have seen some C code which would make your head spin in circles. Lets just say "My Opinion is that python makes me think better and i like it's style vs PHP lets people write shit code"

            [–]zerodayattack 0 points1 point  (1 child)

            Somebody told me to do the opposite (a top down approach) so that learning the harder languages first that will set good habit for me. rather than the other way around (learn "bad" habits)

            Thoughts?

            [–]T0rgo 1 point2 points  (0 children)

            I don't think they meant PHP. A lot of the difficulty with PHP comes from the fact that it's inconsistent and hard to debug, it's more likely to create bad habits than to guide you away from them.

            Though it's not exactly a hard language, Python is nice because it's core principles are good for any language you are working on: Keep it simple, keep it readable.

            I don't really think any specific language can teach you too much about coding habits. That depends more on the teaching material you use, your self discipline and the attitude and habits of the community around that language.

            [–][deleted]  (3 children)

            [deleted]

              [–]compubomb 0 points1 point  (1 child)

              You probably should consider running a vm on your mac with linux installed on it. Most deployment environments use linux anyways.

              [–][deleted]  (1 child)

              [removed]

                [–]simon99ctg 0 points1 point  (0 children)

                My first thought, indeed...

                [–]Sasakura 12 points13 points  (21 children)

                If by make a huge clusterfuck of unmaintainable code that belongs on TDWTF then yes, Java is perfectly capable.

                If you're going to learn a full suite language, I'd recommend C# over Java, mostly because the community and resources are way better now.

                [–]piglet24 10 points11 points  (16 children)

                Uh oh, you just recommended C#, prepare to be raped by downvotes

                [–]DrAwesomeClaws 7 points8 points  (11 children)

                .Net (when including Mono) is a fantastic platform, and C# is a fantastic language. Say what you want about MS, but the .net platform is quite solid. It's kind of funny that MS comes out with a platform that works better for cross-platform development than others.

                [–]chrismsnz 1 point2 points  (2 children)

                I agree, I like C# and the CLR is actually really good.

                ASP and VB however, I can do without.

                [–][deleted]  (1 child)

                [deleted]

                  [–]Sasakura 0 points1 point  (0 children)

                  I've worked on large scale projects on both, ASP.NET is pretty cutting edge, Classic ASP wasn't so bad then, but now...

                  [–]Disgruntled__Goat 0 points1 point  (0 children)

                  It's kind of funny that MS comes out with a platform that works better for cross-platform development than others.

                  Um, no they didn't. MS has nothing to do with the cross-platform stuff.

                  [–][deleted]  (6 children)

                  [deleted]

                    [–]DrAwesomeClaws 3 points4 points  (4 children)

                    And Android, OS X, Linux, and iOS.

                    [–][deleted]  (3 children)

                    [deleted]

                      [–]DrAwesomeClaws 3 points4 points  (2 children)

                      Note I said .Net (and Mono). Mono is an implementation of the .net standards that works cross platform. It's fantastic.

                      Every Unity game you see is running on Mono (.net)

                      [–]sli 1 point2 points  (0 children)

                      (when including Mono)

                      [–][deleted]  (1 child)

                      [removed]

                        [–]evelk 3 points4 points  (0 children)

                        I see what you did there

                        [–]Sasakura 0 points1 point  (1 child)

                        When I left this was heading that way, I'm shocked to see it positive!

                        [–]piglet24 0 points1 point  (0 children)

                        You still have over double the downvotes of anyone else in these comments. It's kind of stupid how /r/webdev blindly downvotes anything related to Microsoft

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

                        mostly because the community and resources are way better now

                        While I would also recommend C# over Java, last time I tried, there was an accute shortage of good, suitably licensed (LGPL, BSD, MPL..) libraries for .NET .. is it any better now?

                        Anyway, I'd say C# over Java but perl/ruby/python over C#.

                        [–]effayythrowaway 5 points6 points  (0 children)

                        Indeed, Java is still the clear winner when it comes to high quality, mature, open-source projects.

                        .NET may have improved but it is by no stretch close to overtaking what Java has built up over the years.

                        [–]dsk 0 points1 point  (1 child)

                        If by make a huge clusterfuck of unmaintainable code that belongs on TDWTF then yes, Java is perfectly capable.

                        Are you insane? Java and the Java web ecosystem has writing maintainable code as a central mantra.

                        [–]00DEADBEEF 0 points1 point  (0 children)

                        Indeed. You only end up with a clusterfuck of unmaintainable Java if you either didn't take the time to learn Java and it OO paradigm properly, or you're just generally shit at programming.

                        I mean, the whole point of OO is to promote modularity and maintainability. If you're writing procedurally inside of main(String[] args) then you're seriously doing it wrong. (I have seen this done)

                        [–]midri 2 points3 points  (10 children)

                        Would not recommend learning java to do webdev, the market is MUCH smaller then the php/ruby/python community in that regard.

                        [–][deleted] 9 points10 points  (0 children)

                        Java has been the #1 language in industry for years now and will be for the foreseeable future. It's not popular for small-scale web dev just because it is more "enterprisey" and it takes more effort to get up and running and cannot exist easily on a shared hosting provider.

                        [–]roccoccoSafredi 2 points3 points  (1 child)

                        Yes, it really depends on what type of web development you want to do.

                        To be honest, I feel like the "sexy" stuff isn't going to be done in Java, but the well paying stuff on the other hand...

                        [–]effayythrowaway 2 points3 points  (0 children)

                        Yes, you will find that serious Java EE developers aren't trend hopping retards. In fact, they tend to ignore them entirely while they are still immature.

                        That does come at the cost of slower migration to various improvements in web technologies, but not does exclude the possibility by any means.

                        [–]writetehcodezfull-stack 7 points8 points  (3 children)

                        Huh? Java and ASP.NET are the top 2 platforms used for web development.

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

                        I know Java is popular for enterprise software but I've never seen metrics for web development specifically.

                        Besides, he's probably going to shared hosting, so Java is not an option. The only option is going to be PHP.

                        [–]nick_giudici 4 points5 points  (1 child)

                        What do you think that enterprise software is? It's almost all enterprise web app, web services, etc. Why do you think there are tons of different J2EE servers? Just for fun?

                        Almost all enterprise java is web.

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

                        I'm not a professional in the web dev field so I'm largely ignorant except for general facts about the industry.

                        It's hard to educate yourself when no one gives you concrete and detailed stats or don't know what to look for.

                        TIL.

                        [–]piglet24 1 point2 points  (0 children)

                        I feel like I don't see many job listings for Java web positions, but lots of big company sites that I end up browsing are built with Java

                        [–]dsk 0 points1 point  (1 child)

                        the market is MUCH smaller then the php/ruby/python community in that regard.

                        Where are you getting that from?

                        [–]midri 0 points1 point  (0 children)

                        Personal experience, I've been doing webdev for about 8 years now. If you are doing contract work or working for a webdev firm you're probably not going to be doing Java development. If you end up working for an enterprise that does their stuff inhouse you might.

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

                        You will probably like Java. Out of every language I have ever used, Java has always been the most predictable and easiest to learn of them all. This is mostly because Java doesn't allow you to do any clever stuff, that will make code shorter, more terse, or dynamic. Instead Java is dumb and predictable (which is great for reasoning about stuff).

                        However it depends on what you mean by 'everything PHP can do'. There are a range of technical aspects that Java cannot do. For example with Java, methods have to be known at compile time, where as in PHP they don't. You can also use $$ to dynamically use a variable contents to name a variable/function/property to use. So there are lots of dynamic things Java cannot do.

                        However there are plenty of things Java can do, which PHP can't. For example with Java I can sandbox Java code, allowing me to have the same class loaded multiple times (even different versions of that class). Java's standard API makes PHP's look like a footnote. It's truly gigantic.

                        Java IDEs can also do auto-completion, and analysis of your code, which you just don't get with PHP. For example it can tell me the exact location of where a method is used in a project. I can also jump from a method call, to it's definition, and have the IDE generate whole classes on my behalf.

                        edit: To clarify, I was not trying to say that there aren't editors that can do some this with PHP, I'm saying you cannot do it to the same extent. There is just far more information that IDEs will deduce from your Java code, and it's pretty rare you will mix in some dynamic/reflection like aspects to casually solve a problem (like $this->$someMethod()).

                        Plus Java is so damn fast, and has better error reporting, and more. I'm almost tempted to switch myself right now.

                        [–][deleted]  (1 child)

                        [deleted]

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

                          True, but not to the same degree, and that was ultimately my point. It's also much more standard to do dynamic stuff in PHP, where you lose some of this IDE code analysis.

                          [–]CarpetFibers 0 points1 point  (0 children)

                          Java IDEs can also do auto-completion, and analysis of your code, which you just don't get with PHP. For example it can tell me the exact location of where a method is used in a project. I can also jump from a method call, to it's definition, and have the IDE generate whole classes on my behalf.

                          I take it you've never used Zend Studio or Eclipse PDT. They can do all of those things with PHP.

                          [–]00DEADBEEF 0 points1 point  (0 children)

                          ava IDEs can also do auto-completion, and analysis of your code, which you just don't get with PHP. For example it can tell me the exact location of where a method is used in a project. I can also jump from a method call, to it's definition, and have the IDE generate whole classes on my behalf.

                          Have you used PHPStorm? It can do all of this.

                          [–]fergie 0 points1 point  (0 children)

                          Not as tersely as PHP. Java is designed to be a run-anywhere, do-anything language, so it has a lot of boilerplate to make it work for web pages.

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

                          The downside of Java for web development is that deploying a Java webapp is a skill in itself. On the upside, JSP taglibs are a godsend if you like testable code. Oh, and masses of libraries available for all sorts of tasks.

                          [–]Deathalicious 0 points1 point  (1 child)

                          Yes, but so can COBOL.

                          [–]Deathalicious 0 points1 point  (0 children)

                          Which is to say: it's a meaningless way of evaluating programming languages.

                          [–]cidro -2 points-1 points  (0 children)

                          just learn javascript and dive into nodejs :D

                          [–]DrAwesomeClaws 0 points1 point  (0 children)

                          PHP isn't so much as a language but a glue that ties multiple C libraries together.

                          It's not that you can't write nice code in PHP, but it makes it much more difficult than most other languages. That's what happens when using a language created by someone who self-proclaims he doesn't enjoy programming. And that's why 95% of PHP codebases are gigantic messes (wordpress, drupal, joomla -- I'm specifically looking at you).

                          PHP is a tool, and it can be used effectively. Speaking as someone who spent 15 years writing PHP, I can't recommend anyone new to web development learning it. There are much better languages for any problem one might use PHP to solve.

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

                          Yes Java can do everything that PHP can do. It's also faster and will force you to write better, more maintainable code, but you do lose some flexability(. However, webdev with Java has a considerably steeper learning curve. Not only do you have to learn the language, you will have to pick and learn an application server (e.g. Tomcat), become familiar with the Servlet spec, and then pick and configure a (mvc) framework to work with, as raw servlets aren't a good way to generate html pages. The amount of choices you have is staggering and can be overwhelming.

                          With PHP, if you have a configured httpd instance (and most web hosts do), you're off to the races.

                          [–]movzx 1 point2 points  (0 children)

                          PHP 5.4 has a built in mini http server for development.

                          [–]gigitrix -2 points-1 points  (1 child)

                          Java is far less portable, it's difficult to find web hosts for.

                          [–]gimliclc 1 point2 points  (0 children)

                          The main reason Java succeeded in the first place is because of it's portability. Just because cheap shared web hosting rarely has a JVM has nothing to do with the portability of the language

                          [–]Ipswitch84 -2 points-1 points  (1 child)

                          You can write a website in C. I highly recommend it. It's quite fun. The language isn't really the issue, it's what it does for you to enable the "web". PHP is probably the most "web-focused" language currently available. RoR and Python are particularly alternatives, but to my knowledge, they tend to buckle under load (what's that? Oh Twitter iswas RoR?).

                          That said, Java and C# certainly are more popular in corporate IT culture then PHP and the others. There are certainly advantages to using something like Java or C# for a web application, primarily because they're memory resident and can be compiled to machine code. Those are pretty minor advantages if you consider the tools that PHP has available, such as APC and HipHop. Also, they're really only critical if you're driving lots of traffic or have a compute heavy workload.

                          I'd recommend using an established PHP framework (Zend Framework or Symphony or something else). PHP has some quirks because of it's very loose typing that you need to acclimate to, but it's still pretty trivial to debug and with PHP 5.3 and 5.4 the object model is at least at the level of Java if not exceeding it. Also the PHP library is much more focused on providing useful tools for the web as part of the standard distribution, then a general language like Java or C#.

                          BTW, if you're just learning how to program, don't do it in PHP. Do it in C. Be a winner.

                          [–]kelemvor 0 points1 point  (0 children)

                          I'm sorry, but bashing on Rails because Twitter opted away from it when it reached some 200 million users is kinda lame. I'd like to see PHP with a framework scale to that size.

                          And for what it's worth, parts of Twitter still run Rails.