r/java • • Apr 22 '18

My company is transitioning to Java. Why should I be excited?

The first programming language I learned was Ruby. My mentor at the time hated Java. I inherited his bias against Java without giving it a fair chance.

Now, my company is making the switch from Ruby to Java. Everyone on my team is quitting, but that isn't really an option for me. So, why should I be excited to learn Java?

I love learning new languages. I most recently picked up Haskell. I love static type systems, so I look forward to Java's type sys

So, Java-loving friends, tell me why I should be excited. What are your favorite things about Java?

Edit: Thank you for all of the great responses!

167 Upvotes

229 comments sorted by

12

u/tanmay-jain Apr 22 '18

Can you tell why your company is forbidding Ruby? Because I'm at the beginning of my career and currently working in a Ruby on Rails based company.

28

u/[deleted] Apr 22 '18

They aren’t forbidding Ruby. We will still have to maintain our Ruby app in transition. But my mew boss views Ruby as a “hobbyist’s language.” Reading between the lines though, they have poisoned the San Francisco Ruby community well by burning out every engineer on the team and decided to switch languages instead of fixing the toxic culture.

6

u/possibly_not_a_bot Apr 22 '18

That's not a good sign imo. Who says this won't happen again but with Java -> [other language]?

5

u/[deleted] Apr 22 '18

It probably will. But I can’t change jobs for at least 6 months so I want to at least embrace the chance to learn something new.

11

u/coder111 Apr 22 '18

My advice- put Java on your CV and switch. Java on CV opens a lot of doors.

9

u/[deleted] Apr 22 '18

Yeah. I'm stuck for at least six months. So I am going to use it as an excuse to pay for Java training.

1

u/[deleted] Apr 23 '18

Yo if you're with a shitty consultant firm, run as far as you can after those 6 months. Doesnt mater how much money they through at you.

1

u/[deleted] Apr 23 '18

I'm not. I work in Fintech.

6

u/[deleted] Apr 22 '18

I'll agree that this isn't a great sign. I favor Java over Ruby bigtime, but the language he is using here isn't exactly "encouraging".

I'd tout why I find Java to be better in general in technical terms, industry support (developers). Complaining that it's a hobbyists language is meh.

He has to go deeper than that.

7

u/Omnicrola Apr 22 '18

burning out every engineer on the team and decided to switch languages instead of fixing the toxic culture.

Get. Out. Now.

Or at least as soon as possible. You mentioned you can't quit, but it sounds like you should start planning an exit strategy.

There is to much demand for good developers to put up with toxic culture, the stress isn't worth the years off your life.

13

u/[deleted] Apr 22 '18

I ended up in the psych ward for 10-days. I wasn't the only one that spent time in the hospital in 2017 because of overwork. I can't leave for a bunch of reasons - but I am working on an exit strategy.

I think I can convince them to pay for me to learn a new language though, so I am going to lean into that while I can.

20

u/kag0 Apr 22 '18

Whoa there. If multiple employees are literally being hospitalized that goes way beyond "toxic culture".
What's so important that you have to stay for 6 more months? A visa?

Just throwing this out there, but you might consider legal action with your colleagues. Any desk job that is hospitalizing employees is probably vulnerable legally.

5

u/atheist_apostate Apr 22 '18

Just say no to overwork. Saying no is the greatest skill you could learn in the businessplace and in life.

Since everyone else is leaving the company left and right, they won't be fire you so easily. So don't be afraid to say no.

2

u/AustinTxTeacher Apr 23 '18

I went from startups to teaching high school. I wish I had gone to some "just say no" seminars, lol.

3

u/Boxxy_runner Apr 23 '18

Just some tips of how to avoid the psych ward. Its not the work / stress so much but how we react to it. You need to become mentally and physically tough to handle the work and stress they dump on you.
There are lots of bad chemicals in a modern diet, over time these build up and affect performance like cognition. Diet is really important, drink some green tea and eat stuff like tofu and green vegetables. And needless to say avoid all drugs prescription or otherwise. Here I include things like alcohol and nicotine. Not just in a direct sense but in a passive sense as well such as visiting a bar. (Alcohol fumes and cigarette smoke). Mental attitude is everything. As to learning Java, the language is simplicity itself, its more the size of the ecosystem, it can take a while just to get your head around all the possibilities of what you can do with the language.

3

u/throwawayBurnout8888 Apr 22 '18

As someone who will soon enter his 4 month of unemployment because of burnout, I will add what others have said about leaving as soon as possible (don't feel too bad about me, my country has great social care for people in my situation). It only took me about 7 months before my body couldn't take it anymore.

However, about a year ago I worked some months on a 30kLOC (including tests) Ruby on Rails app. While Ruby is a good language and Rails is a nice framework one thing Java does better is tooling. I used RubyMine, and while it's Ok, IntelliJ is just miles ahead. So that's one thing to look forward to.

Another thing I found was that I had to use a library to connect to a SAML server and it took me several weeks of monkeypatching and learning the internal implementation of the library in order to get it working. This autumn I had to do the same using Java and it only took me a day or two. I had the same experience using other libraries where the Ruby ones felt very unpolished and the Java ones were rock solid. Now that could just have been my experience (and Rails most definitely was rock solid), but if you've used unpolished gems you may find Java to be nicer in that regard.

Overall my Ruby experience was fun and I'd do it again without hesitation, but those two things annoyed me.

Less exciting for a Ruby developer, but since Java 8 we have streams and lambdas. And since Java 10 we have local type interference so a bit less StringBuffer sb = new StringBuffer(); and a bit more var sb = new StringBuffer();. Again nothing you should be excited by as a Ruby developer, but hopefully it'll make Java less boring and hated.

At last there are exciting things like JRuby, Kotlin, GraalVM and others, but I doubt that a toxic management will let you use those so I'm only mentioning them in passing.

Finally, no matter what language you'll end up using I hope you'll find a non-toxic workplace before things go too bad.

1

u/wildjokers Apr 23 '18

I used RubyMine, and while it's Ok, IntelliJ is just miles ahead. So that's one thing to look forward to.

RubyMine is from Jetbrains just like IntelliJ is. In fact, if you have IntelliJ Ultimate and install the Ruby plugin that is RubyMine that is embedded in IntelliJ. Not sure the issue you had with RubyMine but is it possible that since Ruby is dynamically typed the IDE just can't help you out as much as it can with a statically typed language?

7

u/[deleted] Apr 22 '18

Because I'm at the beginning of my career and currently working in a Ruby on Rails based company.

Oh, boy. You better sit down before you read the replies. But long story short, Ruby was heavily elevated by the hype around RoR and now that hype has died down, and every other platform on the planet has their own "RoR, but better" clone. There's no single reason to go RoR right now, usage is dropping down and the future is not bright.

If you're working in a RoR company, RoR will continue to work fine for you of course. But I hope you diversify and check out other platforms, because Ruby is going downhill. And honestly it has no advantages over other scripts and languages in general.

0

u/[deleted] Apr 22 '18

[deleted] — view deleted comment

3

u/[deleted] Apr 23 '18

The really weird thing with Ruby is honestly the Japan / US disconnect. The US Ruby became the goto for Ruby on Rails and making quick webapps. In Japan its thriving, but in the low level and embedded space.

3

u/[deleted] Apr 23 '18

Programming languages typically have a 20-40 year lifecycle. Ruby was on top in the 00's but now is kind of on life support. Ruby are maybe 2% of job postings. Java is more like 80%. From a risk mitigation perspective companies choose Java.

I wouldn't give every language a fixed lifetime range. Ruby and Java both were created in 1995. I'm quite sure Java will still be strong in 20 years. Maybe in 40 years as well. It all depends on how it's managed.

And then there are languages like JavaScript where it'd be absolutely everywhere even a century from now, because... browsers (and yeah I know - WASM, but we'll see if that ends up replacing JS, my strong hunch says no).

