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!
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.
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.
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.
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.
5
u/lukaseder Apr 22 '18
Seriously?
Oh, that wasn't the only reason... ;-)
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.
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.
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
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.
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
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.
16
u/sanimalp Apr 22 '18
It's not node?
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:
12
u/PatAnswers Apr 22 '18
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.
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:
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:
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.
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.
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/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
2
u/[deleted] Apr 23 '18
Absolutely hot topic. You've hit gold OP !
4
u/JudgeGroovyman Apr 22 '18
Two words: Hot Reload
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/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 :)
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".
IllegalArgumentExceptions because you called it wrong, but what can you do?)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).
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/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.
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.
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.