News for hackers. Stuff that matters.
Re:Why isn't Java used for modern web application development? by irahul on Sunday June 10, 2012 @08:35AM (#4090877)
> Higher quality code. Java is easier to refactor than Ruby, which makes up for the lower language power.

Let me rephrase:

"It's easier in Java to rename identifiers than ruby, because my IDE does it for me."

Now that's fine, but I don't see how do you conclude:

Easier to rename identifiers => Higher quality code. How on earth?

Easier to rename identifiers => Makes up for lower language power. What language deficiencies does renaming identifiers make up for?

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

> Actual concurrency!

Am curious. Where in basic web development does concurrency help? As far as servers go, evented servers(thin, mongrel) will perform as good as, if not better, than a threaded server. And evented servers can handle much more concurrent requests than threaded servers.

As far as concurrency at language level goes, very rarely have I needed to spawn a thread(I go for gevent) in the controller. Controller's job is to dispatch ASAP - everything else goes in the queue where you use EventMachine or gevent or whatever if you need concurrent processing.

> Faster server spinup and incremental changes. Rails with 20 gems in development mode is super sluggish.

Rails is more sluggish compared to "stop the world. I am compiling" Eclipse?

> Better library ecosystem! > Better dependency management system (maven > rubygems)

As long as we are just throwing out claims without backing them, ruby library and bundler/gem are 1000x better than mvn.

> Better debuggers > Better profilers

Not everyone is a fan of graphical everything. Going by this line of reasoning, Windows has better support for git because gui?

> Easier deployment and ops environment(java -jar myjar, vs bundle install, ruby/passenger/unicorns)

`java -jar myjar` starts your app server, your web server, minifies your css, js, migrates the db....? You can very well bundle the dependencies along with your app for rails, but I don't see why I would do it for a webapp. Also, your jar works only when you don't have java calling into native code. If you don't have native extensions, ruby is platform independent as well(i.e can be bundled).

> Reasonable in-process metrics

No ideas. What's that?

Re:Why isn't Java used for modern web application development? by sterwill on Sunday June 10, 2012 @08:47AM (#4090898)
Your Java IDE also lets you move methods and fields, extract interfaces from concrete classes, push members up or down, find all references to a member (reliably), view inheritance relationships, and much more. And it can do all of those safely, warning you if you'll shadow another name. I wish I had that stuff in a Ruby IDE.

I've used Eclipse for a long time, but not for JEE projects, and I don't see any "stop the world" behavior when it's compiling Java. Java compile jobs run at a low priority and rarely block another workspace job. If you want to save a file that's being compiled, Eclipse will let you and restart the build. Maybe you mean "stop the world I'm launching a JEE app?"

Re:Why isn't Java used for modern web application development? by irahul on Sunday June 10, 2012 @10:10AM (#4091081)
> Your Java IDE also lets you move methods and fields, extract interfaces from concrete classes, push members up or down, find all references to a member (reliably), view inheritance relationships, and much more. And it can do all of those safely, warning you if you'll shadow another name. I wish I had that stuff in a Ruby IDE.

Some of it isn't applicable to Ruby, and some of it has to be done manually. True that you will have to rely on tests or something to make sure you didn't shadow anything, or you renamed at all places, or you didn't rename something which shouldn't have been renamed.

> I've used Eclipse for a long time, but not for JEE projects, and I don't see any "stop the world" behavior when it's compiling Java

What machine do you use? I was using a 4 gigs, dual core machine, and eclipse regularly stalled while compiling and launching.

Re:Why isn't Java used for modern web application development? by sterwill on Sunday June 10, 2012 @10:26AM (#4091123)
I'm usually in a 64-bit Linux VM (in VMware Workstation) on a 4 core i5 Xeon from about 3 years ago. 5 GB RAM total, Oracle Java 7 with -Xmx800M for Eclipse. My workspace includes 50 projects, most of them are Eclipse plug-ins themselves.

In my experience, if Eclipse "stops the world", Java is collecting garbage. Java 6 and 7 have become much better at doing incremental collection more often (maybe parallel is the default now?) and the result is a more responsive UI. To me, Eclipse itself feels snappier over time (each release from 3.3 to 3.7 has felt better on similar hardware).

Another thing I've noticed is that Eclipse is significantly faster cleaning/building large workspaces on Linux compared to Windows on the same hardware. I assume this is a result of Linux's aggressive filesystem caching.

Re:Why isn't Java used for modern web application development? by kamaal on Monday June 11, 2012 @04:01AM (#4093627)
I thing the core point is, Large Java application development seems to be possible/doable only because eclipse is doing 90% of the work for you.

