Live data from Hacker News

Why isn't Java used for modern web application development?

programmers.stackexchange.com

61–70 of 188 posts

Re: Why isn't Java used for modern web application development?

#61
This is just my experience but if there has existed a common line of thinking with the rabid Java fans I've worked with, it would be closed mindedness to the point of being its own brand of Stockholm syndrome. The thinking that whatever the project at hand may be, a Java based solution is always the correct answer and there is nothing to learn from alternative platforms. I've heard "Why would anyone want to use anything other than Spring?" or "C# is shit" more than once. However, if you were to compare the experience of using Spring + Eclipse to C# + ASP.MVC + Visual Studio, you'd have to be pretty set in your ways not to admit that the latter is a much nicer platform to work with and that the Java eco-system shouldn't take something away from it. Having a standard web framework (ASP.MVC) makes .NET teams miles more efficient than the framework fragmentation that is Java web dev.

And if you're comparing it to Rails or Django, I honestly don't think you can easily find a 3 or 4 engineer Spring team that could deliver a product as good (or scalable) as Instragram in the 2 years it took them to do it in Django. You just can't iterate as fast.

Re: Why isn't Java used for modern web application development?

#62

Disclaimer: This is cribbed from my upcoming "The Well-Grounded Java Developer" --------------------- If you investigate Ola Bini's pyramid where languages fall into static, dynamic and DSL layers you'll see his arguments for what type of programming tasks suite which layers. Java sits firmly in the stable layer, and so do all of its various web frameworks. As expected for a popular and mature language, Java has a la…

"1. Recompile the Java code. 2. Stop your web server. 3. Redeploy the changes to your web server. 4. Start your web server. ... Unfortunately, hot deployment has never been 100 percent reliable, and the web server often still has to perform expensive recompilation of code."

- Last I checked i) the hot deployment in Tomcat/Jetty/SBT/etc is pretty solid, especially if we are talking development. ii) Java supports incremental compilation which means you only need to compile what has been changed, especially if we are still taking development phase again. Unless you compile after making changes to 100+ files, I don't see how expensive this step can be.

"Generally speaking, Java-based web frameworks don’t reliably allow you to have a fast turnaround time for your changes. But that isn’t the only concern with Java-based web frameworks. Another factor that slows down rapid web development is the flexibility of the language, and this is where static typing can be a drawback."

- This argument about dynamic typing faster/better than static typing is just BS. Each offers it's own advantages and can be better/faster depending on where/when/how you apply it and how good a developer are you at actually using their power. Your first example of changing number value to have decimal precision can be achieved in static typing languages like Java/C# just as fast and reliably when one uses refactoring. Your second example of changing list of Book objects to a list of BookOrToy objects, could have been avoided all together by coding to interfaces and not concrete objects. If that has failed, refactoring again solves this.

Re: Why isn't Java used for modern web application development?

#63
post #35

Java is a language that is in a weird space. It doesn't compile to binary like C/C++ and it isn't high-level and interpreted like a Ruby or Python. It's a weird middle-times language. It originally appeared in 1995 and is somewhat pioneering in the web space. But it isn't as clean as C# since C# appeared in 2001 and was able to learn from the mistakes of Java. It's definitely not as clean as Go which appeared in abou…

Spring is a bad choice?

Re: Why isn't Java used for modern web application development?

#64
post #8
post #4

It's mainly the coolness factor. Oracle's ridiculous Java lawsuits also contributes to that.

I don't think that the Oracle lawsuits have made a single bit of difference to anybody. Oracle isn't the only big fish in the Java space.

I've got to say, I'm wary of supporting technologies that are linked to disagreeable behaviour like that - for a time I was considering phasing out MySQL for a similar reason. I saw Sun as one of the good guys.

Re: Why isn't Java used for modern web application development?

#66
post #14

> why the hate toward Java for modern web applications? Verbose language. But more importantly, needlessly verbose and badly designed apis. JSP: You have ${fn:size(emails.unread)} unread email(s)! You have no unread emails! Saner templates: You have ${emails.unread ?: 'no'} ${emails.unread?.pluralize('email')} ! http://paulbuchheit.blogspot.in/2007/05/amazingly-bad-apis.h... > But I can't help thinking to myself, "I…

