Live data from Hacker News

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

programmers.stackexchange.com

51–60 of 188 posts

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

#51
post #44
post #37

Earlier quoted context omitted.

why does a language designed around an OOP perspective need a lambda (which comes from a functional programming perspective)?

Because otherwise you get a bunch of new Callable () { @Override public call() { return 1; } }

Or even better,

    for(final Iterator it = container.iterator(); it.hasNext();) {
        final Object o = it.next();
        println((Integer) o);
    }
compared to:

    container do: [:o |
        Transcript print: o; cr.
    ].

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

#52
post #41
post #23

Earlier quoted context omitted.

My complaint isn't about client-side rendering. It's about _anything_ that involves getting in JSON or outputting JSON. It's essentially being able to easily bind json to objects on the way in, and being able to use respond_to and to_json on the way out.

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

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

#53

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…

SBT also does hot deployment for Java and Scala projects [1]. Just start the server with the directive:

$> sbt container:start "~compile"

"~compile" tells it to scan your project directories every .5s (configurable) for saved changes and recompile only the changed files. It's pretty sweet, and unlike Jrebel, fFOSS.

1. https://github.com/harrah/xsbt/wiki/Triggered-Execution

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

#54

Many Google services are backed by Java on the backend, and Closure compiled JS or GWT on the frontend.

To flesh this out a little more: The question should be "Why isn't Java used by startups or for small projects?". Java certainly used for "modern Web apps" at more established companies. The issue is one of speed vs scale. Startups need to get to minimum viable product. They are usually small teams of 1-3 engineers, and value iteration speed over performance or maintainability. Running up against scalability issues o…

Correct but also a company like Google knows that the moment they put up a link in the frontpage they can drive vast amounts of traffic towards the new property. Secondary reason is that a web app from Google that doesn't scale is really bad PR and draws comments like "omg, lulz it's Google and they can't handle traffic???!!!1!"

Hence, they build with scaling in mind. A startup has none of these concerns and just cares about time to market and making some money to convince VC's that it's worth investing.

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

#55
post #18
post #8

Earlier quoted context omitted.

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,…

Don't forget IBM. (Not that they might seem any better than Oracle...)

They own a large chunk of the enterprise Java space with WebSphere. And they're also are a large driving force for Eclipse (was also their original code).

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

#56
As a young developer (early 20's) I think Java's lack of usage in webdev has to do with several "problems". 1.) Java has the rep of being bloated and slow. (At least when compared to C/C++) 2.) Related to #1, almost all the tools the majority of webdevers use are written in C/C++ and not Java. For instance, Apache, Nginx, Redis, MongoDB, MySQL, SQLite, Webkit, V8 - which gives me the feeling that using/improving C/C++ gives me a better understanding of my toolset whereas Java doesn't have any perceived added benefit. 3.) For Application Development itself, using scripting languages like Ruby/Python/PHP makes for BLAZING fast development especially when using a framework like Rails. 4.) The LAMP Stack (if implemented correctly) can handle a LOT of traffic, I'm talking millions of daily users.

So this leaves almost every web developer (I'd say around 98%) with no reason to use Java - ever. Why should they? With the current tools, I can build highly scalable apps extremely fast and because I'm using scripting languages I'm free to experiment, mix/match, combine, and build new tools in innovative ways. Also, I think because Java is associated with the group of C/C++ and "lower level" languages it really does loose cred simply because it can't compete in effeciency terms with those languages.

Personally, as a programmer who loves C, Ruby and Haskell (so yea I'm biased but who isn't?) just looking at the Syntax of Java makes me seriously wonder what Sun was thinking.

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

#57
post #44

Earlier quoted context omitted.

Because otherwise you get a bunch of new Callable () { @Override public call() { return 1; } }

Or even better, for(final Iterator it = container.iterator(); it.hasNext();) { final Object o = it.next(); println((Integer) o); } compared to: container do: [:o | Transcript print: o; cr. ].

this explanation made the most sense to me. thanks.

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

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

[deleted]

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

#59
post #29
post #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.

Hmm, last time I checked all the "new" frameworks were OOP too. Be it rails or django - they all have some kind of OO paradigm they adhere to.

Yes, and there is this ORM impedance mismatch thing. I stopped writing classes for all tables and it removed many useless code and many issues related to stateful methods. Just one example: if you delete a book with book.delete() then how come you can two or many lines later change its title with book.title = Foo?

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

#60
post #25
post #3

Earlier quoted context omitted.

Its age relative to what? Python is older by any measure, and the first public release of Ruby was only 7 months after Java's. Java certainly had a higher profile than either at the time, but they're all from essentially the same period. http://en.wikipedia.org/wiki/Java_%28software_platform%29#Hi... http://en.wikipedia.org/wiki/Ruby_%28programming_language%29... http://en.wikipedia.org/wiki/History_of_Python

Age in the spotlight doing web development. Not age since the development of the language. Mid-nineties it was CGI and mostly Perl. Then Perl started to fade, and in the late nineties, early '00s, it was all Java and PHP. Then Ruby/Python etc co started to catch on in the mid-00's. And already Ruby and RoR is considered "passe" and old, and fadsters turn to Node.js and such. Seems to be a 5-7 year cycle.

[deleted]
Post reply on HN