r/java • u/MrCookielove • Jan 22 '21
Java is more enjoyable than I first thought
I started my years off programming in c#, don’t ask why but I never ventured off. I learned Java this past week and I’m seriously impressed, I don’t think I’ve had a more enjoyable time programming in my life. Does anyone else share this experience??
Edit: Is there a better ide than eclipse for Java
11
u/FunkyMuse Jan 22 '21
Java is enjoyable, I agree, coming from C++ it was a breeze, then I got introduced to Kotlin and everything changed.
4
8
u/gigaSproule Jan 22 '21
Having used kotlin on a reasonable sized project, I love it, but IntelliJ crawls when the file hits 500 lines (test files). Unfortunately, being a JetBrains language, good luck getting it to work outside of IntelliJ...
141
Jan 22 '21 edited Jan 22 '21
Java is quite enjoyable when you can skip the decades of cruft that are stereotypical of "enterprise Java programming": overuse of GoF design patterns, layers upon layers of abstractions etc.
So unless you have to work with really old code (pre Java 8, old-skool J2EE) I think it's a pretty nifty language these days. Sure there's some relics in the standard libs, but you can happily avoid those most of the time.
I'm a little less impressed by the state of build/project description tools like Maven, Gradle etc. - but then, few languages are great there (Rust or Go being recent exceptions) and many are worse.
11
u/riawot Jan 22 '21
a little less impressed by the state of build/project description tools like Maven, Gradle etc
I just spent the better part of a day dealing with nuget and multi-solution projects. I swear to god I will never say a bad word about maven again.
7
u/old_man_snowflake Jan 22 '21
that's why maven has persisted -- it just works. yes, it's rigid and a pain in the ass sometimes, but you can walk into almost any maven project and say 'mvn test' and get a full build and the tests run. maven makes deviating from "the way" painful, but it leaves the least-pain path as the default, which is good end-user experience.
4
u/thedomham Jan 22 '21
Yeah I think Java gets a bad rep from a lot of the enterprise stuff. For a lot of people Java is also inseparable from Spring, which is great in its own right, but also has a lot of things that are bad. Hordes of proxies for example.
5
u/wildjokers Jan 22 '21
layers upon layers of abstractions
Have you seen Spring? Java is still all about layers and layers of abstraction at the enterprise level. Just look at how many layers of abstraction the average enterprise application has on top of the data layer.
25
Jan 22 '21 edited Jan 22 '21
Have you seen Spring?
Yes, and that's why I don't use it. Spring was a nice alternative when J2EE was at its worst. Now it's just as bloated (but granted, there's not as much XML and code generation).
Just look at how many layers of abstraction the average enterprise application has on top of the data layer.
That's not a property of Java. Nowadays a lot of the indirection and layering is simply outside of the actual application, in the container and orchestration infrastructure that we use. (Isn't k8s fun?) Some of it is simply independent of the language - translating between different data models is a necessity that no language can wizard away; it can however be minimised with good design to the point where it's less of something "the technology requires us to do" but where it makes sense in the domain model.
I concur that Java people may have more of an "enterprise mindset", on average. What does that mean? It means that I understand any application beyond a PoC will need to be monitored. It will need logs (even audit logs). It will need proper configuration. It will need extension points. I'll have to find a way to upgrade gracefully when the data model changes. That's not the sexy stuff, it's the stuff that gets omitted from the quickstart tutorials of other languages that are "so much more concise!".
I've been using "enterprisey Java" since 2000 and went through pretty much all its phases. Anyone who still designs their applications like it's 2005 or even 2010 needs to brush up their skills. But don't blame the language for it. You can come up with the same shit in Elixir or Kotlin or whatever, given enough time. Probably even worse, from my experience - Java hides less of the magic.
</old man yells at cloud>
7
u/ItsAllegorical Jan 22 '21
Some say "it just works" and I hear "poorly documented assumptions" and "anything other than the defaults will require 20x as much effort".
3
u/michoken Jan 22 '21
Spring may have come to popularity when abstraction layers were THE THING, but that does not mean your Spring application still needs to be designed that way.
The problem is we design and structure our applications around a framework instead of designing it around the problem we are solving. We need to decouple our domain designs from such frameworks and let them serve us, not to be directed around by them. And learn to design proper abstractions of the problem domain. At least in my experience, almost no one actually knows how to even approach designing good abstractions.
There will always be abstraction “layers” of some sort, but the issue is if they are all of the same shape. The code I’m working with at my current job is a “great” example of that unfortunate design some like to call “lasagna code”. And that code even isn’t that old yet, it’s like 5 years of development. Perhaps back then I thought that was the way, too (wasn’t at the company yet then), but now I’m mostly furious about it and try to design new things differently. But that’s really hard when it must still work in the old structures. It would need huge refactor to improve the design in any meaningful way.
1
u/nutrecht Jan 24 '21
Have you seen Spring? Java is still all about layers and layers of abstraction at the enterprise level.
I've been using Spring almost exclusively the last 5 years or so in greenfield microservice architectures and I completely disagree with this.
Developer with bad habits will overengineer abstractions no matter the framework they use.
2
u/nomercy400 Jan 25 '21
How do you keep the memory usage of Spring under control in a microservice environment?
I'm struggling with that, and because of that I'm looking at alternatives like Quarkus with GraalVM native compilation.
1
0
Jan 22 '21
[deleted]
17
u/ray10k Jan 22 '21
From an article I've read recently, I got the vibe that Gradle is powerful, but has a lot of pitfalls and gotchas in how the configuration/script is written, while also making it harder to change things later down the line if you don't have a pretty precise picture of how your project is going to work. No idea how buggy it is though.
23
u/alt236_ftw Jan 22 '21
Gradle works of of the box if your build expectations/requirements are generally baseline/standard.
You get a straighforward way to add dependencies (both external and cross-module) and an easy way to include re-usable things in your modules, be it dependencies or build time configuration.
It does have a learning curve when you want to do more unusual things, but unless your requirements are extreme or you start seeing all of your requirements as nails with gradle being the hammer it's still pretty usable.
Just make sure you don't solutionise before you are familiar with it.
21
u/GuyWithLag Jan 22 '21
Gradle works of of the box if your build expectations/requirements are generally baseline/standard.
I mean, that's true for Maven too.
6
u/alt236_ftw Jan 22 '21
Oh yeah, I'm not dissing maven or anything.
I was commenting on Gradle specifically as it seems to have a reputation.
Both are tools, use whatever works best for your project and situation.
5
u/lookForProject Jan 22 '21
And, in my opinion, for most situations and projects, both work just fine.
1
1
8
u/larsga Jan 22 '21
Gradle mixes custom programming in with declaration, which makes it very easy to trip yourself up. It's also very easy to get into versioning difficulties both with Gradle itself and with plugins. Documentation is also not great.
For large projects Bazel is surprisingly good, even if there's a lot to learn. One thing it gets right is to separate in-depth custom functionality from customization from configuration.
7
u/wildjokers Jan 22 '21
Documentation is also not great.
I am not following you here, Gradle has outstanding documentation. Have you seen the user guide?
6
u/kwvanderlinde Jan 23 '21
Gotta disagree. There are a lot of basics that aren't covered or are glossed over. If they are covered, have fun finding it. My memory is a little fuzzy right now, but I recall trying to figure out source sets (differences between them, creating new ones, etc.) but everything just points to some really generic methods with no indication of what is actually going on. There's also no shortage of outdated information lying around on gradle's site.
6
Jan 22 '21
Today I wrote my first gradle scripts. That's awful, but for my project, maven failed completely, as creating multiple jars from one project would have required hundreds of lines of XML.
*Cries in dozens of mustRunAfter's and hardcoded paths*
3
u/shukoroshi Jan 23 '21
We've been maintaining a custom gradle plugin for about 4 years now. If you'd like any peer review, let me know!
1
3
Jan 22 '21
how coud maven/gradle be better? me for one I just put de dependencies there and use the library/plugin. Indeed trying to write something custom in gradle feels very difficult to me...is there something that you miss? why is go/rust better at this build step? I tried rust and it takes forever to compile even the most basic project(like 10s for 5 files) every time. Go is indeed fast when it comes to compiling but I haven't tried anything with lots of files
14
u/supercargo Jan 22 '21
I don’t think Maven 2+ is horrible, especially compared to the tools it replaced. There are some core things about Maven that I think could be better.
it makes a good attempt at declarative builds, but the plug-in ecosystem often has to deviate from this to get certain jobs done
partially the fault of the fact that the POM is mutable during runtime, so execution order even within a phase can become relevant
the overall “class path” story is too complex. By this I mean the logic which decides what versions of what jars get added to various classpaths in what order. You have dependencies, managed dependencies, POM inheritance, reactor (multi-module) dependencies, and then all the transitive application of the same rules.
I’ve always found the way multi-module builds work to be a bit surprising
SNAPSHOT versions being installable/deployable is difficult to reason about
Fortunately maven has been pretty well maintained and as the defacto tool, at least you can learn its idiosyncrasies and move on with your life. On the other hand, even with different tools, it would be hard to move away from some of the core issues since everything is in central with POM as the metadata format
1
Jan 22 '21
this comment is way too advanced for me since I've never had to deal with that but I do wonder how the rust/go community deals with all these...do you have any opinion on their build process? is it better/worse? I feel the urge of creating a build system that does basic things but I clearly don't have an understanding of what it implies....I wonder why aren't experienced programmers like yourself build an alternative that is better than maven/gradle
7
u/renatoathaydes Jan 22 '21
I'm a heavy Gradle user, and used Maven for many years before that. I've also been using Go and Rust lately.
Rust's advantage is that it has Cargo as THE build solution for all your Rust issues. Even though
rustccan work without it, basically every Rust project is Cargo-based. Cargo takes care of compiling/linking/configuring/testing your code, so it's more similar to Maven than Gradle, but using a very lightweight syntax, TOML, instead of XML!If you need to do anything more advanced, though, you need to write a Rust build file and use a build API... doing this actually brings you closer to Gradle!!
Why do people generally say Cargo is awesome but normally treat Maven and Gradle with disdain? Tough question. I think it's simply because the first impression you get with Cargo is that it just works.. with Maven, the amount of XML you need to write just puts people off right from the start... with Gradle, the very opaque API, together with having to know another language (pick Groovy or Kotlin) is not very good either.
Regarding Go: no idea why anyone would claim Go to have a good story here. Until recently there was no "official" way to manage dependencies, you just had to do "go get" manually and put all your projects in GOPATH (really, this is how it's worked until a year or so ago unless you did something non-standard... but now they have go.mod is somewhat more "standard", as found in other languages). Go as usual went for the simplest possible solution for the problem (which is fine! It does save a lot of time to not have to learn and play with build tools!). However, many Go projects even have to use stuff like "make" for anything outside compiling (and by the way, the Go compiler was built for speed: it's incredibly fast to compile and it can easily go through millions of lines of code in seconds).
Finally, why has no one written a "better" Java build tool? People have written quite a few build tools over the years, and they're still doing it... Maven and Gradle are just the latest survivors. 10 years ago it was still very popular to use Ant instead (the project seems to be still alive), usually together with Ivy which took care of dependency management only. There's also buildr but I don't think it was ever very popular... even before that, people would just download jars manually or via a Makefile and a few bash scripts!
Today, there's actually a few new-ish ones coming up, like Bazel, heavily used by Google, and Buck, the Facebook version... IMO they don't really offer much beyond Gradle, but who knows, maybe in a few years one of them, or maybe something not invented yet, will be what everyone will be using?! Unlikely, but who knows?
2
u/supercargo Jan 22 '21
I'm not familiar enough with the Rust or Go build systems to add much of a meaningful comment on them. If I ever wanted to take on the endeavor of creating a build system I would learn more about them first, though.
I've spent my fair share of time fighting with build tools, but usually in the context of trying to get them to do things that maybe I shouldn't have. For the most part I don't spend much time worrying about it these days.
In my opinion the mechanics of "building" software, at least at the scale that I deal with, is more or less a solved problem. There is some interesting stuff going on in the world of mono-repos, e.g. with tools like bazel, but last I checked these tools don't scale down particularly well.
1
Jan 22 '21
Interesting you say about Bazel since I stumbled upon it last year but I couldn't find a usecase for it yet
-6
u/wildjokers Jan 22 '21
as the defacto tool,
That's a stretch to call Maven the de facto standard build tool.
6
u/Interweb_Stranger Jan 22 '21
I have the feeling that Gradle is used a lot for small projects but I would say Maven is definitely the industry standard for Java projects.
4
Jan 22 '21
on backend projects yes. On android projects gradle dominates the scene but I also preffer gradle in the backend if used with caution: don't put any programming logic inside there and only use it to declare dependencies & plugins
3
u/wildjokers Jan 22 '21
don't put any programming logic
It is a complete myth that builds can be declarative and don't require programming logic. When you include a plugin you are in fact introducing programming logic. Just because it is packaged as a plugin doesn't mean it isn't programming logic.
2
Jan 22 '21
But in this case you create a plug-in and not write the entire thing just below your dependencies. Short functions should be fine but if it gets complicated then just extract everything somewhere else
-1
u/wildjokers Jan 22 '21
definitely the industry standard for Java projects.
I totally disagree. That may have been true in the past but I would like to see the percentage of gradle vs maven for greenfield projects.
2
u/supercargo Jan 22 '21
Nonetheless, your gradle greenfield project is very likely consuming dependencies from maven (formatted) repositories which rely on the the maven meta-model. Even if all those dependencies are also built by gradle, they are distributed using the maven model.
If you ever find yourself needing to reason about the details, you'll need to understand how maven handles these things. Not to put too fine a point on it, but the Gradle documentation page for "Building Java & JVM projects" mentions Maven 13 times! And they aren't all just "if you're used to maven" type inclusions.
1
u/wildjokers Jan 23 '21
For sure, maven introduced the concept of dependency management and deserves full credit for that. However, I have no idea what that has to do with anything. Just because gradle can also get dependencies from maven formatted repositories doesn’t mean you have to count a project using gradle as a project using maven. Your whole comment was a straw man.
However, to continue down this path gradle can also read repositories of other formats like Ivy. As someone that used to use Ant+Ivy I can tell you that the Ivy formatted repositories are much more flexible. Also, gradle now includes its own metadata file when it publishes a jar because the maven metadata was too limited.
1
u/supercargo Jan 23 '21
You seem to be missing my point, which is not a straw man at all. I’m not making a “this tool” vs “that tool” argument, so I don’t really care how you “count” usage of either tool either. Let me see if I can break it down a bit further.
Most non-trivial Java projects will depend on one or more libraries published in a Maven repository (typically central) using the Maven POM meta model
Typically those libraries will have transitive dependencies which must also be resolved in order to create build, test and run-time classpaths, which themselves have dependencies and so on
In the process of adding or changing dependencies and/or dependency versions in your own project you may find that some conflict arises. E.g. this could be a conflict between transitive dependencies of two libraries you depend on, rather than anything you did explicitly in your build tool of choice. This is sometimes known as “jar hell”
In order to reason about this situation you must understand how maven resolves dependencies regardless of what tool you use. (you may even experience this issue due to a “bug” in the way your tool uses maven metadata compared to the way Maven does so natively). You are inheriting the problem from your dependencies which are distributed using the maven model. Of course, the mechanism you use to solve the problem (e.g. locking down a version number) will depend on your own tool choice.
So all I’m saying is that the Maven model for artifact distribution (in specific, not just in concept) is a baggage that is carried by he majority of Java projects. As a consequence we are stuck with any shortcomings that model has, especially in situations which require actually understanding what our tools are doing and why. This will remain generally true unless/until maven-distributed artifacts are reduced to an uncommon curiosity.
→ More replies (0)6
u/antennen Jan 22 '21 edited Jan 22 '21
why is go/rust better at this build step?
I think you are conflating build time with how good the build system is. The Rust compile times are pretty bad, but the build system (Cargo) is great. There is a simple TOML file that allows you to do pretty much everything. Even a large project's Cargo.toml is small. For larger Java projects the maven
or gradlefiles are a multi thousand line mess.EDIT: Comments rightly pointed out that Gradle files aren't as verbose as Maven XMLs. I still think the state of Java build systems leaves much to be desired.
4
Jan 22 '21
I agree that maven can get big because of xml but with gradle I did not see 500 lines files...I might have worked on small projects though(2-3 people on android and 3-4 people on maven backend). I also think that you should not write logic in gradle or maven....that should be put inside a plugin or somewhere else. Cargo I don't know if it offers you the possibility to do any logic in the toml file(which you shouldn't do anyways) so the point is that maybe gradle tries to do too much
1
1
u/krum Jan 22 '21
I don't know what you're doing wrong with Rust, maybe running it on a 486SX, but it compiles way faster for me than that.
3
1
u/rocketmannot Jan 22 '21
Maven is bug prone too. Javadoc plugin not working out of the box with java 11. If you developing your own archetype and include .gitignore file - it will be silently filtered from generated project. Maven release plugin can not include additional files during release phase. These only some bugs/missing features i saw recently.
1
144
u/jjnnzb Jan 22 '21
IntelliJ IDEA is what we use on a daily basis as Java IDE in the company.
15
u/popovitsj Jan 22 '21
Eclipse is pretty good, but I love IntelliJ.
20
u/ejovocode Jan 22 '21
As a recent convert, never going back to eclipse. Intellij is just so much more responsive and has some pretty nifty features that I wasnt used to after using eclipse. One thing I like: when passing parameters to a function, Intellij reminds you the name of the local variables.
For example, if I call
sum(10, 20);Intellij will highlight this as
sum(a: 10, b: 10)If a function has a lot of parameters, its really quite helpful.
13
u/mickaelistria Jan 22 '21
Eclipse IDE has had this feature for the last 8 releases: https://www.eclipse.org/eclipse/news/4.12/jdt.php#parameter-name-codemining
8
u/vikarjramun Jan 22 '21
Eclipse IDE has had this feature for the last 8 releases:
Woah, TIL! That's the first feature difference that IntelliJ fans cite so I'm glad that Eclipse has closed that gap already.
3
2
u/lsiu Jan 23 '21
The true strength of Intellij is you can press alt-enter over anything and it pops out a context menu with an option that does what you want.
73
u/qerf Jan 22 '21
For IDE, go for intellij. It´s really good for java development. I switched to it and never looked back
9
Jan 22 '21
If Eclipse (especially m2e) ever gets as good as IntelliJ's ability to open a project from its pom and pull it in instantly figuring out its structure and letting me go to work right away on it; I might go back to Eclipse. It's more powerful than IntelliJ CE though not more powerful than IntelliJ Ultimate. Eclipse would also need to get as good at code recommendation popups that makes IntelliJ so useful. Some day maybe. In the meantime, agree, IntelliJ (even CE) is the way to go.
13
u/passive_talker Jan 22 '21
What do you mean? Eclipse opens maven projects and figures everything out. I've been doing it for many years.
2
u/Tkalec Jan 23 '21
Does not quite figure everything out for me, ever 😀. Maven support in eclipse is pretty bad.
Just today I've spent a lot of time trying to get the eclipse to correctly handle src/main/generated sources by Immutables library.
Doing a mvn clean compile on the same project (because i needed another maven profile), completely messed up the project and eclipse was complaining it couldn't find my own classes from other packages or even from the same package.
A lot of my teammates are also constantly complaining about eclipse's maven support.
Needless to say, that project is working just fine in idea.
1
Jan 22 '21 edited Jan 23 '21
With IntelliJ, I can rm -rf the .idea directory and the .iml file and open it like a new project and it works. In Eclipse, I try to stay up with seeing how it's doing, last one I tried was last summer but deleting .project, .classpath and .settings and using the Git Perspective to Import like it's the first time, depending on the complexity of the project Eclipse potentially can stumble some, IME, and issues need to be sorted by the dev. Once it's sorted, it works fine.
PS When I worked on Monorepo (and Monolith) projects, I'd not have to re-import projects often so Eclipse seemed fine. When I started doing Microservice projects exclusively, much to my chagrin, I gravitated slowly towards IntelliJ. I like Eclipse, I want to see it improve in at least this area, project and pom management which includes IntelliJ is smarter at overall managing the pom, which I didn't get into above.
I do sorely miss not being able to open and debug multiple dissimilar projects in the same IDE instance like Eclipse but working on Microservices I've not really needed it. If I found myself doing project mixes like a mix of backend and UI or backend and a whole other language maybe C++ for example, then I'd probably gravitate back to Eclipse, hard to say though.
4
u/passive_talker Jan 23 '21
I'm not sure I fully understand your comment, but eclipse has been doing that for like 10 years. I use "import maven project" though. IntelliJ is better than eclipse in many aspects, but maven support is probably not one of them.
1
Jan 23 '21
Do you import the files directly into the Workspace or use the Git Perspective Import, which only imports the metadata about the project into the Workspace (the preferred method). If the latter and you do it often like I need to do then you will see issues that you will have to sort out. If the former and the files are literally imported (copied) into the Workspace, it's not recommended and I haven't used Eclipse like that in a long time but maybe it works better in that case.
2
u/passive_talker Jan 23 '21
I clone the project with git (I prefer the git command line over IDEs), then open eclipse and import the project. It just works.
0
3
Jan 22 '21
Yes! The (almost) seamless Maven experience was what won me over. I still shudder at the thought of generating Eclipse .project files with Maven plugins and all that crap.
That said, Netbeans also seems pretty great at that, at least when I tried it years ago. AFAIR it doesn't even translate to its own specific files, it just uses the POM directly.
1
u/qerf Jan 22 '21
I was talking about the ultimate edition. Forgot to add that on my original comment. No real experience with the community edition, so I can´t comment on that. I know CE doesn´thelp with spring. For my company, It's well worth the price
3
Jan 22 '21
I’ve been trying to switch for my last few projects, but I always get started and just decide to go back to Eclipse because my workflow is slowing down. I need to just stick it out though.
1
u/qerf Jan 22 '21
What items do you find better in eclipse? I haven´t used it in the last few years so I might be missing some recent features.
2
u/Daomephsta Jan 23 '21
I've also tried to switch several times.
For me the killer is the inspections. IntelliJ has a much better variety, but they generate too many false warnings. For example, unused public classes generate a warning by default, even when using JDK 8.I also prefer Eclipse's Open Type dialog, as it looks in libraries by default. Plus it can search in specific libraries.
1
13
u/jameslfc19 Jan 22 '21
Modern Java is so nice to use, combined with IntelliJ, Maven and frameworks like Spring Boot you practically don’t have to do any of the hard boilerplate graft and dependency setup.
I just recently found GraphQL and combined with Spring Boot it’s one of the most enjoyable API experiences
24
u/endjynn Jan 22 '21
I had exactly the same experience. I went from C# to Java and was really impressed. Java is a beautiful language and a great coding experience. It was a breath of fresh air after the Microsoft ecosystem. C# is also an awesome language but the framework experience is lacking. Poor documentation, bloated IDE, confusing naming and versioning etc. You should try TypeScript next. It's my favorite language at the moment :)
6
u/couscous_ Jan 22 '21
but the framework experience is lacking
I thought ASP.NET Core was quite fully fledged. Is it missing things that exist in Spring for example, or are you referring to other Java frameworks?
1
u/ChristianGeek Jan 23 '21
I went the other way, from years of Java (starting with the first release) to C#. I found C# easier to work with at the time (this was pre-Java 8), both in terms of the language and Visual Studio. Now I’m working with Kotlin and Scala. Hate Scala, love Kotlin. Adore IntelliJ.
20
u/tlvlp Jan 22 '21
After trying dynamically typed languages, Java was the first that helped me wrap my head around programming and is still my favourute so far. Once I've understood the basics with the strong type system it was much easier to understand and use python, js.. etc.
After trying NetBeans, VSCode and Eclipse, I found that IntelliJ (even the free community edition) is much superior in user experience, it really helps a lot in the daily work. The context-aware suggestions and auto completion, etc. even helped a lot in learning best practices as they go beyond just making sure the code runs.
7
u/mickaelistria Jan 22 '21
What's the last release of Eclipse IDE you tried? Using Eclipse IDE + SonarLint extension gives all that; for free.
5
u/tlvlp Jan 22 '21
I haven't tried the newer ones yet, thanks for the tip. The last one I tried was released around 2017.
I wonder why people keep bringing up that Eclipse is free, since I have used intellij's community edition for like 3 years and it already included all these great features and was completely free (before I switced over to pro edition for some extra convenience features).
1
u/mickaelistria Feb 08 '21
You don't have access to Java EE, server management and other things with IntelliJ. It's an open-core, which means that the free part is mostly used as a driver to sell commercial non-OSS extensions. On the other hand, Eclipse IDE has a lot of this as community open-source components; but nothing prevents someone from making a commercial package/extension for the Eclipse IDE like JetBrains is doing.
10
u/NiceWetTissue Jan 22 '21
I agree. I went from javascript and react to java and spring and im enjoying my job much more. When im working on personal side projects i get frustrated when i have to do front end lol
1
u/Kango_V Jan 25 '21
You should try Micronaut and Immutables. So much fun. Goes nicely into GraalVM and Truffle :)
10
u/andrewharlan2 Jan 22 '21
I've been hacking with Java for two decades. It is my language of choice. It continues to be a joy for me.
8
u/Nexius74 Jan 22 '21 edited Jan 22 '21
Comin from a python background java has been really enjoyable. Their's some concept and way of doing things that seems more natural to me then in python.
8
u/aakoss Jan 22 '21
JVM is great, you are productive very quickly with a lot of safety.
Polyglot on JVM provides you all the tools you may ever need to fit the tool rack. clojure, scala, groovy are just some of them
7
u/nimtiazm Jan 22 '21
Yeah Java is pretty good and doesn’t get in your way for the most part. More importantly now it’s getting better with every release. But admittedly, JVM, GC, the JIT compiler and all the tooling JFR et al is truly unparalleled. I just wish that the ecosystem steers towards more performance-oriented stories and small hardware.
1
u/Kango_V Jan 25 '21
Try compiling to native with GraalVM. You can even then have ms startup in AWS Lambda :)
2
u/nimtiazm Jan 25 '21 edited Jan 25 '21
Doesn’t support the latest openjdks’ and doesn’t compile with all the libs I use most of the time.
1
u/Kango_V Jan 25 '21
Doesn’t
Yeah. Java 11 at the moment. I'm mainly compiling Micronaut web apps to native.
7
u/rkalla Jan 22 '21
Technically IntelliJ is the most universally praised Java IDE... BUT... BUUUUTTTTT... I have always preferred Eclipse specifically because of the editor behavior and formatting specifics.
That said, I hate _both_ of their concepts of Project/Shim/Capabilities/Addons... so easy to break.
Source > Java developer for 15 years.
13
u/DJDavio Jan 22 '21
Kids these days, they don't know what it was like to have no generics, no lambdas, no Lombok, etc. ;)
Java today is a lot more fun than Java 10 years ago, not only because of improvements to the language but also because of improvements to the entire ecosystem.
Spring Boot and Docker revolutionized the way we build and deploy applications, making our job much more enjoyable.
Not to be that guy, but if you're coming from C# and like Java, you will surely love Kotlin. It has many small features which C# has which makes it sort of a Java++.
-1
u/wildjokers Jan 22 '21
no generics,
Those were dark days for sure!
no lambdas, no Lombok,
No lambdas and no lombok (especially no lombok) would be great. Code with a lot of lambdas is just an unreadable mess.
7
u/thephotoman Jan 22 '21
I've routinely found the opposite with respect to lambdas. They've made a shitton of nested looping into a fairly simple and easy-to-read set of function calls.
That said, for someone unused to them, I can see why they're bewildering. It took my team about three months to become accustomed to them.
Lombok...sometimes it's good, sometimes it's bad.
1
u/Kango_V Jan 25 '21
Try the Immutables project if you wish to get off Lombok. Annotation processors ftw!
6
11
u/mickaelistria Jan 22 '21
Eclipse IDE is actually a great IDE. Many people like to waste their energy badmouthing it to feel better about sending $$$ to JetBrains, but actually very few of them have tried recent versions of Eclipse IDE and the vast majority of the concern the express about it are wrong or outdated.
The main benefits of Eclipse IDE, despite the full open-source free solution, is a more diverse ecosystem that can touch domains ignored by IJ, the performance that are nowadays often much better in CPU and RAM and battery, the native intergation in the OS and accessiblity, the fact that the same IDE instance can be used to work on multiple projects using different languages at the same time with consistent workflows.
5
u/ItsAllegorical Jan 22 '21
I recently started working in a shop that is standardized on IntelliJ. It's fine. Most people seem to prefer it. I've been using Eclipse for over 10 years and I prefer it. Doubtless it's more a matter of familiarity more than anything else. I stick with Eclipse because I don't ever have to worry about wanting an "enterprise" feature and getting my hand slapped because I need a license to do that, but arguably that's much less likely in personal projects than professional. Still, I like to hone my professional skills so it's common for me to use enterprise solutions when there are far simpler options.
4
u/coderguyagb Jan 22 '21
Serious question, what don't you like about Eclipse?
I've used both for years, once you learn the shortcuts each has it's pros and cons.
7
u/wildjokers Jan 22 '21
Edit: Is there better a better ide than eclipse for Java
Now you have gone and done it. The comments are going to turn into a dumpster 🔥 now.
There are 3 main Java IDEs: IntelliJ, Eclipse, and Netbeans. The most popular is IntelliJ (most surveys indicate it surpassed Eclipse a couple years back). However, you can try them all to see which one you like best. All are free, IntelliJ has a paid version called Ultimate that adds more features.
0
u/mickaelistria Jan 22 '21
And Eclipse IDE has a free version call Eclipse IDE that has more features ;)
7
u/adMartem Jan 22 '21
I've been programming for 55 years, and 15 in Java. It is indeed fun. I'm not sure it is more fun than writing operating systems in COMPASS (6600 assembly language), but it certainly is more productive by several orders of magnitude.
6
3
u/CompetitiveSubset Jan 22 '21
If you can pick and choose your favorite stack, with a level of abstraction that is comfortable for you, a good IDE to speed up things, Java can be very productive and enjoyable.
3
Jan 22 '21
I like this comment because I started with Java and never ventured off. I’m trying to get into full stack web development now and I’m learning JavaScript. I always hated js when I had to touch it previously, but now that I’m really going in, I’m loving it. It feels like the code practically writes itself sometimes.
Like someone else said, Java is fun until you get into the nitty gritty of abstraction. Then it’s just a pain in the ass. Java will always be my first love tho
7
Jan 22 '21
If you write Java the right way - immutable objects, design patterns, etc - Java is safe and sweet :) I think it goes for every language...
5
u/CrommVardek Jan 22 '21
Funny I had a similar experience, but the other way around, I started with Java. Now at my current job, I use C# but I still prefer Java. When I first learn c# I found it quite enjoyable as some things where much more straight-forward than Java - but also more "restricted". But to me C# (with .net core) is very similar to Java 8+
1
u/couscous_ Jan 22 '21
What do you prefer more about Java than C#?
3
u/CrommVardek Jan 23 '21
In short: the eco-system, the community and the release cycle. Also, the fact that other languages are built on top of it (Kotlin and Scala). Mostly it is the eco-system. When working in C#, once you want to derivate from the traditional .Net Core, Asp, Entity, it becomes tricky, because: no so much options, some of them are not maintained anymore, you have to customize a lot for something that should be simple. On the other hand, if your business case / architecture is simple and straight forward, it is easier with C#.
In the end I prefer Java because you have more options, more choices and more flexibility when you develop a software : )
4
u/maxandersen Jan 22 '21
try jbang.dev - makes Java even easier to get started with :)
(I’m biased though :)
4
u/KFCConspiracy Jan 22 '21
Edit: Is there a better ide than eclipse for Java
IntelliJ is my favorite. But it's a controversial topic. If you don't like Eclipse try Netbeans and IntelliJ.
10
u/Mordan Jan 22 '21
Eclipse rocks.
Use it with a 4 screens perspective setup and fast incremental compilation.
No other IDE comes close to this comfort.
2
u/ragnese Jan 22 '21
I'm curious. What do you find different about Java and C#? Did you expect Java to be less enjoyable? What about Java makes it more enjoyable than you expected?
2
Jan 22 '21
This post is "funny" (a.k.a., sad) as I have recently been forced to move from a Java project (which has been my primary language for 10 years) to a C# project, which I know nothing about. I wish I could go back to Java. 😔
3
3
Jan 22 '21
I'm using IntelliJ Idea Community Edition (free) and it's great.
I'm learning Java right now, and find it enjoyable compared to TypeScript (what I used before)
2
u/cavecanemuk Jan 22 '21 edited Jan 22 '21
Yes, Java is simpler. C# is much is a more complex language, with too many features and some ugly APIs.
I also don't like their conventions of creating all interfaces with the "I" prefix, IVehicle instead of Vehicle and "ICar" instead of Car. Sure Apple fanboys might like this :)
Web Programming: Nothing in .NET comes even close to JAX-RS for readability when it comes to developing APIs. CDI is great too for Dependency Injection.
A framework like Quarkus.io when you don't even need to push the "Compile" or 'Deploy" button, but just write code and everything is automatically published is just a dream in .net world.
IDE: Nothing beats IntelliJ here, no other IDE comes even close. VSCode is alright for little one-class projects, but for a serious project just get yourself IntelliJ.
1
u/thephotoman Jan 22 '21
Lambdas and streams significantly improved Java.
Use IntelliJ IDEA, which is just nicer than Eclipse. I don't have to deal with an unwieldy third party Vim plugin. It makes opening shells in the IDE easier.
1
u/loomynartylenny Jan 22 '21
tbh I started with Python, then I learned Java, but I have since dabbled a bit in C#, but I still prefer Java to C#.
Partially because there's no operator overloading (because having to deal with things being done by methods and things being done by operator overloading does get confusing), partially because Java's less of a pain to work with (intellij community doing all the heavy lifting with configuration for me, whilst I haven't found a free IDE for C# that similarly abstracts away that terminal faff), partially because JavaDoc comments are much less hassle to write than C#'s xml-y documentation stuff, and also because you can declare that methods can throw exceptions in Java (unlike in C#).
Although, I will admit that there are some things which C# has which would be nice to have in Java (such as the pass-by-reference stuff), but I just find Java easier to understand, because everything works as expected. If I want to do something to an object, I know it'll definitely be done by calling a method. And not by putting a random symbol next to it and hoping it does what I think it's supposed to do.
1
1
u/echnaba Jan 23 '21
What in particular are you excited about? I just made the switch about 2 months back and I'm still annoyed with it compared to C#....though Lombok is pretty cool.
1
1
u/JimBugs Jan 23 '21
Holy war - which IDE is best.
There are lots of excellent IDEs. Of course you will get recommendations because everyone has a favourite, but it's a pretty mature market and if there is something you feel is missing from an IDE it's likely you just haven't learned how that particular IDE implements it.
However you may find you have a preference too so just give them all a fair try.
1
u/_ragerino_ Jan 28 '21 edited Jan 28 '21
I prefer Eclipse, because I'm used to it since many years. It can basically do anything if you know where to turn it on ;)
At the moment I start with Spring Tool Suite and add Darkest Theme from Eclipse's Marketplace.
Here's a tip that will improve your experience with Maven, which is my goto dependency and build tooling -> https://stackoverflow.com/a/24494049/363455 (This needs to be enabled per workspace).
For scripting I use VSCode.
1
u/volley12345 Jan 22 '21
I'm coding since 35 years, in java since 20 years... so yeah, it's quite good.
As for IDE: if you're starting out, i'd recommend microsofts visual studio code (open source). It is modern, has huge customization options and the amount of features are also increasing extremely fast, even though Eclipse has some features i still miss there.
-2
u/Qildain Jan 22 '21
VSCode is also MUCH faster than Eclipse, especially when your set of plug-ins grows.
I would also like to suggest it as a good alternative.
1
u/mickaelistria Jan 22 '21
Have you tried latest release of Eclipse IDE? I'm using Eclipse IDE daily with lots of plugins, with hundreds of modules/project in a variety of different languages and frameworks, and it works.
I would even try to do it in VSCode, the UX doesn't scale a recommends 1 instance per project; it cost much more time in switching, more than the few milliseconds of difference one can sometimes perceive on some operations.
1
u/Qildain Jan 22 '21
I've tried to like Eclipse numerous times over the last 15-odd years. Every time it's been the same issue.
Check out a project from source control, try to build it, when it fails, download a needed plug-in, repeat. Finally find some tweaky setting that isn't well-documented, FINALLY get the build working, then sit and get frustrated because your application startup takes much longer than when it is run in... well, any other popular IDE.
Why bother with a Java IDE that doesn't work out of the box, is slow, and supports a dozen different languages that I'll never need?
I've tried quite a few IDEs, and I'll take Intellij (as long a I'm not paying for the pro license) or VSCode over Eclipse. I've given it too many chances already.
-5
u/misterbobdobalina09 Jan 22 '21
IntelliJ is the only IDE you should use. All others including Eclipse are crap.
9
u/GhostBond Jan 22 '21
(rolls eyes)
I see we're in the weekly "Intellij Advertising" thread.
-4
u/misterbobdobalina09 Jan 22 '21
So what's better according to you? Eclipse is junk.
2
2
u/nioh2_noob Jan 22 '21
Eclipse is junk.
you're a fool and you know nothing, stop posting things
0
u/misterbobdobalina09 Jan 23 '21
You can be a fool and you know nothing. I've used them all.
1
u/nioh2_noob Jan 23 '21
with your limited knowledge you used nothing
1
u/misterbobdobalina09 Jan 24 '21
Your knowledge of what I've used is obviously limited but you don't even understand it yourself. Sad.
1
1
1
1
1
1
u/TomStripes Jan 22 '21
I'm adding to the chorus: I prefer JetBrains' IntelliJ.
An added benefit with IntelliJ is that JetBrains makes IDE's for most popular languages, and if you get used to the design of one you are used to the design of all of them. It's really nice to already know the ins and outs of an IDE every time you start working on a new language.
1
u/mickaelistria Jan 22 '21
Well, that's not a rock solid argument, as Eclipse IDE has a single IDE for many languages, and all those projects in different languages can be edited simultaneously in the same instance of the free IDE... If you're doing polyglot development, you'll actually find Eclipse IDE more comfortable in most cases.
1
u/TomStripes Jan 22 '21
I was saying that with C# in mind in particular, since OP's background is in C#. It's been a few years since I've worked with Eclipse, so it's probably improved, but back then at least it was not a good environment for .Net development without hacky third-party plugins.
Either way, I didn't claim a rock solid argument -- just stating my preference.
0
u/ivancea Jan 22 '21
Well, I think Java is years behind C# (generics, async, exceptions, Streams/LINQ...). And now with .NET 5, even more. I work with Java, because it is the language used in my company.
About the IDE, I recomment IntelliJ (community edition is free), unless you have to work on multiple projects at the same time*
4
u/john16384 Jan 22 '21
Java was and is designed for easy readability, no surprises and as little magic as possible. Less is more in this case, even though it means Java is a bit more verbose sometimes.
2
u/CyAScott Jan 23 '21
I agree. However, I know the philosophy driving Java syntax is keep it simple to make it readable. But that philosophy makes it feel like the syntax is frozen in time. The things I miss most are in line null checks and extension methods.
1
u/helikal Jan 23 '21
The Java architects make sure language and technology development are in harmony with past versions. That is why Java always feel the same. It’s a plus because the platform’s progress causes zero or minimal distraction from what I actually need to do.
1
u/ivancea Jan 23 '21
Yeah, but it makes Java an outdated language now at 2021
1
u/helikal Jan 24 '21
No. It only makes it low-drama productive.
1
u/ivancea Jan 24 '21
It also* makes it low-drama productive. Pros and cons. Compare it with C#
1
u/helikal Jan 25 '21
C# is a good on Windows. Its extra language features are nice but Java will get corresponding ones. The Java ecosystem is larger and more diverse. The lead is substantial.
2
u/ivancea Jan 26 '21
Java already had many years to implement 20XX features. MSFT wan't slow, and now with .NET Core and .NET 5 opensource, the ecosystem is growing. I hope people will start using C# again, for our own sake
0
Jan 22 '21
No, not really. I develop in Java for several years now but I started with c#. C# has better syntactic features, better generics and linq is pretty awesome. Things I wish Java had. If your impressed by Java, try kotlin.
0
u/yoon1ac Jan 22 '21
I had the opposite experience haha. I went to University and learned go Java, but when I graduated spent 2 months learning C# and felt like I could build more meaningful applications than I could in Java
-3
-2
Jan 22 '21
Edit: Is there a better ide than eclipse for Java
Try out VSCode.
I'm very used to eclipse, but I would like to switch from it to vscode myself. Even tho eclipse is very powerful, I see that junior devs and people like yourself have a hard time accepting eclipse for what it is.
1
u/nutrecht Jan 24 '21
Try out VSCode.
So switch from Eclipse to an editor that basically uses Eclipse as a plugin :)
1
0
Jan 22 '21
[deleted]
0
Jan 22 '21
[deleted]
3
1
Jan 26 '21
I have been using NetBeans in a "professional setting" (web development, backend, Swing, Spring, JavaEE, ...) for over 15 years now and I have never had any problems (and that was in teams where others were using Eclipse and IntelliJ as well)
0
Jan 22 '21
[deleted]
0
u/mickaelistria Jan 22 '21
VSCode uses Eclipse IDE under the hood for Java. It's Java features are literally an adapted subset of what Eclipse IDE offers. It doesn't mean it's bad, but it's necessarily less feature-rich.
0
Jan 22 '21
[deleted]
2
u/xxbeanxx Jan 22 '21
The IDE itself isn't based off Eclipse (it's actually built on Electron). The Java plugin subsystem borrows from Eclipse.
This becomes evident when needing to do things like auto invoke the annotation processor when compiling Maven projects. It uses the same configuration as m2e-apt.
44
u/thehinkypunk Jan 22 '21
If you enjoy programming with Java, you should try the Spring framework (Spring Boot especially) for the development of services. Guess you'll love it.
Regarding the IDE: Try IntelliJ.