"Saner templates: You have ${emails.unread ?: 'no'} ${emails.unread?.pluralize('email')} !" At the cost of throwing internationalisation out of the window. At least the example you led with is more conducive to localisation.

> At the cost of throwing internationalisation out of the window. At least the example you led with is more conducive to localisation.

Right. i18n is the reason you have to import two taglibs and the template doesn't support basic conditionals. /s

JSP is horrendous. There is not a single reason for its existence, and it should be quarantined.

As far as i18n/l10n goes, the example I quoted was from play framework. This is how an internationalized version will look like:

    # Messages file
    
    unread_emails=You have %s %s
    no_email=You have no email
    
    # Template
    
    #{if (emails.unread) }
        &{'unread_emails', emails.unread, emails.unread?.pluralize('email')}
    #{/if}
    #{else}
        &{'no_emails'}
    #{/else}
Are you arguing internationalized jsp is somehow better than this? I tried really hard, but I failed to think of a single templating engine that's worse than JSP.

Re: Why isn't Java used for modern web application development?

#67
post #16

Part of the answer is Java itself. It's verbose, static typed, and requires a lot of boilerplate code to do properly. The fact that classes are a compile-time concern, rather than a runtime concern, is just such a drag. You end up with interfaces you don't really need, only so that you can inject them into constructors so that your app is properly decoupled and testable. Part of it is a framework issue. Struts is hor…

So basically, it's due to lazy programmers who moan if they have to type or think too hard. Also very very much fashion lead by hipsters who must be using the newest coolest untested thing on the planet.

> So basically, it's due to lazy programmers who moan if they have to type or think too hard.

Typing is a problem. Thinking too hard? Where does the OP imply he is averse to thinking? Being turned off that "fucking XML files are controllers" is being averse to thinking?

> Also very very much fashion lead by hipsters who must be using the newest coolest untested thing on the planet.

And those untested things would be? Rails is untested? Or Django? Or Flask?

Re: Why isn't Java used for modern web application development?

#68
post #52
post #41

Earlier quoted context omitted.

You're stuck in 2007. People doing modern java use: @Path("/hello") @Produces(MediaType.APPLICATION_JSON) class HelloController { class Greeting { public Greeting(String name) { this.content = "Hello, " + name; } public final String content; } @GET public Greeting greet(@PathParam("name") String name) { return new Greeting(name); } } > curl http://localhost:8080/hello?name=me {"content": "Hello, me"}

I'm not sure if you are being sarcastic, but you do realize that's a lot of code for something so simple, right? get '/hello/:name' do content_type :json {:content => "Hello, #{params[:name]}"}.to_json end

I'm not sure if you are being sarcastic, but you do realize that your version is entirely static while the other one is ready for future evolutions?

By changing a single line, the java version can also produce XML or text response. By changing two lines, it can also respond to POST requests.

And that's just the top of the iceberg. Oh, and in the ends, it's way faster than Node, Ruby, Python and most of the dynamic languages.

Re: Why isn't Java used for modern web application development?

#69
post #66

Earlier quoted context omitted.

"Saner templates: You have ${emails.unread ?: 'no'} ${emails.unread?.pluralize('email')} !" At the cost of throwing internationalisation out of the window. At least the example you led with is more conducive to localisation.

> At the cost of throwing internationalisation out of the window. At least the example you led with is more conducive to localisation. Right. i18n is the reason you have to import two taglibs and the template doesn't support basic conditionals. /s JSP is horrendous. There is not a single reason for its existence, and it should be quarantined. As far as i18n/l10n goes, the example I quoted was from play framework. Thi…

I like JSPX. Designers and HTML front-end engineers intuitively understand custom tags, and any imperative non-declarative logic should ideally be pushed back into Java or a custom JSP tag, such that you rarely see it.

Re: Why isn't Java used for modern web application development?

#70
Who says it isn't?

Spring MVC + Spring Data JPA or Mongo + Thymeleaf for templating + coffee-maven-plugin for Coffee to JS transpiling and you're good to go.

I think the first comment on the question is very true:

> "I think you're incorrect: it is still used, it's just lost cool factor."

Post reply on HN