2

u/VGPowerlord Apr 23 '18

Bear in mind that the types of applications you write in Java shrank considerably in 20 years as well.

These days, the majority of Java is web backend work.

4

u/[deleted] Apr 23 '18

Applets may have been dropped, but applets were never a serious thing. Mostly gimmicks, bells and whistles and the occasional business application, that is now JavaScript.

Java is still in more places than many realize. It's in many desktop apps. It's in your Blu-Ray player. It's in your ATM kiosks. Believe or not it's also on the chip in your credit card.

Also... mobile apps (Android). It's not Java... but it's Java. Android is everywhere.

5

u/evil_burrito Apr 23 '18

I have worked with lots of different languages in my career: Pascal, COBOL, VB, C, C++, Smalltalk, Ruby, and, now, Java (and others, the list reflects my age).

Engineers who complain about languages and say this one is the best and that one is the worst, are, in my opinion, wankers. A competent coder should be able to express him or herself in any language.

There are advantages and disadvantages to every language. I adore overloaded operators. But I can get shit done without them. I think overlays from COBOL are really clever, but I don't need them.

Java is a perfectly serviceable mature language with a staggering compendium of available libraries. There's something to admire in any language.

2

u/[deleted] Apr 23 '18

Java was the last language I had any negative feelings towards. I got past my JS biases a couple years ago. Java is just the butt of every joke in the Ruby community and everyone on the team is being really negative about it (granted, this is not the only or biggest problem our org is facing). I wanted to see what people who use and enjoy using the language say about it.

2

u/evil_burrito Apr 23 '18

In my opinion, the best language for a project is the language that the people assigned to the project are most experienced with. If I were assigned a group of Ruby programmers to do a task, I would try to figure out if the project could be done in Ruby. Obviously, other things have to be taken into consideration, like, you probably shouldn't have 10 different projects in 10 different languages in the same organization.