Without eclipse 90% of the Java dev work would come to a grinding halt.

And that says a lot of about Java and its ecosystem. And not to mention its developers.

Re:Why isn't Java used for modern web application development? by democracy on Sunday June 10, 2012 @09:02AM (#4090931)
''Am curious. Where in basic web development does concurrency help? As far as servers go, evented servers(thin, mongrel) will perform as good as, if not better, than a threaded server. And evented servers can handle much more concurrent requests than threaded servers.''

I don't know what is 'basic web development', but the argument 'why do we need concurrency if I rarely use it' doesn't work. I mean if you are a front-end developer/designer and mess with CSS/JS/HTML all day (without format CS education), you are probably wondering why concurrency even exists, but in real-world programming you can't go far without it.

Re:Why isn't Java used for modern web application development? by irahul on Sunday June 10, 2012 @09:56AM (#4091044)
> I don't know what is 'basic web development',

The type of web development where your controller renders a page. BTW I was quoting OP, where he mentioned he uses Java for basic web development.

> I mean if you are a front-end developer/designer and mess with CSS/JS/HTML all day (without format CS education), you are probably wondering why concurrency even exists, but in real-world programming you can't go far without it.

I said evented servers out-perform threaded servers. Threaded servers will eat more RAM and have higher cost of context switching. As far as application code goes, your controller isn't supposed to spawn threads(at least mine doesn't). The heavy-lifting should be done by the background services, and you can very well do concurrency in Ruby/Python(EventMachine, gevent). Generally, threaded code doesn't cut it where number of threads are large.

And I am pointing this out for the second time. You ignored it all and went on a tangential regarding how I am a frontend developer/designer without formal cs education, and am wondering why concurrency even exists.

> but in real-world programming you can't go far without it.

Yay. No true scottsman. All programming is real world programming, and you can go far without concurrency. Are templating engines real-world programming per your certification institute?

Re:Why isn't Java used for modern web application development? by democracy on Sunday June 10, 2012 @12:29PM (#4091458)
""Yay. No true scottsman. All programming is real world programming, and you can go far without concurrency. Are templating engines real-world programming per your certification institute?""

Oh yes, part of the real-world where concurrency (via threads) is the core of the system, not some niche sub-technology like 'slow templating PHP engine'.

Now we are not talking about events vs threads, I still can't understand why someone should be stopping from starting a thread in any point of code, front-end or back-end.

""As far as concurrency at language level goes, very rarely have I needed to spawn a thread(I go for gevent) in the controller. Controller's job is to dispatch ASAP - everything else goes in the queue where you use EventMachine or gevent or whatever if you need concurrent processing.""

If your language of choice is bad at threads (and threads are hard to implement, hard to use, hard to debug, we know that) then you are lucky you can use something else to hack your way out. But to push it as a normal standard way of doing things... what for? Java is great at concurrency. It also has 'event' frameworks for those who really need it for some very specific use-cases like networking (netty, grizzly,something from apache, etc ). For the majority of us? Threads do just fine...

Re:Why isn't Java used for modern web application development? by irahul on Sunday June 10, 2012 @12:46PM (#4091501)
> Oh yes, part of the real-world where concurrency (via threads) is the core of the system, not some niche sub-technology like 'slow templating PHP engine'.

Your claim was "you can't go far without threads in real world programming" which is now "real world programming where concurrency is the core of the system". Does it need to be said that you won't go far without concurrency in a system which needs concurrency? Isn't that a tautology?

And I wasn't referring to PHP. I was referring to Jinja2. Jinja2 is neither slow nor simple, but that's tangential. What if it's slow? Adding threads will do shit as far as rendering templates is concerned.

> Now we are not talking about events vs threads,

I don't care about events vs threads. I care about throughput(parallelism - make 5 dns requests in shortest span of time) or co-ordinating processes(spell checker thread while I type). Processes, threads, events are all implementation details.

> I still can't understand why someone should be stopping from starting a thread in any point of code, front-end or back-end.

So you are twitter. I post a tweet. I have 1500 followers. Your cute little java process spawns 1500 threads to update the timeline for my 1500 followers, and I am waiting at my browser watching the loading git. How about 15000 followers? 150000?

A controllers job is to return ASAP. Spawn threads all you want. Nobody is stopping you. I was talking about why you don't want that.

> If your language of choice is bad at threads (and threads are hard to implement, hard to use, hard to debug, we know that) then you are lucky you can use something else to hack your way out.

For the second time, I don't care about threads. Processes, threads, events, agents, transactions with STM - whatever it is doesn't matter as long as I can get the job done.

> But to push it as a normal standard way of doing things... what for?

