Live data from Hacker News

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

programmers.stackexchange.com

161–170 of 188 posts

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

#161
post #152

Earlier quoted context omitted.

I've used both Java and Ruby and Java is by far the more advanced runtime with better support. Ruby may have much cleaner syntax than Java, but better tooling is NOT one of Ruby's strengths. Reading your post I suspect you've had very little exposure outside of Ruby.

> Reading your post I suspect you've had very little exposure outside of Ruby. Reading your post, I see that you just throw claims around. > I've used both Java and Ruby Congratulations. You aren't the first or the only one. > Java is by far the more advanced runtime with better support. There are a lot of good things about JVM. I never contended that. > but better tooling is NOT one of Ruby's strengths. I don't reme…

On a large project the ability to refactor is important. Making structural changes to a large Ruby project is extremely time consuming and error prone. Pretty much anything is better at dependency management than bundler/gem. If you have to compile your dependencies at install time you're probably doing something wrong. Not to mention the version incompatibilities between gem versions and syntax changes.

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

#162
post #141

Earlier quoted context omitted.

You do realise there is more than "renaming variables" to refactoring don't you?!?

> You do realise there is more than "renaming variables" to refactoring don't you?!? You do read before responding, don't you? >> Other than renaming(which can be done for ruby, though it requires manual effort), there is no refactoring which Java does better than Ruby.

>> Other than renaming(which can be done for ruby, though it requires manual effort), there is no refactoring which Java does better than Ruby.

Perhaps you could name this mysterious IDE which you claim provides reliable refactoring support for Ruby which is equivalent to the refactorings provided by Java IDEs? RubyMine is the best one I've seen http://www.jetbrains.com/ruby/features/index.html, but it doesn't match what can be done in Java.

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

#163
post #126

Earlier quoted context omitted.

You'd much rather read a Java program because you are already biased towards it. Yes it's easy to read, but you need to acknowledge that many other skilled developers would find it easier to read Python, or Ruby, and indeed would rather read 1,000 lines of the same over 100 lines of Java. Otherwise you are simply being willfully ignorant. Why is Java considered inefficient and English not? Maybe because we don't need…

> "You'd much rather read a Java program because you are already biased towards it." No. I'd rather read "int foo; bar.printLn()" than "%foo => &bar :print" Less special characters. More words. Each to their own though.

So you'd also rather read

"An unordered tuple Z going from a1 to an is a defined as for every x in Z then x is a1 or x is a2 ... or x is an"

than

"An unordered tuple Z (a1,...,an) is defined as [x : x = a1 v x = a2 v ... x = an]"?

I take that as not being (or not wanting to be) familiar with the language you are reading. If you'll read Ruby, at least browse a manual to know what {} and # mean.

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

#164
post #119

Earlier quoted context omitted.

Actually, it needs pure functions. Lambdas are one way to add them with the benefit of being buzzword-compliant.

Purity is orthogonal to lambda abstractions. It's matter of what function can do (pure or not) and function creation (a lambda or something more verbose).

Sorry. I meant simple, C-style functions. I should never comment on HN before breakfast.

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

#165
post #123
post #33

I've been hacking Rails since 2004, and I've made the switch to Java (dropwizard+mustache) for basic web development this year (sometimes with a meteor-like micro-framework I rolled myself). Benefits: - Higher quality code. Java is easier to refactor than Ruby, which makes up for the lower language power. - Performance! - Actual concurrency! - Faster server spinup and incremental changes. Rails with 20 gems in develo…

I'm kinda testing the same setup. There are a couple nice things, but one thing that hurts me coming from Python is that in Python an SQL row was just an dict with data, and I could change my schema (and add/remove entries from this object) and then return it as JSON quite easily. Now in Java/Dropwizard the tendency is to map from SQL rows to objects, then from objects to JSON. Which is a PITA, even more when your de…

I tend to work more with document-like stores than SQL these days, so there may be more idiomatic solutions....

If you're complaining about having to update the fields in your object, I think thats kinda silly. You bought into the idea of static typing at some point, and now your data has type constraints. If you need need need flexibility you can of course make some field a Map.

If you're complaining about boilerplate, you can at least automate the mapping with code like:

    class Util {
      public static  T resultSetToObject(ResultSet rs, Class klass) {
        List> rows = new ArrayList>();
        ResultSetMetaData metaData = resultSet.getMetaData();
        int columnCount = metaData.getColumnCount();

        while (resultSet.next()) {
          Map columns = new LinkedHashMap();

          for (int i = 1; i 

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

#166
post #72

Earlier quoted context omitted.

"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 incre…

Not only does hot deployment work almost always, so does in-place compilation of modified code within deployed modules while connected to a remote application server in debug mode.

FWIW, we've had some problems with hot deployment and Tomcat. After a few of them the VM OOMs. Probably we are doing something wrong or triggering some Tomcat bug, haven't dug deep enough yet.

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

#167
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"}

Its fine code once the design its settled, but while you're changing the schema, the backend java code and the frontend javascript, having to change all those classes gets tedious.

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

#169

Earlier quoted context omitted.

How about the same test with a '-client' switch...

I get the same times, more or less. I'm not sure the -client switch changes any behavior that early in the VM's life, before any garbage collection or sizable allocation happens. It would still be using a 64-bit data model with the -client switch (-d32 gives me: "Error: This Java instance does not support a 32-bit JVM.").

"-client" has no effect in 64-bit.

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

#170

Earlier quoted context omitted.

I think all of this was true 4 years ago. But Java EE 6 has changed a lot of this. My main experience has been on the Microsoft stack, but I have learned and worked with a lot of tech, including Rails and Django. Last year I worked on a project for which we chose Java EE 6. There's a lot of good stuff there; for instance simple, bloat-free architecture, JPA (the new persistence architecture), CDI (context and depende…

For what it is worth, I have used Java 7, JPA (with hibernate), tomcat 7 and glassfish, and I didn't notice much difference. Jersey (JAX-RS) is pretty nice, one of the better libraries to come out of Java in a while. I do agree that Java is moving in the right direction, but it is a very slow progression. I think the major cause of the slowness is because of the fact that SUN was bought by Oracle, and it took a littl…

For folks outside of JavaEE, its common to deploy jars though. I have never run the software that takes .wars.
Post reply on HN