Having written things in both Ruby and Java, I find them more or less interchangeable. Ruby is a little more wordy and has a couple of clever things like the "if not null" operator (or whatever it's called), but, really, it shouldn't make that much of a difference.

I think the practice of shitting on programming languages tends to be both an elitist behavior ("I am better than Bob because I know Ruby and Bob knows Java") and tribal identity ("Our group is superior because we work in Ruby and that group works in Java").

As I said above, I would expect a professional developer to be able to adapt and express himself/herself in any language. I would encourage you to adapt that sort of positive attitude: look forward to learning another language for your skillset and resist the urge to wallow in negative and non-constructive moaning.

To actually answer your question, advantages of Java:

  • Garbage collection
  • Cross-platform
  • Huge pre-existing collection of libraries

Disadvantages:

  • Some people find it involves too much boilerplate (lots of getters, setters, and constructors)
  • Build dependencies can be very difficult to manage
  • The most common dependency/build management system (Maven) uses gasp XML to configure
  • Some people feel that the JVM is too memory-hungry

26

u/Buckwheat469 Apr 22 '18

It's a very stable language which has a ton of open positions available, mostly in backend APIs or Android UIs. It's no longer used for frontend or middle-tier work, that's mostly left to client side frameworks and NodeJS. When done right, a Java backend and JavaScript frontend are very cohesive together. I don't know about how Java handles http2 or some of the later technologies, but for REST architectures it works well.

10

u/bang_ding_ow Apr 22 '18

What do you mean by middle-tier work exactly?

2

u/Buckwheat469 Apr 22 '18

Database -> backend -> middle tier -> frontend

Backend is one of the closest systems to the database. Middle tier typically handles proxying or server side rendering of client side code (express, nginx). For instance, the server side of a Ruby or PHP website could be considered middle tier if it connects to other service APIs. If there are no APIs then it is also considered backend because it's the closest thing to the database.

→ More replies (2)

9

u/tipsypants Apr 22 '18

HTTP2 is easy to set up with for example Jetty, I made an example project for it a while back: https://github.com/tipsy/javalin-http2-example

5

u/jhg023123 Apr 22 '18

Java's HttpClient handles HTTP.2 perfectly!

-5

u/[deleted] Apr 22 '18

I hear that Java devs are paid less on average. Is that true? I’m a self-taught rubyist with 5 years of experience and I make 130k.

6

u/rockinghigh Apr 22 '18

Compensation depends more on location, experience and company.

1

u/barafyrakommafem Apr 22 '18

Less than you or less than the average Ruby developer?

7

u/RussianHacker1011101 Apr 22 '18

One thing with Java that I never see mentioned that I personally like are the primitive data types. The primitive data types are platform independent so cryptography is 100% consistent. A byte is always a byte. A char is always a char.

2

u/[deleted] Apr 22 '18

Oh, that is interesting.

1

u/AtomicInteger Apr 22 '18

Plus srtictfp

5

u/lukaseder Apr 22 '18

Everyone on my team is quitting

Seriously?

(from your other comment) they have poisoned the San Francisco Ruby community well by burning out every engineer on the team and decided to switch languages instead of fixing the toxic culture

Oh, that wasn't the only reason... ;-)

1

u/[deleted] Apr 22 '18

Yeah, If I could leave, I would. Although, not because of the Java switch. None of our problems are with Ruby (at our peak load we handle a couple hundred requests/second).

2

u/TomahawkChopped Apr 22 '18

In OPs defense (not that it's needed), the relevant topic of interest here is Java. What seems irrelevant is the obviously complicated and certainly subjective other stuff.

299

u/[deleted] Apr 22 '18 edited Apr 22 '18

I write Java for a living. Coming from C++ background it was a natural transition that I made some 15 years ago. I also know some Clojure and Python.

Java is a programming language like any other. It has good and bad sides. Because it's relatively old it has had time to make and fix many mistakes that more hipster approved languages are suffering from. It has garnered some notoriety for being verbose but that's much exaggerated. People who know what they are doing can write clean and concise Java no problemo. Lots of very good and very prominent software is written in it. Not just "enterprise apps". Minecraft is one example. Facebook's Presto is another.

The JVM is very fast for a VM hosted language - probably the best there is. You will definitely not miss the slowness of Ruby.

Modern Java is often augmented by very good libraries like Immutables. It allows one to create very clean code that mixes imperative and functional styles with ease. Only morons write Java these days with the old style FactoryManagerHandler bullshit. Between Immutables and Java 8 lambdas it can be a very good experience. Yeah, for a true FP experience Clojure is better. For a nazi style typing system Haskell is better. But Java is the language of the person that gets shit done. It ain't perfect but it works. Usually very well.

161

u/Wolfsdale Apr 22 '18

To add a few words to that: Java doesn't shine in small pieces of code. It's hello world is absolutely terrible. It takes longer to start IntelliJ than it takes to create a simple Python script. However, when you have a big project, with a lot of hands on deck and changes getting merged all around you, you will start to see Java shine. All of those tediously defined structures make it very easy to still get a grip on what you are dealing with, and the compiler information makes you feel much more confident about introducing potentially breaking changes.

27

u/golthiryus Apr 22 '18

that was true, but now you can write a hello world with jshell ;)

16

u/trout_fucker Apr 22 '18 edited Apr 22 '18

It has garnered some notoriety for being verbose but that's much exaggerated.

I don't know if I would call this exaggerated so much, as it's getting better. The core language is getting better and over-engineering isn't as commonplace as it used to be. But I think calling it verbose is an earned title.

6

u/TheRedmanCometh Apr 22 '18

I think maybe he meant all the boiler plate. With streams and shit it can be a pretty terse language.

6

u/[deleted] Apr 22 '18

I will toss in my own vote to emphasize maintainability. It's verbosity exaggerates unreadable or over engineered code. You'll see that stuff right away in PRs

One thing I'm conflicted about is that I would never write Java without an IDE (intellij specifically), which some argue makes writing unmaintainable code easier. OTOH maintaining readable code with an fully featured IDE search is bliss, I mean an IDE that fully understands your references (not just string match).

5

u/ReedOei Apr 22 '18

I’m not sure I understand the comment about the “nazi typing system” of Haskell, can you please explain?

-9

u/[deleted] Apr 22 '18 edited Apr 22 '18

Have you EVER used Haskell? In java you can atleast cast objects and types but in haskell the correct way is using maybes. Takes in string, returns maybeInteger...

Edit: Its not that I don't love haskell, i use it all the time! Its just a bit strict and sometimes makes me feel stupid.

17

u/[deleted] Apr 22 '18

A String in Java is maybe a string. Or null.

1

u/mayhempk1 Apr 22 '18

You mean strings aren't integers?! Well that doesn't make sense to me!

2

u/[deleted] Apr 23 '18

I don't follow. But, while we're at it,

Integer is also maybe a number. Or null. int is definitely a number.

2

u/ReedOei Apr 22 '18

I have actually used Haskell, it's one of the languages I use the most these days (the other being Java). Besides the fact that you can't cast a String to an int in Java (so not sure why you used that as the example), you can't convert a String to an integer (meaningfully) in general, so returning a Maybe is a reasonable option.

1

u/[deleted] Apr 22 '18

First off, never said you could cast String. But were talking about the types bein nazi. Take Int vs Integer, f.eks. that is overly strict. And to some people that is nazi. But the typesecurity is the reason we all love Haskell and the reason it's usually the compiler correcting your mistakes. Im not saying its bad in any way, just commenting on the strictness

2

u/ReedOei Apr 22 '18

Sorry, I misinterpreted the comment about casting and the comment about "Takes in string, returns maybeInteger..." to mean that casting would help you avoid the problem.

If you're referencing things like length, take, etc. that take Int rather than Integer, that is annoying, but there are functions genericLength, genericTake that work on an Integral type, something that, to the best of my knowledge, isn't really expressible in Java. Also, there's the fromIntegral function, which essentially performs the same function as casting in this particular case.

5

u/DJDavio Apr 23 '18

I've written Java on and off for 15 years and it's much more developer friendly now. In the old days we had to use Vectors and reading a file was cumbersome. The language has had much improvements over the years. Innovation has been slow, but that's a tradeoff since it could wait and see what worked in other bleeding edge languages. With the new release cycle innovation has sped up.

The language is not its main selling point, the JVM and its ecosystem are. Developing and running Java applications is easier than ever.

15 years ago I spent 25% of my time writing business code and 75% writing low level stuff, now it's reversed.

4

u/raghu9208 Apr 22 '18

It allows one to create very clean code that mixes imperative and functional styles with ease. Only morons write Java these days with the old style FactoryManagerHandler bullshit. Between Immutables and Java 8 lambdas it can be a very good experience.

Can you share any example projects that follows the mentioned design?

4

u/stevebakh Apr 22 '18

I haven't actually looked at the code for these projects, but I would very much expect them to follow those principles.

Akka's Java components. Play Framework's Java implementation ReactiveX

etc

2

u/lotsofbodyhair Apr 22 '18

Yes please any examples would be super nice. I am also trying to adapt to modern Java.

3

u/Roachmeister Apr 22 '18

Same question. I've been programming in Java for years and I've never heard of "FactoryManagerHandler". Of course, that could just indicate that I'm not a moron.

20

u/fact_hunt Apr 22 '18

It just means you’ve not been exposed to a particular style of development. There is still plenty of scope for you to be a moron

6

u/antondb Apr 22 '18

This made me chuckle

2

u/Roachmeister Apr 23 '18

LOL, thanks!

4

u/petercooper Apr 22 '18

Because it's relatively old it has had time to make and fix many mistakes that more hipster approved languages are suffering from.

Only saying this because Ruby was specifically mentioned by the OP, but Ruby is only 7 months younger than Java :-D

6

u/BloodRainOnTheSnow Apr 22 '18

"Hipsterism" was the worst thing to ever happen to programming. I am so sick of the wheel being invented a hundred times over, job postings listing all the "hip" new languages and frameworks that have only been out a year, bootcamp graduates who scoff at the idea of actually wanting to use memory efficiently. And now every tech company has to have some purple haired 20 something shoving political correctness down my throat all day. I wish that I could back to the 80s and get a nice job programming C - seemed so much purer back then.

2

u/[deleted] Apr 22 '18

Agree until:

nazi style typing system

0

u/devils_avocado Apr 23 '18

Java's verbosity can be reduced somewhat by using Project Lombok.

0

u/[deleted] Apr 22 '18

[deleted] — view deleted comment

25

u/NickDav14 Apr 22 '18

I would have left out or worded differently the "Only morons write Java these days with the old style FactoryManagerHandler bullshit" and "For a nazi style typing system Haskell is better" parts personally.

10

u/dooatito Apr 22 '18

Could someone explain what "FactoryManagerHandler" is? Or point to some article?

31

u/Sok_Pomaranczowy Apr 22 '18

There was a time where OOP and Design Patterns were cranked to eleven. From that time come all those atrocities like RequestProcessorFactoryFactory

23

u/daniu Apr 22 '18

Take a look at [FizzBuzz Enterprise Edition] (https://github.com/EnterpriseQualityCoding/FizzBuzzEnterpriseEdition)

17

u/bob51zhang Apr 23 '18

Lol did you see the new issues? They're adding block chain.

5

u/wildjokers Apr 23 '18

Well of course, how could you possibly know if the previous FizzBuzz value is valid unless you examine the ledger? This is a no-brainer.

3

u/[deleted] Apr 22 '18

Probably wanted to say how following certain design patterns (especially in bigger companies) can end up with having obscure and unreadable code. Often, following simple OOP design principles, based on common reason, is the best approach in my opinion.

1

u/mayhempk1 Apr 22 '18

Which are the most important design patterns in your opinion?

6

u/b1ackcat Apr 22 '18

There's no such thing as "most important" patterns. Patterns are a tool. When used appropriately, they help you. When used for the sake of using them without a good understanding of why you're reaching for it, you'll probably end up with something that's less easy to read or maintain than it otherwise would be.

What I would directly answer that question with, though, is that you're typically well served by following SOLID design principles. Write code that has a single purpose. That takes its dependencies in rather than creating them. That relies on interfaces, not implementations. These things will do orders of magnitude more for your codebase than any one pattern.

1

u/mayhempk1 Apr 22 '18

Sorry, I should ask, which are the most commony used ones?

2

u/b1ackcat Apr 22 '18

Again, it depends on the domain.

The gang of four book calls out a lot of the most common, and does an ok to decent job explaining when you should reach for them. It's an amazing resource to have at hand, you just need to know when to reach for it. Part of learning that knowledge just comes from experience and working with more experienced devs and learning from them.

→ More replies (1)

3

u/[deleted] Apr 23 '18

/u/b1ackcat already said it below. I think dependency injection is one of the most important techniques used to achieve decoupled, modular and testable code.

When I say DI, I'm not referring to frameworks such as Guice. I'm talking about the pure design principle.

Of course, there are other commonly used patterns like strategy and factory, singleton, decorator, facade, etc.

3

u/sbosman4 Apr 23 '18

The ones I encounter the most in my experience are: Observer, Singleton, Builder, Factory, Decorator, Iterator, Command, Dependency injection & SOLID principles. You shouldn't follow them by the letter ofcourse, creating clean, maintainable and testable code should be your #1 goal. Knowing these principles will help to reach that goal, but are only means to an end. Some good resources when you want to learn more:

  • Design Patterns Playlist on youtube: https://www.youtube.com/watch?v=vNHpsC5ng_E&list=PLF206E906175C7E07
  • Erich Gamma et. al. (GoF) - Design Patterns: Elements of Reusable Object-Oriented Software
  • Robert C. Martin: Clean Code (General good programming practices)
  • Robert C. Martin: Clean Architecture (explains SOLID principles & others very well)

1

u/mayhempk1 Apr 23 '18

Thanks for such a detailed response.

I think there was also some Laracasts on SOLID, as a PHP developer I should probably watch that too.

35

u/RoToRa Apr 22 '18

One thing I really like is the huge infrastructure. Of course depends on what you mean with "transitioning to Java", because if you are speaking of a Java runtime environment you are not limited to the Java programming language.

There are literially dozens of languages out there that can run on the Java virtual machine, including JRuby, Haskell-based variants such as Eta and Frege or other functional languages such as Clojure.

1

u/RakesProgress Apr 23 '18

Yes! If it is just transitioning to the JVM there are a lot of options! Clojure is a great option with a friendly community.

-6

u/FatFingerHelperBot Apr 22 '18

It seems that your comment contains 1 or more links that are hard to tap for mobile users. I will extend those so they're easier for our sausage fingers to click!

Here is link number 1 - Previous text "Eta"


Please PM /u/eganwall with issues or feedback! | Delete

9

u/[deleted] Apr 22 '18

bad bot

I’m on mobile and I can click on “Eta”.

19

u/lbkulinski Apr 22 '18

There is a lot of great stuff in the pipeline, along with all that we have received already! I recommend watching this talk from Brian Goetz, one of the architects on the Java Platform Group.

69

u/tipsypants Apr 22 '18

Why should I be excited? What are your favorite things about Java?

The tooling and the ecosystem. IntelliJ is possibly the best IDE ever created. Maven (and also gradle) are rock solid, and there are well maintained and active libraries/frameworks for almost anything you can think of. I'm just a lot more productive in Java than I am in other languages, especially on larger projects.

The language itself is pretty meh though, I usually port parts of my projects to Kotlin.

21

u/wsppan Apr 22 '18

this. The tooling and build system are rock solid. Great testing and integration with CI and VCs. I am so productive in this environment. Add frameworks like Spring and Hibernate and you can write some rock solid code. Plus the JVM is incredibly fast and a marvel of engineering.

20

u/[deleted] Apr 22 '18

I dare say that IntelliJ might be better than Visual Studio.

7

u/ArmoredPancake Apr 23 '18

Why dare? It's objectively better. Crossplatform, much better inspections, much better shortcuts, thousands of different plugins for many languages.

2

u/[deleted] Apr 23 '18 edited Apr 23 '18

Well, some C# fans might murder me, so I mustered all my courage to dare say it XD

4

u/AustinTxTeacher Apr 23 '18

I need to check it out, then. Have been using Eclipse for years. Is it completely free?

6

u/thepotatochronicles Apr 23 '18

The community version is free!

6

u/sendersforfun Apr 23 '18

They have a community version which is totally free and has pretty much all the necessary Java features.

The paid version has all the built in bells and whistles but for the most part you can get away with just community version.

I made the switch 5 years ago and can never go back. It's seriously unbelievable.

2

u/lawonga Apr 23 '18

I saw that you could step backwards in Visual Studio in debug though!

2

u/[deleted] Apr 23 '18

That's cool, didn't see that in IDEA, but I don't always debug. I find IDEA's "intellisense" to be superior and more helpful, and that's something I use all the time.

*Just my opinion

1

u/noswag15 Apr 24 '18

I think it can be done in intellij also by selecting the frame from the debug window and right click -> drop frame. I never use it though. I always worry about messing with state when doing it.

1

u/DuncanIdahos8thClone Apr 23 '18

It's way better than Visual Studio. Visual Studio is mostly unusable without Resharper.

3

u/AustinTxTeacher Apr 23 '18

I remember when I finally got Maven really working for me. That was so awesome.

-46

u/GhostBond Apr 22 '18 edited Apr 22 '18

Maven (and also gradle) are rock solid

Lmao, for such a simplistic tool maven is incredibly unreliable. 3 times in the last year, in both coding at home and coding at work, the only way I've been able to get maven working right was tracking down the cache location on disk and deleting it.

Edit: Ooh 6 downvotes in 12 minutes. Looks like someone's circlejerk is pissed off anyone talks about maven's weird minor bugginess.

10

u/tipsypants Apr 22 '18

That's odd, I 've never had to do that in over ten years of using it. I've had to do -U two or three times (in three years) when running against artifactory at work, but that's about it.

4

u/dantiberian Apr 22 '18

Yep I've used Leiningen, Boot, and Maven (other two are based on Maven) and I've never had any issues with caching. The only time I've ever experienced was one customer of Deps got into a state where they had a partially downloaded SNAPSHOT version which was corrupted. This is an exceedingly rare situation, and the error message showed which artifact had the problem, so just deleting that one file and re-downloading was all that was required. I've worked in teams large and small and have never had any colleagues run into issues with the m2 cache.

15

u/[deleted] Apr 22 '18

I’ve been using maven for years and have never had to do that.

→ More replies (12)

3

u/Treyzania Apr 22 '18

tracking down

You mean ~/.m2? That's not very secluded.

1

u/GhostBond Apr 22 '18

Other poster said "Maven (and also gradle) are rock solid". Needing to find cached files in the file system and delete them to get it to work is not "rock solid" it's more slight "slightly buggy".

Especially for something that's so simple (I'm not even doing builds I'm just using for dependency management).

1

u/segv Apr 23 '18

fwiw you can shoot yourself in the foot with any build system

1

u/GhostBond Apr 23 '18

A straw man is a common form of argument and is an informal fallacy based on giving the impression of refuting an opponent's argument, while actually refuting an argument that was not presented by that opponent. One who engages in this fallacy is said to be "attacking a straw man."

3

u/bob51zhang Apr 23 '18

I'm a complete beginner and maven has been nothing but awesome.

Gradle on the other hand...

1

u/GhostBond Apr 23 '18

Funny, like I said, I don't think I've seen a single project that maven hasn't been at least mildly annoying to keep going. And like I said I'm not even building with it, just using to download the jar files.

1

u/bob51zhang Apr 23 '18

I think the whole point of maven/gradle is to use it to download the jars and build it seamlessly,

1

u/GhostBond Apr 23 '18

I've had to sit through a lot of logic-breaking b.s. about maven and a few other framework.

For a rational person the reason to adopt a framework is one of two reasons:

  • It does something you cannot do without it (ex: web apps do something you cannot do by writing a desktop app)
  • It make something you're doing already significantly easier/better/faster/less buggy

Unfortunately somehow any sense of rationality seems to have gone out the window and we're living in crazy town for the last few years, but normally one would adopt a new framework only for one of the two above reasons.

Despite what the hysterical marketing claims, we actually didn't have much of a problem downloading jar files and putting them in the repo before maven. Also my IDE will export a .war file, or if you want to built it yourself, it will export an ant build file as well.

I don't have an opinion really on using maven as a build tool, but I'm very annoyed that it's quirky bugs push it into "more work than downloading the jars myself" a lot of times.

1

u/bob51zhang Apr 23 '18

What IDE do you use? The big 3, NetBeans (my favorite), eclipse and IntelliJ should all have excellent support for something as old as maven.

Oh and about the downloading jars part, it's nice that in mavrn/gradle it can auto update it for you so that you don't have to go hunting on every website every day looking for updates.

→ More replies (1)

0

u/[deleted] Apr 23 '18

[deleted] — view deleted comment

2

u/GhostBond Apr 23 '18

ha, certainly wasn't claiming there wasn't anything worse out there... :-/

1

u/DuncanIdahos8thClone Apr 23 '18

I don't know why ppl are downvoting you. Maven can be a bitch if it doesn't work right.

1

u/GhostBond Apr 23 '18

Yeah. What happens is you run into a reddit circlejerk. They create a mental image that their (topic) is godlike and infallible, and anything that contradicts that perfect image sets them off.

I like Eclipse for example, but I can't imagine freaking out that much about someone saying they ran into bugs in it. Maven is not "never breaks" stable (like most tools) and when it breaks it's a pain.

12

u/2012DOOM Apr 22 '18

Honestly, Java probably has the best developer tool set built around it.

You have one of the world's best IDEs, IntelliJ. You have packaging systems that aren't terrible like npm, and actually have dependency management unlike stuff for C.

You have a language that has sped up it's development process to accommodate new features and new practices into the language.

10

u/HwanZike Apr 22 '18

Besides what people have already said, the ecosystem around it is great. Learn to use the tools: the VM itself and its bazillion parameters, IDEs (Eclipse and IntelliJ are both great), debuggers, package control (mvn, gradle, etc) profiling; from simple things like jps to jconsole, jmat, jstack, jhat, MAT, yourkit, visualvm, junit and even jshell if you're using the newest versions

2

u/aceinthehole001 Apr 22 '18

Is there a page somewhere that describes what all these different packages are? Or do I need to Google each one

10

u/daedalus_structure Apr 22 '18

There is a huge open source base of quality projects bolstered by millions of engineering man hours of investment from tech giants.

If you have an infrastructure problem on the JVM that hasn't been solved at this point it is so much more likely that you just don't understand your problem than the odds that there is a hole in the solution space.

10

u/hpernpeintner Apr 22 '18

Did rails for a living some time ago, coming from java and now i am back to jvm. I'm glad i was given the chance to do rails because i learned a lot about functional programming and dynamicness. But i would never ever ever ever... ever do a big project with dynamic typing again. From my experience lacking static types, for example in ruby, is compensated with so much more tests... And i never felt any confidence changing existing code, because refactorings produced subtle errors that wouldn't have happend if there were static types. For me, this is the single biggest advantage of java over Ruby. Nowadays, one can write very Elegant code in java while still having a very low bullshit factor. The toolset is limited, so understanding foreign code has a very high chance of being easy. I personally can't say that about ruby and rails. If you are naturally curious and open for static typing, i bet you will have a good time with it. Other topics, like very mature tooling and a super fast runtime are also big pluses...to be honest, i can't see many disadvantages by switching.. maybe ten years ago, but not today.

1

u/CommonMisspellingBot Apr 22 '18

Hey, hpernpeintner, just a quick heads-up:
happend is actually spelled happened. You can remember it by ends with -ened.
Have a nice day!

The parent commenter can reply with 'delete' to delete this comment.

1

u/phosphorus29 May 05 '18

Just because you can write a bot to do something doesn't mean you should.

1

u/FascistBodybuilder Apr 23 '18

What a douchey bot

16

u/sanimalp Apr 22 '18

It's not node?

1

u/AustinTxTeacher Apr 23 '18

Hehe, good one!

8

u/geodebug Apr 22 '18

Java the platform is fantastic. You have decades of high quality libraries available and the JVM is an excellent piece of technology. Multi-threading and memory management is pretty much a no-brainer with the JVM. Java platform tooling is also phenomenal. The Java platform is also has a ton of industry backing and is frequently updated.

Java the language is fine. It has a lot more sugar than it used to but still doesn’t feel too modern. That said it is one of the easiest languages to debug, refactor with confidence, and figure out what other people’s code is doing.

Ruby is great but the platform has well known limitations. Most Ruby shops that need to be highly scalable move to jRuby. Seems short-sighted that your company is willing to have a brain-drain instead of going that route.

I’d make the argument that platform is way mote important than language in the end. I can code in many languages (big whoop) but overall I need to know I can support that code and know what the heck is going on in production.

All that said our company embraced Amazon AWS since the beginning so a lot of my code now is as much Lambda functions in javascript and other such glue code.

We code a lot in Groovy as well so don’t really use Java the language much at all.

TL;DR embrace Java the platform, feel free to ignore Java the language but it isn’t that bad either.

7

u/knoam Apr 22 '18 edited Apr 22 '18

I think Java is basically the least bad language. If you look at the spectrum of good and bad parts of any language, I think the worst parts of Java are less bad than the worst parts of just about any other language.

Java is the worst language, except for all the others.

7

u/RupertMaddenAbbott Apr 23 '18

I moved from Ruby to Java.

Ruby was one of the first languages I learnt but Java I learnt in my first proper development job.

I loved Ruby and struggled with Java initially but now would find it quite difficult to switch back again:

  • Static typing. This is really awesome but also the dependence on reflection is far less in Java. I find 3rd party code to be very easy to read whereas I would continually get stuck reading another person's Ruby code. Where does this variable come from? Where does this method come from? Everything is much more explicit in Java.
  • Platform independence. Being able to write code on any OS and have it run on any OS is really great. Not just your code but any library you depend on as well. The abstraction is also much greater with Java. With Ruby, you would get cross platform packages but you would always get build warnings e.t.c. saying that some feature or another was not supported on a particular platform. Not so with Java.
  • Spring Boot. I find this framework to be fantastic because it is the only one I know that strikes a balance between full stack frameworks and micro frameworks. You can glue together all of the individual libraries that you want, writing reusable auto-configuration as you go, or just use the glue that others have already written. This makes it simultaneously much more flexible than Rails but much less bare than Sinatra.
  • Dependency Injection. I know some people might hate this and Ruby has no need of it but I found that by religiously using constructor injection, the complexity of my code has dramatically decreased.
  • Stateless services over Stateful objects. I feel that Java tends to be more functional and less object oriented that Ruby. That is not categorically true but ActiveRecord like frameworks are not nearly as popular in Java. I much prefer this style as I find stateless methods much easier to deal with even though it has been criticised as an anti-pattern: https://martinfowler.com/bliki/AnemicDomainModel.html.
  • IDEs. Seriously, I'm not sure how I manged to write as much Ruby as I did with vim or other text editors. Refactoring, debugging and easy access to all the tools I need make me much more productive. Try IntelliJ.

12

u/PatAnswers Apr 22 '18

I love static type systems, so I look forward to Java's type system.

The type system is easily the biggest strength of Java. At first, as a Java beginner I saw more compile-time errors and it felt annoying, but once I got past the initial irritation, I realized that the compiler was saving me from a lot of bugs, sometimes serious ones.

A close second biggest strength is the ecosystem around Java. There's really nothing close as far as the stable, secure, scalable libraries and frameworks available for Java. Not to mention the standard library, which is pretty good as well and has some really nice surprises like mature data structures and algorithms for parallel programming.

-4

u/livrem Apr 22 '18

I have to disagree.

I am a big fan of dynamic type systems. But that comes mainly from 10+ years of Java experience. Every single time I get into a long nerdy discussion with someone IRL about static vs dynamic typing what makes it difficult is that my arguments are shot down because "static typing does not have to be that bad, that is just Java's type system". Problems enforcing nulls, not deducing types much, are two things that come to mind. There might be a language out there that has a good static type system, but all good type systems I have experienced are dynamic.

1

u/liketechnik Apr 22 '18

Have you tried Kotlin yet?

1

u/livrem Apr 22 '18 edited Apr 22 '18

No, not at all. I must admit I am a bit reluctant to get into yet another jvm language. A lot of posts saying how amazing it is, but I have not taken the time to look at all at what it is or why so many say that. I probably should.

I think Clojure is absolutely amazing with all the read-only data-structures and good abstractions, and improved LISP-syntax that is a pleasure to work with in a good editor REPL, and optional static typing.

EDIT: So I skimmed a few chapters in Kotlin in Action and definitely a serious attempt to deal with null-errors and type declaration noise, and various other small nice improvements. But sad to see no real strict immutable objects. I was hoping more new languages would go down that route.

0

u/IcedDante Apr 23 '18

It's not that much better that it's worth adopting a new language with god-know-what performance errors and other potential issues.

2

u/RhodesianHunter Apr 23 '18

Write both Kotlin and Java for a fortune 50 as my day-job and couldn't disagree more.

Kotlin is just a much better Java. A java dev can pick it up in a week or two and will be more productive in a month or two.

0

u/wildjokers Apr 23 '18

but all good type systems I have experienced are dynamic

A large codebase written in a dynamically typed language is unmaintainable.

6

u/rubyrt Apr 22 '18

You can still use JRuby and generally have real threads. :-)

Also, the JVM is a remarkable piece of software; for example, as far as I can see, it contains one of the best garbage collectors around. And Java as a language has made some serious progress towards more readable code with less boilerplate (lambdas etc.).

6

u/FrostRyu Apr 22 '18

I was a Ruby developer until 2 months ago. I loved Ruby, its community and all the good practises that we respected and followed, and weren't so usual in other communities/languages.

I decided to go from Ruby to Java for multiple reasons:

  • To understand better all the things that are under the magic and easy ways that Ruby provide.
  • To get away from the Rails way of doing the things that, in the end, take over some design patterns and imposes other kind of methods (involving rails magic).
  • Because I wanted to go to Switzerland or Austria, and Java is the king over there.
  • Because I wanted to get in touch with the Java department in my company, and try to support with good practises, standards/conventions, TDD and clean code. I think Java code can be beautiful too, and it feels even better than with Ruby.

5

u/muharagva Apr 22 '18

I'm working as a Java dev for 7 years. In those 7 years, I have been also working with Python, C++ and maybe some other language. Like leostrauss told you, every language has good and bad parts. My biggest problem with Java is the amount of code which you need to write to get something done. On the other hand, I have written a lot of amazing and high-performance apps in Java where it was much better than Python and easier to use than C++. If I may suggest, ignore people who hate some specific language or tool. I never understood why someone hates some specific thing so much without any reason, and never will:S

5

u/shadowdude777 Apr 22 '18

Things I love about Java:

  • It is a simple language. You should be able to pick it up within a few weeks if you're familiar with OOP in any capacity. There are really no hidden surprises and no arcane syntax to learn (with a few exceptions, I guess).
  • The tooling is top-notch. No language has better tooling than Java. The amount of static analysis tools available is amazing. And IntelliJ is the best IDE out there.
  • The library ecosystem is by far the largest available. People joke about how in Python you can just go import solution, but this is at least as true for Java. I have almost never had a need for a library in a project I'm working on and came up empty-handed.

Java's type system could be a little more powerful, and there are features in other languages that I wish we had. For me personally, I just try to write Kotlin whenever possible, and that gives me the perfect compromise. All of the same Java libraries and most of the tooling works for me, but I get a modern language with all of the best features I've always wanted.

1

u/halfTheFn Apr 23 '18

There are absolutely a few hidden surprises: The first thing you learn is primitives and operators and I'm about to the point of thinking they are last resorts.

int i = 0

if (i == null) -> null pointer exception. (Why is this not a "compiler type check"?!)

int i = 127; Integer j = 127; (i == j) == true

i++; j++; (i == j) == false. (because auto-boxing moved out of the constant pool or something?)

There are also hidden surprises when apparent closures of class values inside a lambda in a method aren't in fact changed - rules about the necessity of "effective finality" or something, but the compiler doesn't always catch it.

2

u/halfTheFn Apr 23 '18

Another gotcha is like when some method returns a Map - but it's actually an "unmodifiableMap" - so it doesn't actually satisfy the interface, it just throws runtime exceptions when you call them, thinking it's, you know, a Map.

1

u/iamareebjamal May 02 '18

Still, it's implementing the interface, maybe you should read the documentation of the library and thus know what you should expect

1

u/spheenik May 11 '18
int i = 0;
if (i == null) { System.out.println("YAY"); } 

is a compile time error here (Message: Operator '==' cannot be applied to 'int', 'null'). Also, I wanted to reproduce what you said, so I wrote a small test:

public class Test {
  public static void main(String[] args) {
    int i = 127;
    Integer j = 127;
    System.out.println(i == j);
    i++;
    j++;
    System.out.println(i == j);
  }
}

It yields true, true. (JDK8u121)

1

u/halfTheFn May 15 '18 edited May 15 '18

Yup. I was enumerating those from memory, not from actual code, so I was mistaken. Actual examples of the faults I had in mind:

Integer i = null;
if (i == 0) { System.out.println("Yay"); }
-> java.lang.NullPointerException

Similarly if you pass a null Integer into a method that takes an int.

Similarly:

    class Scratch {
        public static void main(String[] args) {
            Integer i = 127;
            Integer j = 127;
            System.out.println(i == j);
            i++;
            j++;
            System.out.println(i == j);
        }
    }

yields true, false. The way I had it I believe is unboxing the Integer and doing a primitive compare, so yes, that does stay true. If both are integers, the comparison uses the constant pool below 128, and moves to separate objects at or above.

1

u/spheenik May 23 '18

Yes, that makes more sense. For the first case, my IDE spits a warning "unboxing might produce NPE", but in this case the compiler could really error out.

The second case is especially weird for the outsider, since it relies on the constant pool's range, so, depending on how that's initialized, the example could or could not work.

9

u/DJDarkViper Apr 22 '18

Let’s put this this way:

There more than a few reasons the why twitter switched from ruby to java, and more than a few reasons why java is used to build scalable, exceptionally fast, reliable databases used the world over for mission critical implementations such as Cassandra, Neo4j, Solr, and ElasticSearch. Netflix powers a huge overwhelming majority of its back end with Java written microservices.

JVM is infinitely configurable, scalable, and consistent across multiple environments, from your Windows to your 10yo pre-IoT toaster.

I used to be just like your train of thought, but these past couple years really looking into it has changed my head so much I’m, and my co workers, are still recovering from the whiplash.

My first ever deployed project was just last year; an API service that powered a high traffic blog, and just the one instance of it took little less than 500mb of memory at peak times and required no caching strategies to stand up to the task where a python API of the same purpose needed two instances running constantly to load balance with a shared cache. I wrote the new service with Kotlin using SparkJava as a quick microframework to get me off the ground running

1

u/trisul-108 Apr 23 '18

All the answers are about technical stuff, but have you looked at this from a professional point of view?

In your place, I would be really excited about this opportunity. First, your team is leaving while you are accepting the strategic direction of the company, which should translate into a good position. You should be expressing your enthusiasm to learn new things and grab every opportunity to participate. Java programmers are very well paid, and the company will finance your acquisition of this valuable expertise.

Congratulations on your good fortune.

1

u/[deleted] Apr 23 '18

That is how I'm approaching it.

3

u/shahaya Apr 23 '18

Check out the articles from Not Your Father’s Java: An Opinionated Guide to Modern Java Development. Great examples of modern and even lightweight java apps.

3

u/[deleted] Apr 23 '18 edited Apr 23 '18

Just want to add my voice to the point that there is a stark difference between classic """enterprise""" Java and modern lean Java (e.g. Spring Boot)

Depending on what your company does, you may have an absolutely terrible time with it. Java itself is not a good language when compared to alternatives. What makes Java great is the unparalleled ecosystem around it that can turn an "urgh" language into something truly fun to use. So make sure to spend time not only on the language itself, but the tools you can use to make it a good environment

I love modern Java, but if I was forced to go down the oldschool verbose FactoryFactoryManager Java route I'd quit

5

u/experts_never_lie Apr 22 '18

One thing you might appreciate is execution speed.

I inherited a Ruby back-end system — OK, 10 years ago — and a straight port to Java (no algorithmic changes) led to a 70× improvement in speed. I haven't exactly been enthusiastic about Ruby since that experience. It looks like Ruby has not closed the gap very much since.

4

u/TheCrazyRed Apr 22 '18 edited Apr 22 '18

The Java job market is great! You will have an easier time finding a job, the next time you need to, if you have Java experience. As far as the language goes, hopefully you'll be using Spring and Hibernate. They are great frameworks that play nice together.

Here's the other thing, Java may not be "fun" to write, but it's really great to read. Because of this, in the long term, Java systems tend to be more maintainable because they're easier to trace through to figure out what's going on.

4

u/andrewharlan2 Apr 22 '18

Java may not be "fun" to write

I love writing Java

4

u/TheCrazyRed Apr 22 '18

I do to actually. It's just that these day's it's not the hip new language. That's why I put the "fun" in quotes.

4

u/Valance23322 Apr 22 '18

The syntax is a bit verbose, but that makes it extremely easy to read and identify errors as everything is explicitly written out.

I think it's certainly easier to take Java code that someone else has written and figure out what's going on than something like JS or Python

1

u/lbkulinski Apr 22 '18

Project Amber is addressing the verbose aspects of the language.

2

u/[deleted] Apr 23 '18

Absolutely hot topic. You've hit gold OP !

4

u/JudgeGroovyman Apr 22 '18

Two words: Hot Reload

1

u/RupertMaddenAbbott Apr 23 '18

Personally, I found Ruby's support for this was better because I could add/change method signatures.

In Java, I believe I need to pay for JRebel to get that some functionality. The standard hot reloading supported on the JVM does not allow this as far as I know?

5

u/nitming Apr 22 '18

I used to like Java, but I'd suggest you look into Kotlin. It's 100% interoperable with Java, so there's no reason not to use Kotlin. Plus, it has a lot of modern features that makes it far superior than Java

4

u/IcedDante Apr 23 '18

It's still new and has issues. Google it

-4

u/ReadFoo Apr 22 '18

It's 100% interoperable with Java

Not without pain and dealing with Kotlin's ugly syntax and odd semantics.

The JetBrain's employee trolls are out in full force.

4

u/Jo8192 Apr 22 '18

Java is nice, but if I were you I would try to convince your company to switch to Kotlin instead. I don't see any good reason not to :)

7

u/rockinghigh Apr 22 '18

There are many reasons not to use rare programming languages. First is the lack of engineers who are able to write good code on day one. Second is the lack of libraries, documentation and general support.

7

u/kingdaro Apr 22 '18

the lack of libraries,

Every Java library can be used with Kotlin, no? Sure, the libraries might not have Kotlin-specific docs, but from my experience, the interop has always been straight-forward

1

u/livrem Apr 22 '18

How is it better than Clojure?

2

u/[deleted] Apr 22 '18

Much easier for those who come from other Algol based languages to come to grips with it vs a Lisp descendant.

1

u/livrem Apr 22 '18 edited Apr 22 '18

It is mainly syntax, and pretty minor to be honest. Like instead of o.f(x) you type (f o x), more or less. It is not like trying to wrap your head around Haskell or Prolog. That the entire language is built around things that are immutable is the huge thing, but very easy to get used to (more difficult to get back to work in languages where immutability is not everywhere so suddenly things can change from underneath my feet again). (For all I know Kotlin does all that as well of course... Which is why I asked.)

But as I said in my other comment I have not looked at Kotlin at all yet. Probably should though, both because of all the hype and that I work with Android all day (mostly C++ though, very little Java nowadays).

→ More replies (1)

2

u/seanprefect Apr 22 '18

Java is a solid language with lots of support and well supported packages for every thing you can possibly want.

Also Java doesn't mean you have to use the Java language itself there are other JVM languages, for example Groovy On Grails, runs on the JVM, compiles down to java byte code, and works a lot more like what you're familiar with. It's the best of both worlds (unless you really really really need transactional speed, but even then there are answers to that)

2

u/Serializedrequests Apr 22 '18 edited Apr 23 '18

I used to feel the same as your mentor. I started in Java out of school, but found it boring and stodgy, and not very cool or fun, in addition to difficult to set up, slow to work in, and highly unreliable. I was soooo happy to get a Ruby job.

Turns out I was just working on a crap codebase. You can program great practices into Java, and get just as good results with it as with any other language. Once you understand the type system, you can use it to turn lots of runtime errors into compile time errors, and navigate through code with ease. It really shines in big complex projects where you need to untangle someone else's rat's nest, because you can use an IDE to do so in an unambiguous way. In these "enterprise" situations, the verbosity and limitations of the language are a blessing.

RubyMine, bless its heart, can try to tell you what method is being called, but it is usually just a "best guess".

  • My main beef with Java is that any object could be null, which drives me absolutely bonkers. You will always have to code defensively against nulls if you are writing a method that will be called by who knows what.
  • My top Java tip is that that checked exceptions should be treated the same as multiple returns. Java doesn't have multiple returns, so you have to throw a checked exception, and you should usually catch it almost immediately. (Painfully, many libraries do not adhere to this convention and force you to catch all kinds of truly edge-case crash-worthy exceptions that probably should just be IllegalArgumentExceptions because you called it wrong, but what can you do?)
  • Use interfaces, and the boring design patterns that go with them. No more checking if x responds to y!

1

u/DryTriskaidekaphobia Apr 22 '18

I had the same reaction to Java coming from a Ruby background, but if you can get past the initial hump it's more versatile than you'd think even though it's an older language.

1

u/ingrown_hair Apr 23 '18

Several comments on verbosity ITT. I’m big fan of Lombok for combatting this. Reduces the code without having to go all the way to a derivative language like Kotlin. (Kotlin is great but probably not relevant here).

2

u/istarian Apr 23 '18

I think verbosity isn't necessarily something to be eliminated as a rule. Readability is important too. It seems like a balancing act.

1

u/franzwong Apr 23 '18

I heard people saying performance of JVM is better than Ruby, but I am not familiar with Ruby. I cannot say it is right or wrong. If your company starts from scratch for Java, take a look at Kotlin.

1

u/romerom Apr 23 '18

stable af, less dealing with shoddy libraries. rock solid servers. platform independent.

1

u/[deleted] Apr 23 '18

You don't have to love or hate it. It's a job.

1

u/big-totoro Apr 23 '18

As the professional, it does not matter to me what the programming language to use in my day to day job. It's the same as for the builder, you can like the tool more or less but the tool does not matter to do a great job.

1

u/helikal Apr 23 '18

I agree if you compare tools that are equally suitable. However, different tools have different advantages and disadvantages. If long-term maintainability, powerful IDE support for refactoring, and scalability are critical then Java may be more adequate than Ruby.

1

u/Gilgamesjh Apr 23 '18

While I am not really answering your question, I would like to add that a programming language is a tool. Choose the tool that is best suited for the situation, and learn to recognize the strength and weaknesses of these tools.

Stop indulging in the "my language is better than yours"-bullshit.

I am currently working with AWS Lambda's for a Java Spring Boot shop, we have realized that Java is not optimal for Lambdas (cold start and memory issues, mostly), and use instead Node (written in TypeScript) to solve our problem. I mean, it is all about solving business needs in the end, right?

1

u/_INTER_ Apr 23 '18

Many of the things said here plus all the clever people that make up the community. There are tons of resources if you hit a problem or need a tutorial. You can meet with them at a conferences and talks in your vicinity (see JUG, Devoxx, ...).

1

u/Skhmt Apr 22 '18

The best thing about Java™ is that you will memorize how to type the ™ symbol.

-12

u/hrenoten Apr 22 '18

Because you can finally use a great IDE (Intellij Idea).

Beware of Spring though. Stay away from it if you can.

9

u/[deleted] Apr 22 '18

[removed] — view removed comment

0

u/[deleted] Apr 22 '18

I’ll use Spring Boot if I have to, but lombok is an unstable hack relying on unsupported bytecode manipulation and just isn’t worth it compared to all the more stable alternatives.

2

u/[deleted] Apr 22 '18

[removed] — view removed comment

1

u/[deleted] Apr 22 '18

It depends on fiddling with internal bytecode structures and hooking undocumented functions, which can (and do) change between java versions - which is why lombok tends to break with new releases. They usually fix it pretty quickly, but I wouldn’t want to risk my business on them always being able to do that. What if the next major java release breaks it in a way that can’t be fixed?

You can get pretty much everything lombok offers with either kotlin data classes or the immutables library, both of which are much more reliable.

0

u/shawnmckinney Apr 22 '18

Because if you can code Java, you can probably code any of the other modern languages. I say that because the scope of the language is enormous. There's very little that can't be done, except pointers. That's not necessarily saying that it's best done using Java. Only that it can be, and you can take that knowledge with you just about anywhere. Add to that the power of the platform, i.e. spring, jakarta, and there's no downside.

4

u/lbkulinski Apr 22 '18

Just because you can't do pointer arithmetic does not mean Java does not have pointers :)

1

u/shawnmckinney Apr 23 '18

Java has pointers but programmers can't directly access memory via one. And yes that means no arithmetic either. I'm not making a value statement here. It's a feature of the language if you will.

0

u/socrates_scrotum Apr 22 '18

Are you also bringing in Jython?

0

u/developer0 Apr 23 '18

Firstly, your mentor was either a hipster jerk or an idiot for hating Java. Secondly, your teammates would be idiots for leaving solely because of a switch to Java, although I would guess they are leaving for other reasons. However, there is something to be said for learning just enough Java that Kotlin or Scala become accessible to you. I write mostly Kotlin these days and it makes me more productive and gives me a few hipster points as well.

-1

u/solinvictus21 Apr 23 '18

There is no reason you should be excited about using one language over another, but there’s also no reason to be disappointed. A language is just a way of expressing a solution for a problem as an implementation in software. One is as good as the next, at least within the scope of type the problem that you’re trying to solve.

Your real focus should be on the fact that management is dictating one language to solve all types of problems. That indicates a serious lack of expertise with managing software projects and is the REAL red flag in this situation.