I am not pushing it as normal standard of doing things. For the tasks I generally write, threads won't cut it(Java or no java). Take 1000 threads on a 4 core machine - we will have (memory per thread) * 1000 ram usage, 1000 threads contending for execution on 4 cores. Threads work fine for small values of n, and even for small values for n, threads itself come with a lot of baggage and extra care has to be taken to ensure correctness.

> It also has 'event' frameworks for those who really need it for some very specific use-cases like networking (netty, grizzly,something from apache, etc ).

You are responding to claims I didn't make. I didn't say Java is bad at concurrency or Java doesn't have evented frameworks.

Re:Why isn't Java used for modern web application development? by rabbitfang on Sunday June 10, 2012 @12:09PM (#4091394)
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.

Re:Why isn't Java used for modern web application development? by irahul on Sunday June 10, 2012 @12:32PM (#4091465)
> 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 remember saying it. I said "easier to refactor => high quality code" or "mvn is better at dependency management than bundler/gem"...is bullshit.

Re:Why isn't Java used for modern web application development? by rabbitfang on Sunday June 10, 2012 @04:28PM (#4092102)
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? by irahul on Monday June 11, 2012 @05:43AM (#4093841)
> Making structural changes to a large Ruby project

Only the structural changes which are some form of rename. Refactoring is more than renaming. What eclipse provide is a very limited form of refactoring. Most of the refactoring is to be done by the programmer and can't be done by the IDE.

> Pretty much anything is better at dependency management than bundler/gem.

Yeah. How so?

> If you have to compile your dependencies at install time you're probably doing something wrong.

1. There is no compilation when the code is ruby.

2. When there are native extensions, the compilation is required. Dev platform isn't the same as production most of the times, and precompiled so can't be bundled up.

3. If there are only ruby dependencies, `bundle package` will pack them in vendor/cache and next `bundle install` will install from the cache.

> Not to mention the version incompatibilities between gem versions and syntax changes.

How has this got to do with anything? I am maintaining a gem. In this version, it does pagination. In next version, it will delete your home directory. Version compatibility you say? Go cry me a river. What is bundler supposed to do? Does maven stop me from doing this?

Re:Why isn't Java used for modern web application development? by rbanffy on Sunday June 10, 2012 @11:18PM (#4093068)
You do, of course, understand that when a Ruby project gets large, it's still about 10% the size of a similarity functional Java project, right?

I don't like all the magic involved in Ruby for web (in particular Rails), but it's much more concise than Java.

Re:Why isn't Java used for modern web application development? by thebluesky on Monday June 11, 2012 @03:48AM (#4093593)
That doesn't mean that Ruby is so compact that it's impossible to get a large code base in it. When Ruby projects get large making changes to the code is both painful and scary (I would know since I've had to do just that).
Re:Why isn't Java used for modern web application development? by rbanffy on Monday June 11, 2012 @09:46AM (#4094529)
Is your codebase well covered by tests? Do they still run after the change? Did you write tests for the change you just made (preferably before the change)? If you answered yes to all these questions, fear not. You are every bit as covered than you'd be with a Java codebase and you probably have the afternoon for code review.
Re:Why isn't Java used for modern web application development? by kamaal on Monday June 11, 2012 @03:58AM (#4093620)
>>"It's easier in Java to rename identifiers than ruby, because my IDE does it for me."

This has got to be the most honest statement in this thread.

Re:Why isn't Java used for modern web application development? by rabbitfang on Sunday June 10, 2012 @11:43AM (#4091333)
You do realise there is more than "renaming variables" to refactoring don't you?!?
Re:Why isn't Java used for modern web application development? by irahul on Sunday June 10, 2012 @11:49AM (#4091344)
> 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.

Re:Why isn't Java used for modern web application development? by rabbitfang on Sunday June 10, 2012 @04:41PM (#4092135)
>> 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? by irahul on Monday June 11, 2012 @05:53AM (#4093861)
> Perhaps you could name this mysterious IDE

Is it just you, or does everyone using eclipse take "what eclipse does" to be refactoring?

I didn't mention IDE even once. A small part of refactoring can be done by eclipse. Rest of it is to be done by the programmer.

I am not a Fowlerian, but this is the only reference I could find. http://www.refactoring.com/catalog/index.html

Eclipse helps with a small subset - rest has to be done by the programmer. And most of it is easier to do in Ruby than in Java.

Compare the ruby edition http://www.amazon.com/Refactoring-Ruby-Edition-Jay-Fields/dp... to the java edition http://www.amazon.com/Refactoring-Improving-Design-Existing-...

On an average, ruby code ends up easier to modify and concise.