Live data from Hacker News

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

programmers.stackexchange.com

11–20 of 188 posts

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

#11
post #6

When starting web development, I found it easier to learn Ruby and the Rails Framework from scratch than to use Java which I had several formal classes in. I think that says something about Java's documentation/community support. Ruby/Rails has railstutorial.org, tryruby.org, rails for zombies/code school, and railscasts. All these high quality beginner resources made using Ruby instead of Java an easy choice. The ot…

I don't think the problem is Java documentation/community support.

It's really that with the exception of Play/Grails/Vert.x the frameworks are horrifically over-engineered by developers who live and breathe in the enterprise space. Nobody has ever really cared much about smaller, more startup land developers. So Java has required so much knowledge and involvement just to do the simplest things.

I would take a look at frameworks like Play for the future of the platform.

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

#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 could do this much faster if I were using Java," primarily due to my relative experience levels.

If you are more comfortable with Java, and are just beginning with Rails, it goes without saying you will miss Java. That's not a very useful metric. Give rails 4 weeks, then compare them for ease of use and expressiveness.

If you don't have a month to learn rails, then stick with Java.

> But also because I haven't seen anything critical "missing" from Java, preventing me from building the same application.

"It can be done with Java" isn't the same as "It can be done concisely with Java".

I would say learn Rails/Django. Use them for CRUD. I have checked Java ecosystem recently, and they are still far behind in terms of expressiveness when it comes to regular web programming. Play framework is close - I haven't used it personally apart from toy examples.

For long running services, depending on your needs, you can either write it in Ruby/Python on top of some infrastructure tool(resque, zmq, celery....), or you can write in in Java if your service is CPU intensive.

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

#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 horrible...absolutely, stunningly horrible. Your controller is an XML file (seriously). Freemarker (the main templating language) makes ColdFusion look awesome.

Play is better, but it seems built for the way websites were created in mid-2000. JSON is still a second-class citizen. Static actions are a weird choice given IoC is achieved via DI in a static language.

Edit: I should add that there's also the persistence story. Anyone who's done [n]Hibernate knows that it's, at best, a mixed blessing. Even Java's NoSQL drivers are verbose compared to their dynamic brothers (first-class hash support is a big issue here, for some drivers in particular). I'm not sure something like Sequel would even be possible to write, and the AR implementations are, again, limited by the compiled-time nature of the language and the inability of bend the syntax into a nice DSL.

Java also lacks lambdas, and generic support is weak. And what's up with int vs Integer...the list goes on and on.

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

#17
No it is not the coolness factor, it is the paradigm. Java forces you to use OOP and OOP is not very fit for web development: you want to answer fast to a stateless request by checking some data trough different filters (eg a template), you don't want to recreate a full world of objects and pass along some messages.

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

#18
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.

But they own Java.

I'm sorry, but as a Java developer seeing Oracle pick it (anything Java) up like a dead fish and try to see who they can smack big money out of is horrifying.

It goes against the culture of Java that I'm familiar with. I've been learning other languages on the JVM for the express purpose of being ready to jump ship if I need to with those other languages. (Jython can jump to Python, JRuby to Ruby, Java to C#/C++, and Scala can be mapped to something I'm sure).

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

#20
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…

>Part of it is a framework issue. Struts is horrible...absolutely, stunningly horrible. Your controller is an XML file (seriously). Freemarker (the main templating language) makes ColdFusion look awesome. Play is better, but it seems built for the way websites were created in mid-2000. JSON is still a second-class citizen. Static actions are a weird choice given IoC is achieved via DI in a static language.

99% of websites are still built "the way they were built in mid-2000", and there's nothing wrong with that way.

Client-side rendering and such is not the "new way", is just an alternative way for certain types of websites, that is still quite immature and can take you to a world of pain if done bad (see Twitter).

Post reply on HN