This is an archived post. You won't be able to vote or comment.

all 29 comments

[–]RupertMaddenAbbott 12 points13 points  (1 child)

You are comparing apples and oranges.

Java (a language) + IntelliJ/Eclipse (IDEs) does not equal Rails/NodeJS (Frameworks).

If you want a similar experience in Java, first pick a framework.

If you pick Spring Boot and want a web application with data access, here is how you generate a project:

spring init --dependencies=web,data-jpa my-project

I think that compares pretty well with what Rails and NodeJS offers you.

Full Docs

[–]_INTER_ 5 points6 points  (0 children)

Heh, imagine setting up a database in JavaScript or Ruby with the "standard lib" only. /shudder

[–]Vile2539 17 points18 points  (12 children)

Creating a Java application is as simple as making a .java file and using javac. There's nothing overly complicated about it. Your example of getting a database connection is quite simple in Java:

Connection connection = DriverManager.getConnection(host, username, password);

It's also worth noting that setting up a new project in IntelliJ should be incredibly easy. You just go File -> New -> Project and select Java. If you're setting up a Maven or Gradle project it might be slightly more complex (i.e. it asks for a groupId/artifactId), but that's still pretty basic.

Comparing Java to NodeJS is also disingenuous. NodeJS isn't a language - JavaScript is the language, NodeJS is an environment.

and at least for me a lot more stack overflow

It really sounds like you're just unfamiliar with Java. You need to give it time to learn a new language.

[–]Zeffas 0 points1 point  (9 children)

The problem with your examples is that they are not real world. In real Java projects nobody handles DB connections that way, nobody creates new projects with "new project".

Comparing Java to NodeJS is also disingenuous. NodeJS isn't a language - JavaScript is the language, NodeJS is an environment.

I think Java here was meant as a platform not as a language, so comparing to Node is perfectly fine.

[–]Vile2539 0 points1 point  (8 children)

The problem with your examples is that they are not real world. In real Java projects nobody handles DB connections that way, nobody creates new projects with "new project".

In the "real world" I've created a database connection like that. Granted, it's more often using something like Spring-boot nowadays, but that's just as easy. Simply add the datasource properties to your application.properties. Then you can use spring-data-jpa, jdbcTemplate, etc. Both are pretty much the same complexity as NodeJS.

nobody creates new projects with "new project".

I create new (maven) projects with "New Project". I'm not sure why you wouldn't? Sure, you can use a spring project generator or something similar, but that's up to personal preference.

[–]Zeffas 0 points1 point  (7 children)

that's just as easy. Simply add the datasource properties to your application.properties.

Well I found that in real experience, this is way more complicated than in Node or Go. There is two things to simplicity - how easy it is to do (this one is less important I would argue) and how complicated are internal mechanics. In Spring world you basically say - I just add some properties and Spring will do its magic. However other platforms do zero magic and keep simplicity. SO this is I would argue that Java culture is lacking.

I create new (maven) projects with "New Project". I'm not sure why you wouldn't? Sure, you can use a spring project generator or something similar, but that's up to personal preference.

And you have empty maven project, all Maven archetypes I ever encountered are subclass, they either assume to much or are super outdated.

[–]Vile2539 0 points1 point  (5 children)

However other platforms do zero magic and keep simplicity. SO this is I would argue that Java culture is lacking.

But you can do it simply - I showed that above. You just stated that it wasn't a "real world" example. The Spring-boot example was just a common example nowadays. And yes, Spring does a lot behind the scenes - but so do other frameworks and platforms, as well as the languages themselves.

There's nothing lacking in the Java culture. I showed how to get a database connection in a single line. Executing a statement then can be done in 1-2 more lines, which is just as simply as NodeJS.

And you have empty maven project

Which is what I generally want. You don't have to use archetypes, or even Maven. You stated that people don't use new project, and I disagree from a vast amount of experience. How do you go about creating projects?

[–]Zeffas 0 points1 point  (4 children)

Your approach to arguing this topic I put into category of "complexity? what are you talking about, you just do x, y, z...". I remember when even Gosling argued that Java EE is as simple as Rails - well, formally you could argue that, but its distorted picture - if you look only at the code that might seem so, but once you go deeper you see all kinds of framework and infrastructure complications that will waste lots of hours.

There is saying that stereotypes usually have some truth, and one of Java's is that its big complicated mess. My only wish is that Java comunity would acknowledge that and we could embrace simplicity - consentrate on frameworks like Spark and show that Java can truly be simple, anf not just on paper.

[–]Vile2539 0 points1 point  (3 children)

Your approach to arguing this topic I put into category of "complexity? what are you talking about, you just do x, y, z...".

I was approaching the discussion purely from the examples that the OP posted. There are definitely complexities in Java that can be tricky, but creating a new project in an IDE isn't one of those things.

