r/programming • • Feb 22 '15

Java Makes Programmers Want To Do Absolutely Anything Else With Their Time

http://www.forbes.com/sites/quora/2015/02/21/java-makes-programmers-want-to-do-absolutely-anything-else-with-their-time/
35 Upvotes

636 comments sorted by

View all comments

25

u/DJDavio Feb 22 '15

I feel that the learning curve for making a solid real-world Java application or library is quite steep.

Imagine a newbie learning Java for the first time: Within minutes he has created his "Hello World" command-line program. But in the real world, everything has to be a dynamic web application so he dives into Java EE. Hmm, I need to host my app in a container, huh? Okay, I'll install Glassfish/Wildfly. Hmm, I need to output some JSON, but the default javax-libraries suck at this, let's see what's out there, GSON that looks okay, let's download it and put it in my lib folder....

The next day, a new version of GSON is released, so our newbie thinks "hmm, this is not a very effective way to manage my dependencies, there must be something to make this easier... oh, Maven, let's check it out!"

About a month later our newbie finally understands that group is mostly just a fancy name for project name and artifact is a fancy name for a library or application created within the project.

Now that his application is evolving he starts to think about testing, hmm, JUnit, let's add that and do some unit testing. Oh, but how do I unit test my spaghetti? Every object I create, creates many other objects. Can I just pretend that I have an object without triggering my entire application code? Enter Mockito. Oh and add Arquillian to make it more complex.

Finally, he has a Java EE app with dependency management, unit testing and mocking and btw he added it to source control. He chose Git because it seemed cooler than SVN.

But he's tired of doing everything manually and googles for "automatic building" and stumbles upon tools like Jenkins.

About half a year later, he feels he's finally comfortable of being in the real-world Java environment where there is a lot of stuff that isn't actually Java.

I don't know whether C# has the same problems or whether it provides a more complete ecosystem out of the box, but the hard part about Java is not the code itself, it's learning the ecosystem.

2

u/[deleted] Feb 23 '15

I just started my first software engineering internship and I can confirm there's a huge difference between knowing how to write some classes in Java for school and developing for an enterprise web app. And its exactly how you describe where I've spent the last 6 weeks figuring out everything that ISNT java before I finally realized that these things were being generated by / for use by Java.

1

u/DJDavio Feb 23 '15

I learned Java at university/college.

But in the real world I started out with C#/.NET. It was pretty easy to create something out of nothing and have it be not too far away from an enterprise application. I could develop in the standard IDE everyone used (Visual Studio), added Entity Framework, tested with MSTest and even did some remote debugging!

But then I switched jobs and had to do Java programming. First thing was to look for an IDE, hmm, there seemed to be an official one (Netbeans), but it isn't used much. IntelliJ costs money, so let's go with Eclipse.

Now, how do I setup my project? Maven dictates some structure so I guess I'll follow that one. But oh no! My colleague uses Ant and has his own folder structure. These steps were repeated for basically everything in the build cycle.

1

u/[deleted] Feb 23 '15

yeah i did mostly c++ in college now doing java in real world, project seems to use gradle/spring took me quite a while to figure out where everything lives, but it seems really manageable now. If i can figure it out in a few weeks, its doable. I feel like some CS people want everything handed to them on a silver platter and then "code here" but, seriously if real world was like that, CS jobs wouldnt be a big deal. Its supposed to be challenging and change the way you think about things, like my mom says if it was easy then anyone could do it.

0

u/DJDavio Feb 23 '15

I often feel like the Java ecosystem is like a giant Rube Goldberg machine. You have to use so many 3rd party libraries and tools just to make a simple application.

1

u/[deleted] Feb 23 '15

i come from the world of car mechanics where everything is named exactly what it does, (eg compressor compresses, alternate makes alternating currrent) and learning java, groovy, spring, hibernate, solr, hadoop etc has been a mindfuck. still a good time though! =D

3

u/[deleted] Feb 22 '15

I fully agree with this. The thing that makes Java bad is that it's old, and just keeps accumulating "things" that you need to know to be good at it. The amount of mental baggage that a developer needs to juggle distracts them from their focus on writing concise programs.

I remember working with some developers a while back that were relatively new to Java, and being frustrated because they weren't using some widely adopted packages and practices that make Java friendlier. Then I thought to myself, "Why isn't this built into the language?". The problem isn't Java itself; its that Java + "everything else" is too much to expect from an average developer.

That's what I like about Go. Sure, I can accomplish the same exact things in Java, but I have to add dependency x, process y, etc to get the same thing as the builtin features of Go. There's less to juggle in my brain. Will Go become bloated? Probably. Old languages always find a way. But I'm enjoying it in the meantime.

3

u/[deleted] Feb 22 '15 edited Feb 22 '15

[removed] — view removed comment

1

u/[deleted] Feb 22 '15

It's not a provider - it's in the language runtime. Yes, of course you have to learn it, but the amount of mental overhead involved is far lower.

I remember when Java first hit the scene - it was popular because the java.sql package was in the JDK itself and not some bolted-on thing. Same with collections. People loved that. Maybe you were around to remember this? It's a similar thing with Go.

2

u/I_Like_Spaghetti Feb 22 '15

What do blondes and spaghetti have in common? They both wiggle when you eat them.

3

u/DJDavio Feb 22 '15

How would Hannibal Lecter interpret this joke?

1

u/troyunrau Feb 22 '15

Chatting with a robot that eats people... I think it replies to all comments with spaghetti in them. Maybe once per thread, so it doesn't over saturate and get banned.

1

u/[deleted] Feb 23 '15

How would Hannibal Lecter interpret this joke?

Literally.

0

u/[deleted] Feb 22 '15

[deleted]

6

u/txdv Feb 22 '15

You have one unit testing framework: MSUnit.

xunit

nUnit

shouldly

testdriven.net

1

u/lacosaes1 Feb 22 '15

From those only xUnit.net and NUnit are widely used.

1

u/txdv Feb 22 '15

I use xUnit, but I want to give shouldly a try, because the syntax is so nice and the error output formatting is awesome.

1

u/drysart Feb 22 '15

Unit testing is a big area that the holdouts I mentioned are still around. NUnit/XUnit are still out there, but increasingly they're being overlooked in favor of the integrated solution. (Alternate ORMs like NHibernate are another example of an option that's out there, in use, but less so as time goes on.)

I'm not making a value judgement on whether that's good or not, it just is.

0

u/lacosaes1 Feb 22 '15

xUnit.net us being used by Microsoft.

1

u/s73v3r Feb 22 '15

Those examples are all things that are largely created by, or endorsed by Microsoft. What's the situation for things that Microsoft hasn't weighed in on?

1

u/jared314 Feb 23 '15 edited Feb 23 '15

The upside drysart mentions, having one major solution, is also its downside. Microsoft is normally ~3 years behind other platforms, and .Net shops generally stick with MS tech. This creates a "glass ceiling" that forces developers, who seek more advanced solutions, to move away from the .Net platform. There is an open source community around .Net, but it is not a thriving ecosystem. And, getting an open source solution approved on a project is generally an uphill political battle.

0

u/Dworgi Feb 22 '15

C#'s biggest hurdle is Visual Studio project settings.

But once you have that figured out (and, to be fair, the default settings do work), most of the rest is included.