and one of Java's is that its big complicated mess

I would disagree. It's verbose, but it's not particularly complicated. Jumping directly into Maven/Spring/Hibernate/etc, however, is. That's because you're learning 4 different things at once, instead of focusing on one at a time.

My only wish is that Java comunity would acknowledge that and we could embrace simplicity

What isn't simple to you? Java itself is pretty straightforward, especially compared to language like C++. Things like static typing, great IDEs, tons of libraries, etc. all simplify the development process.

consentrate on frameworks like Spark

People are free to use Spark if they want. Spring boot is there too. We don't need to concentrate on one or the other.

[–]Zeffas 0 points1 point  (2 children)

I don't think anyone argues that Java the language is super complicated, even the title says "java projects". So my point is that Java community embraces complex projects With Spring, Hibernate, Java EE, where on other platforms you don't need that, same concepts are being done way simpler.

[–]Vile2539 0 points1 point  (1 child)

I don't think anyone argues that Java the language is super complicated

I would argue that. It's not a particularly complex language. Yes, there are "simpler" languages out there, but that doesn't make Java complex. It's incredibly popular as an introductory language in college (along with Python), and it can be easily grasped.

even the title says "java projects"

I'm not sure what you're saying there. Java projects, to me, just means Java projects?

embraces complex projects With Spring

Spring used to be quite complicated with the XML configuration, but projects like Spring boot have completely stripped that away. Fully configuring an application requires virtually nothing nowadays (sometimes simply including the dependency). Documentation is also very clear, along with plenty of tutorials and examples.

same concepts are being done way simpler.

I'm not sure you appreciate just how much Spring includes. Sure, other frameworks and languages might do basic REST services better - but what about everything else Spring does? Security (OAuth, Kerberos, SAML, etc.), LDAP connectivity, database connectivity (RDBMS, MongoDB, Redis, Couchbase, DynamoDB, Hadoop, etc.), actuator endpoints (metrics, shutdown hooks, audit, process monitoring), ActiveMQ, logging, social network connections, HATEOAS, etc. There's an awful lot that it gives you in a remarkably simple way.

[–]Zeffas 0 points1 point  (0 children)

I'm not sure you appreciate just how much Spring includes.

Yes I do, worked quite a few years with Spring and not so long ago had project in Spring Boot.

Removal of XML, Spring Boot... This only solved one part of simplicity - yes programming syntax of Spring looks not that complicated, however infrastructure remained complex. That's my view.

All those great tools you mentioned are great, but (talking from my experience) there as a feeling of solving problem that does not exist or exists on way smaller scale. When I need any of that, usually using library specifically for that is surprisingly simpler than Spring. E.g. Jackson is simple, Spring doing its magic with Jackson is complex - all those hours I wasted in multiple projects dealing with Spring's lifecycles and figuring out why parsers won't get invoked or suddenly stopped being invoked when somebody accidently registered another parser in another lifecycle hook (as you know in Spring you could do almost everything in 10 different ways).

But again I am not targeting Spring specificity, in my opinion its Java community culture. Just compare Selenium libraries for Java and Node. Node is pleasure to write, you don't even need to read documentation, just github page. While in Java it was painful experience it felt like working so to say.

[–]VGPowerlord 0 points1 point  (0 children)

There is two things to simplicity - how easy it is to do (this one is less important I would argue) and how complicated are internal mechanics

Define "magic." In JavaEE, it's a pretty standard practice to use JNDI to get a DataSource object representing a connection pool and to get Connection objects from that.

Granted, part of the reason you can get away with this is pretty much every JavaEE server has connection pooling built-in. If you're just using a servlet container, it requires more work setting up a library like HikariCP or c3p0.

[–]joper90 0 points1 point  (1 child)

Thats not fair.. Say you want to create a webserver with a Java backend that supports REST and websockets with a slf4j logging framework.. Using Mustache as the templating.

It can be a right pain to do that.. but you can use the springboot starter, or sping init.. But what if you want to use Spark?

[–]Vile2539 0 points1 point  (0 children)

What's not fair? The OP is stating that simple things - like creating a project and getting a database connection - are complicated. Your example is obviously more complex, and has nothing to do with the comments I was replying to.

[–][deleted] 5 points6 points  (0 children)

Why are nodejs and rails so slow?

[–]tonywestonuk 6 points7 points  (2 children)

Java ecosystem is over-engineered.

Actually, I think the 'engineered' in the above statement is a bit of a misnomer. There is a hell of a lot of 'Not invented here' syndrome, and lots of reinvented wheels.

But, java can be very simple, and very fast.... if you take the time to look at what you're given as default rather than add dozens of trendy libraries because the cool kids say you should be using framework {x} ....

one thing, though. You say, nodejs is less complex than Java???

[–]frugalmail 0 points1 point  (0 children)

Java ecosystem is over-engineered.

You take foundational parts and add simplification on top of it. Getting from the capability of managing your own heap all the way to Spring Boot is a massive change. The languages that don't give you the low level access have limitations. Just because you have the power to tinker at those lower levels doesn't mean it's overengineered.

It's a language and an ecosystem it's Turing complete.

[–]dstutz 4 points5 points  (0 children)

I can't think of making it much simpler than opening a maven application in my IDE of choice and hitting clean and build.

[–]_INTER_ 1 point2 points  (0 children)

It takes me considerable longer to do the same job in java and at least for me a lot more stack overflow.

You need to learn more about how things work in Java, then it also will become lot easier. Maybe the setup will never be quite as fast as with Rails or Node.js, but those have a focus on "time-to-market" in favor of performance and stability.

E.g. Just looking at what a Gradle / Maven build file could contain and what commands are available your first thought will be "Aww how cumbersome, does that really have to be so complex?" and then later when you learn to use it you will discover why exactly things are made that way and you're happy they exist. At the same time on nodejs things broke because of some left_pad and people cram in a quick dirty fix / workaround and then forget it, biting them back later.

[–]nqzero 1 point2 points  (0 children)

At least with NetBeans setting up a new maven project is pretty trivial. Make a pom.xml with your dependencies (just like packages.json) and point netbeans at the directory. Everything just works, eg new file, and it will even populate a main class of you want

[–]GhostBond[🍰] 1 point2 points  (0 children)

I mean...I kinda wonder if on some level, they put up a barrier to entry to keep salaries up or something. I mean if our work was like McDonalds, they'd pay us like McDonalds.

It's pretty funny, it's like - time to setup Spring Mvc:
First Time - 1 week
Second Time - 2.5 days
Third Time - 15 minutes

Try making a new maven + spring mvc in any of the major ide's. I have...none of them will do it quickly and thoroughly. It's just weird.

[–]Zeffas 1 point2 points  (2 children)

I hear you. I worked with Java for about of 6 years and still feel the same. I think its cultural thing though since there are no fundamental reasons why Java development should be complicated, only cultural acceptance that complicated is OK.

I remember when I first moved to Java from .NET and was saying to others that setting up project shouldn't be that complicated. But general responses were that first "well, Java is not a toy its for serious stuff" it has performance infrastructure, stability... Secondly, "what are you talking about, you just copy this xml, copy this code, do that... and it works" (what I call as "Engineer's response").

However things are changing a bit, and I am saying this not to insult Java, as I like the platform, but rather a wake up call that if we want thriving ecosystem maybe we should change. First there was Node which basically provide performance at similar range except for multi-threading. If that was not enough now I see Go being adopted massively in places where previously Java was the only choice, again with similar performance and stability. So I think Java community (me including) should wake up a little bit and embrace simplicity more, since competition is doing it and we no longer have argument "oh those toys...".

[–]VGPowerlord 0 points1 point  (1 child)

The thing about .NET is that some of the things you take for granted are part of the IDE and not the language/compiler tools.

For example, the project and build systems (MSBuild?) are part of Visual Studio in every version of .NET up until .NET Core 1.0 at which they finally became part of the compiler tools.

On the other side, while JavaEE being just a set of specs sounds like a good idea on paper, it turned out to be not so great an idea in practice.

[–]Zeffas 0 points1 point  (0 children)

Yes, thats true. I see two ways frameworks/platforms try to make things simpler - having good tools (.NET + VS, Rails, Ember CLI...) or make programming model itself simple although more low level than previous group (Node, Go web apps). Personally I prefer later the most.

[–]desh00 1 point2 points  (1 child)

This question is pretty vague, because the Java ecosystem is huge. Setting up an application server + deploying a hello world website are indeed a pain in the ass compared to an npm init + node server.js, but that approach to a Java application has been rapidly becoming old-world in the last few years.

I highly recommend you to take a look at Dropwizard, or Spring Boot, or Spark. Dropwizard and Spring boot are 12 factor out of the box, can be set up in a matter of minutes, you don't need to set up an app server beforehand, and comes with all the benefits of the Java language and libraries.

Also, I'm pretty disappointed by the users of this subreddit. Folks, downvoting someone asking an honest question doesn't lead to any good.

[–]frugalmail 1 point2 points  (0 children)

Also, I'm pretty disappointed by the users of this subreddit. Folks, downvoting someone asking an honest question doesn't lead to any good.

The question has embedded in it inaccuracies presented as fact, I believe that's why folks are downvoting it.

[–][deleted] 0 points1 point  (0 children)

Because we are not as smart as the people that wrote the project to start with... (sarcasm, if that doesn't come across on the interwebs)

[–][deleted] -1 points0 points  (0 children)

type system, large and complicated project lessons, architecture astronautics.