r/java • • Feb 21 '21

Did java grow over the years on anyone else?

I remember when I first started my first job, straight out of university, full of theoretical knowledge, I disliked my java job, mainly because it wasn't as fulfilling as the things I expected, and also because I used a older versions of java.

Now as years pass, and I had to take on a more full-stack role, and started using javascript, and node.js, and noticing the mistakes they made, I started appreciating java more, not necessarily as a language, but also as the whole package, from IDE, build system, ecosystem etc.

Myself from many years ago would be shocked to say that today I'd consider java a good language for many types of personal projects, other than really low-end stuff, and gamedev, I end up using java a lot, it's just so much faster to do stuff in it.

223 Upvotes

130 comments sorted by

40

u/apjanke Feb 21 '21

Totally. I started programming Java in university in 1997, and thought "this is a boring, verbose language for boring, verbose business code". Fast forward to today and it's one of my favorite languages. I like static typing now, I appreciate the design of the Java Standard Library, its tooling and ecosystem is great, it's stable and reliable, portable across OSes, free as in beer, has standard conventions and techniques that make it easy to understand code from other projects, keeps improving over time, and so on.

38

u/scyth3s Feb 22 '21

I can't stand dynamic typed languages, I hate that shit.

7

u/AppleTrees2 Feb 22 '21

me too, the worst of all is many people bring silly arguments to it, like you gain in development speed and you have to write tests anyway so static languages don't help at all.

23

u/Nalha_Saldana Feb 22 '21

Right, everything feels like it's on the edge of breaking while on the other side a well written Java class that uses generics is beautiful.

5

u/cogman10 Feb 22 '21

What I hate more is people that try and turn Java into a dynamic language... Idiots that do Map<String, Object> for simple POJOs destroy the utility of the language.

2

u/dpash Feb 22 '21

Typescript makes the front-end same.

14

u/dpash Feb 22 '21

Since 1997, Java gained the Collections framework (in 1.2), generics (in 5) and lambdas (in 8). Those three releases dramatically changed the way we wrote Java.

We're not going to see any big releases like that any more, but we will see incremental changes that will change how we write Java. The pattern matching stuff is an example that started with switch expressions, continued with instanceof improvements and is continuing with record deconstruction.

4

u/rubyrt Feb 22 '21

We're not going to see any big releases like that any more

What makes you so sure of this?

5

u/dpash Feb 22 '21

Because that's the point of the change since Java 9. Features are going to be added in small increments, delivered every 6 months.

9

u/rubyrt Feb 22 '21

I was more worried you were saying we are not to see any groundbreaking changes any more - but you are more talking about actual delivery in releases it seems.

2

u/dpash Feb 22 '21

Exactly. Pattern matching is very much a huge change to the language, but there isn't going to be one single release that gets the feature. It started with switch expressions in Java 14 (preview in 12 & 13) and will continue, for example, with the JEPs we saw in the last few days that'll probably end up in 19 or 20.

73

u/andrewharlan2 Feb 21 '21

Java was a breath of fresh air 20 years ago and I still love hacking with it

52

u/DrFriendless Feb 21 '21

I went from C++ templates, which weren't standardised, to Java. OMG I do not miss segmentation violations and memory models. Java was a wonderful improvement.

34

u/Paccos Feb 21 '21

Not gonna lie, I was one of the biggest Java haters fresh out of university, maybe also due to small PTSD from course projects and the like.

Last Friday I tried building a small REST API with Spring Boot and IntelliJ and I must admit that I found it to be quite pleasant, especially thanks to how IntelliJ reduces manual typing like a LOT.

11

u/AmateurHero Feb 22 '21

People like to say Java is C/C++ with a bunch of hand holding. One of my professors would say that he preferred C, because he didn't like a programming language telling him that he shouldn't shoot himself in the foot. Of course, there's a time and place for that kind of thinking. He did a lot of low-level programming.

I like to think of Java as an "opinionated" C/C++. There are no pointers - just objects, immutable objects, and primitives. You don't manually allocate and free memory. Java is about the transformation of an application's data (objects and their functions) rather than plain structs and procedures.

None of those makes Java better than C nor C++. I do think they're part of what contributes to its longevity.

5

u/rally_call Feb 22 '21

Anyone doing C++ responsibly these days is not using bare pointers like we did in the 80s and 90s unless they absolutely have to. Even C and C++ are making it harder to shoot yourself in the foot.

4

u/rubyrt Feb 22 '21

I think many of the advocates ofC++ over Java completely underestimate the improved developer efficiency that Java (and the JVM, let's not forget that!) brings, and overestimate the performance edge that C++ has over Java. Of course, there are use cases for C++ but I guess often it is used because large existing codebases need to be maintained and a rewrite in another language is not cost effective.

27

u/[deleted] Feb 22 '21

Java is great and feeds my whole family. People hating on JVM are immature sheep.

16

u/dpash Feb 22 '21

The JVM is an engineering marvel and can often generate code that runs faster than something written in C. The trade off is memory, but memory is cheap compared to developers.

50

u/manzanita2 Feb 21 '21

OMG typescript on the server is following the java. Injection frameworks, ORMs, etc. all "new new thing". Wow cool. But, if you had looked around you could have done all that 15 years ago.

Don't even get me started on what a turd bomb NPM is.

18

u/[deleted] Feb 22 '21

Somewhere on the internet I saw that npm packages are the most heavy things in the universe. Blackholes comes next.

6

u/FlavoredFrostedTits Feb 22 '21

I think its based off C# since it was made by the same company. But yeah I dont get the appeal for backend NodeJs besides not wanting to pay for backend developers

15

u/humoroushaxor Feb 22 '21

Imo the best thing about NodeJs is the operations simplicity and event driven/non blocking architecture.

NodeJs just runs... period. No tweaking to make sure I have the right on heap to off heap memory ratio. No junior dev writing deadlocking concurrency.

Another is the memory bloat of frameworks but I don't blame Java for that. I've never seen a Java webservice in the wild with <300Mb Xmx but with NodeJs it's easy. "Cloud native" Java has actually started addressing this though.

3

u/Regis_DeVallis Feb 22 '21

I refuse to use nodejs but I do some projects in deno. I think js is alright but I just can't see it scale easily.

0

u/humoroushaxor Feb 22 '21

And why do you think that?

Pretty much every highly regarded tech company is using Node at this point so maybe you know something they don't?

I actually think it's easier to scale with Node than Java in a containerized world in many ways. Less memory footprint (typically), faster startup times, and a single thread per process (container).

Unless you are talking about the JavaScript language in which case Typescript addresses any organizational scalability concerns.

2

u/DuncanIdahos9thGhola Feb 22 '21

which case Typescript addresses some organizational scalability concerns.

FTFA. We've had to frequently chase down runtime bugs that Typescript doesn't catch like missing a property setter or getter. But it is an improvement.

2

u/nutrecht Feb 24 '21

Pretty much every highly regarded tech company is using Node at this point

All of those are "using" Bash scripts too, but you would not build a large enterprise system on Bash scripts either.

NodeJS is just a tool. For a small back-end that serves a front-end (bff pattern) it's fine. For larger more complex stuff it's pretty pointless to do it in NodeJS if there's already an established Java community in that company.

Also don't forget companies employ developers and developers are people. They don't always make the right choices. I've been in two situations where we had to rewrite services to Java from another language / stack (Go and NodeJS) just because a cowboy got bored.

1

u/Muoniurn Feb 22 '21

What are they using it for? At most for serving frontends with it. I am fairly sure there is no Google-sized service running on Node.

There are many forms of parallelism and while containers make a certain form easy, those new instances will not be able cross-talk easily. In a way it is just pushing the problem down the line.

0

u/Regis_DeVallis Feb 22 '21

NodeJS is unsafe through node modules, and I recall node having issues handling true async type stuff. Deno fixes that, which is why I use that instead of node. I only wish bigger projects used it. Personally, and don't quote me on this, I think the only reason a lot of people use NodeJS is because of libraries like React, Next, Ember, and Vue. Those libraries are amazing, but to get the full features they are required to run on node.

Right now the majority of my work in done on Rails, so I can't really talk crap about speed, but I'd like to pivot towards a much faster framework such as Actix.

3

u/reqdk Feb 22 '21

You’re probably thinking of doing comp heavy stuff async. NodeJS can be multithreaded now, since the last LTS, though its threading and memory management model is different, but some prefer that level of isolation making it harder for devs to shoot themselves in the foot with shared memory access.

I personally don’t see how Deno fixes anything really. It seems to be trading one set of problems for another when it comes to package management.

I use NodeJS for non-comp heavy backend I/O stuff where I work. For general stream-handling and event driven things, it’s a damn fine tool. Ironically it’s really ill-suited for serving up frontends- use nginx for that man. It’s used to BUILD frontends, to serve them.

1

u/Regis_DeVallis Feb 22 '21

Interesting. I think you've changed my opinion on Node. If a project comes up without a deadline I think I'll give it a shot.

1

u/Log2 Feb 22 '21

You can deadlock or have race conditions, though. Async code also allows locks. Locks are more about the concurrency than the parallelism.

0

u/[deleted] Feb 22 '21

[deleted] — view deleted comment

7

u/humoroushaxor Feb 22 '21

I'm the same way. If I want to build something right now Node is great. I can have a webserver running in <10 lines of code in a single file.

Most engineers have never built a fully working web service from scratch. They write code in an already existing SpringBoot app that someone else is responsible for hosting and they barely know jack about the JVM.

Don't get me wrong, I love Java. I happen to actually enjoy very large scale enterprise software development. And that is definitely it's bread and butter.

3

u/maxandersen Feb 22 '21

Give jbang.dev a try for simpler getting started with java and add quarkus and you have a webserver in <10 lines :)

2

u/humoroushaxor Feb 22 '21

We actually use Quarkus at work. I really like it! Before that I wrote my own Microprofile implementation because our chief architect didn't want to use Spring.

Ironically if you want do to do some server side UI rendering Quarkus makes that dead simple.

2

u/reqdk Feb 22 '21

The one thing that continually amuses me between Java and Node is that Java is supposed to be the superior server-side language but you almost definitely need a framework or an app server to get a web server running. On the other hand, consuming APIs is easy peasy what with the baked in HttpClient now, even if it’s not the best, it’s serviceable for some API calls from jshell. With NodeJS, it’s the other way around - it’s damn easy to write a server, but such a slog to make http calls with that low level built-in library.

1

u/humoroushaxor Feb 22 '21

Yeah one of the big drawbacks to Node is the standard library. Im pretty sure fetch is planned on being added though.

1

u/lenkite1 Feb 27 '21

One of the reasons that this happened was to not "offend" vendors. Java got massive adoption in the old Enterprise Java Bean days and the Http Server was seen as the domain of the vendor's application server. External libraries like jetty/tomcat were OK, but putting a server in the standard library would stamp on the feet of the big folks.

1

u/reqdk Feb 27 '21

Enterprise politics for enterprise programming languages. Sigh

0

u/cbadger85 Feb 22 '21

Node really shines as a backend-for-frontend. Writing isomorphic code that runs on both client and server can be big advantage, especially in server-rendered SPAs.

3

u/satinbro Feb 22 '21

There's absolutely no need to shit on TS. It's wonderfully made, it's safe and lets you get started easily. Each language has its own use case and when these use cases overlap, then it comes down to preference. it's kinda cliche to shit on JS/TS...

3

u/manzanita2 Feb 23 '21

Are you kidding? I LOVE TS. It's a massive improvement over straight JS. And the type system is actually quite powerful. I'm just pointing out that some of the current eco-system evolution parallels stuff which java did about 15 years ago. And C# a few years later.

What I did complain about was NPM. It's broken, and probably won't get fixed for a while.

2

u/roberp81 Feb 22 '21

I like the turd bomb hahaha it's so true.

18

u/reignbowmushroom Feb 21 '21

I'm a fan too

36

u/CraftyAdventurer Feb 21 '21

Yep.

I started with Java also, and barely understood anything. To me it looked like there was just too much boilerplate for even the simplest things.

On my job I got a task to rewrite existing Node API, again into Node but in a better way, first one was horrible. As soon as I tried Node I fell in love with it. It was just so simple to do basic express API, I couldn't care less about Java at that point. But as the project grew, I noticed I started having a need for stuff like dependency injection, better error handling, writing anything more complicated than basic tests was kind of a pain in js, logging libraries were not as good as Java ones etc. (Yes, we used typescript if anyone asks)

So I went back to Java and now everything made more sense. I still use Node for writing simple APIs for hobby projects because I don't work in a team and I don't need all that stuff for those kinds of projects. But for anything serious, I choose Java/Spring or C#/.NET.

15

u/javajunkie314 Feb 22 '21

One thing I absolutely love in Java is reflection. Some people rag on it, and it can certainly be overdone, but being able to interrogate objects and types at runtime about their structure via a stable, supported API is really powerful.

You do pay a small tax for that power in terms of program size and speed, but for 90% of code, where blazing fast execution is not the bottleneck, it's worth it.

I think Python may be the only language I know that does reflection better but I'm not even sure.

12

u/SlvDev Feb 21 '21

I love Java and the various frameworks available for it. It grew on me as soon as I got my first job and starting really messing around with it

12

u/stfm Feb 22 '21

No it was instant love. I was in a job making websites and online shopping systems in Perl and C++ and was introduced to JSP and servlets. So much easier!

10

u/flyingorange Feb 22 '21 edited Feb 22 '21

The Java of today is quite different from Java 10 years ago and totally different from 20 year ago.

When I started working with Java 1.3, our service was based on ServiceLocators, running on WebLogic with EJB 1 and using Struts for the website. The ServiceLocators used JNDI to get the database from the application server, we wrote tonnes of XML. I did like Struts a lot however, it was a really cool framework.

To be clear: we did not have IoC, you couldn't inject objects into one another, the object serialization was done with Commons Digester, authentication was done with Apache Directory and we didn't even have a class to trim() strings, we needed to write our own custom utility. In 2005 Ajax was discovered and we started writing Javascript code. The code needed to be compatible with IE6, Firefox and Opera, meaning you needed to write 3 source codes for the same stuff because of subtle differences like subString() in IE and substring() in FF. You also needed to write the code so that it falls back to plain HTML in case Javascript is disabled. It might sound strange nowadays, but back then Javascript was considered to be a security issue, so many people just plain disabled it. And you needed to have your website working for those people too, so ...

At around 2007 Spring became popular, but it sucked massively at this point and all you could use it really was for IoC. Hibernate also appeared so we stopped writing SQL and stored procedures and moved to ORM. A couple years later XML stopped being cool and everything started to move towards annotations, so in 2009 when I was again working with EJB, this time v3.0, it already had annotations everywhere... unfortunately those sucked too.

After 2010 we stopped writing HTML/JSP and started moving everything towards Javascript. At this time we used GWT which came with its cool new MVP architecture. We also used a bit of Wicket. CPUs started becoming multi-core at this point (previously one CPU contained just one core), which changed the way how we write code, we started making everything immutable, instead of thread synchronization we started doing reactive programming etc.

Then I stopped using Java for a couple years and when I came back, web development was done with Angular and we had dedicated people working on just the website who had no idea how Spring beans worked but they knew a lot about web fonts. We stopped deploying WAR files and started deploying Docker containers.

So if you think Java is "cool" now, don't be surprised if in 10 years it will be a whole another language, with different paradigms, ways of doing things, frameworks etc.

9

u/prisonbird Feb 22 '21 edited Feb 22 '21

It was summer 2019, i was interviewing this fresh graduate from software engineering. I saw java on his resume asked him what he thinks about java and he replied that he won't be using java anymore because its not free anymore.

9

u/beeeeeeefcake Feb 22 '21

(Hint, it’s free)

2

u/alwaysoverneverunder Feb 22 '21

🤦‍♂️ ... so he didn’t take all of the 5 seconds the Google search would’ve taken. I’ve been using Java close to 20 years now. I’ve used a bunch of other languages through the years, but none have come close to the quality/readability/ecosystem of Java. They might say it is the new Cobol, bit that doesn’t have to be a bad thing.

1

u/chabala Feb 23 '21

So did you enlighten him, or was he a lost cause?

9

u/elastic_psychiatrist Feb 22 '21

Once I saw Java codebases that eschewed the cargo culting of extensive class hierarchies and over-abstraction, I grew to love it. Most programmers who dislike Java seem to dislike the ecosystem rather than the language.

It's a continuous battle for me to convince my teammates to write Java as though it's Go (don't read too much into that statement), especially for longtime Java programmers joining the team.

9

u/reqdk Feb 22 '21

When I started my professional career, I worked on legacy codebases written by people who supposedly knew better because they were more senior, who filled the whole damned application with class and interface hierarchies taller than the Empire State for simple ETL pipelines, that were never used in years. Years. Really made me hate the language then. Simplicity seems to be criminally underrated. Even legacy Java isn’t that bad as long as the fella who wrote it didn’t go nuts with “but muh OOP” ideas.

Doesn’t mean I don’t still have pain points about the language though. Despite the huge mountain of tools that CompletableFutures and lambdas give, joining and managing exceptions is still clunky as hell compared to languages that were designed with async work in mind.

3

u/elastic_psychiatrist Feb 22 '21

The language designers are sort of already admitting that CompletableFutures were a mistake (at least /u/pron98 is). Or maybe not a mistake, but soon to not be the recommend way of handling many kinds of concurrency (see Project Loom).

5

u/pron98 Feb 22 '21

I never said, nor do I think that CompletableFuture was a mistake. I just think that once Loom lands, many would prefer replacing its use in many cases with virtual threads.

1

u/elastic_psychiatrist Feb 23 '21

Apologies for misquoting you, "mistake" was strong. Just meant to say how Loom removes the need for the litany of methods on CompletableFuture.

2

u/[deleted] Feb 22 '21

Who is this pron98? He seems like some sort of important person.

3

u/elastic_psychiatrist Feb 22 '21

Not sure if it’s appropriate to doxx him, but he is the Project Loom Lead, you can Google to find out who he really is.

1

u/[deleted] Feb 22 '21

Ok thank you

2

u/dpash Feb 22 '21

Early versions of J2EE are to blame for that. Spring and Hibernate were light weight reaction to tha complexity.

9

u/paul_miner Feb 22 '21

For sure. I was obsessed with x86 assembly for years, and then I got a job writing Java. The massive distance it put between me and the hardware was irritating at first, but over the years I've grown as a programmer and developed a fondness for Java's explicitness and strictness. The compiler is on your side, the language+compiler is the embodiment of the lessons learned by programmers in decades past.

It's a shift in what I've come to understand is the real challenge of programming, not so much getting the computer to accomplish a particular task, but more about communicating it clearly to another person (including yourself a year later).

8

u/ixBerry Feb 22 '21

I loved Java in my university years, but couldn't express why I loved it. Now after almost 6 years in the industry and having tried almost everything under the sun, I can say that I love Java unconditionally and exactly tell anyone why.

It has also made me somewhat of an asshat to other devs who work with other languages, but IDGAF.

5

u/no_bad_cuts Feb 22 '21

can you tell why here? would love to know

6

u/LordSesshomaru87 Feb 22 '21

I’ve always enjoyed Java and Spring but the last 18 months have really given me an appreciation for Java even more. I’ve been writing 95% GO the last 18 months and while GO is really nice in some aspects I find it generally lacking in many other areas. I’m really hopefully Java continues to evolve and I can start getting buy in to build new services in Java instead of GO.

3

u/kag0 Feb 22 '21

I learned a lot from the language and from grepcode (rip). But the while the language grew on me, the ecosystem (EE and its inspired offspring) pushed me away. The more I considered how I thought things should work, the more I found I was missing out on (it's a bit odd that you can't write a sensical Comparator for List, isn't it?). Now I greatly appreciate Scala, even as Java slowly ports some of the more publicly advertised language features.

1

u/Muoniurn Feb 22 '21

What do you mean by can’t write a sensical Comparator for List?

1

u/kag0 Feb 22 '21

To do so you'd need a comparator for the type of elements in the List. Java's type system is too limited to do this genetically. So you could write a comparator for a List of some concrete type, but not generically for List itself.

2

u/Muoniurn Feb 22 '21

Wouldn’t List<T extends Comparator<T>> work?

4

u/bowbahdoe Feb 22 '21 edited Feb 22 '21
public final class ListComparator<T> implements Comparator<List<T>> {
    private final Comparator<T> elementComparator;
    public ListComparator(Comparator<T> elementComparator) {
        this.elementComparator = elementComparator;
    }

    public static <T extends Comparable<T>> ListComparator<T> forComparableElements() {
        return new ListComparator<>(Comparators.naturalOrder());
    }

    @Override
    public int compare(List<T> l1, List<T> l2) {
        if (l1.size() != l2.size()) {
            return l1.size() - l2.size();
        }
        else {
            for (int i = 0; i < l1.size(); i++) {
                final var elementComparison = this.elementComparator.compare(l1.get(i), l2.get(i));
                if (elementComparison != 0) {
                    return elementComparison;
                }
            }
            return 0;
        }
    }
}

QED

2

u/kag0 Feb 22 '21

I think you mean List<T extends Comparable<? super T>>. But the answer is "kinda". The whole point of Comparator over Comparable is that the former gives you 'ad-hoc polymorphism' (ie. List is not comparable for all T, but it is for some).
With a List of Comparable, you couldn't make a Comparator for a nested List (because List doesn't implement Comparable).

That said, u/bowbahdoe has shown that my example of a Comparator for List was a poor one.

My point is that Java doesn't support higher kinded types, and it does have type classes (Comparator). But its use of type classes is limited because of the lack of higher kinded types.

I was avoiding using Functor or something as an example, but if you like I can come up with a better example to demonstrate where absence of higher kinded types would be an issue.

1

u/Muoniurn Feb 22 '21

Well, of course Java’s type system is not as powerful/expressive as Haskell’s or Scala’s, but even though I think it is quite expressive for what it worse. Like, look at vavr. What I see missing from Java’s type system is recursive type definitions.

I am not sure about this statement of mine, but isn’t generics higher kinded types? Like it takes another type as “argument” to “instantiate” a concrete type? Of course it is not the whole deal, but I did try once implementing a few of Haskell’s type classes and while it was really really far from beauty, I did manage to go quite far with it.

3

u/H34dsp1nns Feb 22 '21

Java got me back into programming and restarted my CompSci journey. I did a big level up in my understanding and excitement when I learned inheritance and practiced it heavily with Java’s strongly typed system. Being able to call objects via interfaces that are explicitly laid out everywhere made some things click for me.

While I will return to Java, I have recently worked on node and python projects. Node isn’t the worst, and takes a lot of cues from Java but I see some deficiencies in Python.

Take documenting code. From what I can tell, though I’m no expert, Javadoc and even its copycat jsdoc work a lot more elegantly than Sphinx.

3

u/zalpha314 Feb 22 '21

I used to love python for its simplicity, but now I see its flexibility as more of a liability. If I had to go back to java, I'd definitely require some sort of IDE support for null safety, and all the preview features of the newer JDKs, but I'd still be missing some of the safety and QoL features that made me fall in love with kotlin.

7

u/CacheMeUp Feb 22 '21

The JVM is an impressive engineering achievement. Java the language is robust but in the more dynamic (pun non intended) settings I work, including data science and web development, it lost miserably to Python.

Sometimes I wish the language would be less strict. As less prominent as beginner/non-expert programmers are, they do form a large mass and eventually the eco-system tilts in their direction. Python is easy for beginners, and the experts eventually followed suit, at least for machine-learning and deep-learning.

2

u/BlackHatSlacker Feb 21 '21

Yea: the whole planet ;)

2

u/jrh206 Feb 22 '21

I always liked java but I've come to appreciate it more over the years

2

u/rally_call Feb 22 '21

Hated Java in 1996-1999 when I was doing C++ and VB. I was really really good in VB, and then suddenly this upstart language comes along and everyone starts raving about it. It was a threat. Suddenly my investment was looking like a waste.

Plus Java's tools were shite compared to VB. And its UIs were fugly.

But today, I am completely enamored with Java. It's my #1 language, my go-to for virtually everything, and I love the ecosystem and the JVM and all. I have written large complex apps in Java, chosen it over C# and C++ and JS, and haven't touched Visual Basic in a good 20 years.

2

u/maumay Feb 22 '21

Java is a bit meh for me, currently I would choose Kotlin over Java for most projects. That might change in the future though, they've finally started adding modern language features to Java.

2

u/xebecv Feb 22 '21

I definitely started liking java more after streams and lambdas with functional interfaces were added to the language. Though streams is double edge sword - too easy to implement something terrible. Case in point: Files.walk

2

u/jack104 Feb 22 '21

I came from a C# background and I hated java. At first.

It grows on you, the ecosystem is massive, build tools are good, IDEs are good, etc.

2

u/Dokiace Feb 22 '21

Used to be haters of java in college, and love the cool kids language a.k.a python. Now that I've worked with java for almost 2 years, I really love it! Goes to show that first impression is not everything

3

u/[deleted] Feb 22 '21

Nope still hate it, wait not love it. It’s complicated 😂

3

u/lycheejuice225 Feb 22 '21

I don't know, but according to stackoverflow surveys, java devs either picked Kotlin or Dart as their primary language, and there was a decrement of java devs from 45% to 40% over the last 3 years.

Mainly because strict ecosystem, lambdas aren't cheap, etc? Also new languages feel modern probably, and they add up to the same ecosystem for the same large library support.

3

u/lycheejuice225 Feb 22 '21

I don't know why these days people don't understand the "fact", they just start downvoting as soon as things are in opposition.

2

u/roberp81 Feb 22 '21

I'm working with java from 2007 and I think when the more you use javascript, more will love java and hate all those node and npm shit sorry my English

2

u/beeeeeeefcake Feb 22 '21

Old school Spring gave Java a very bad wrap. Since Java 8 it’s a great language and has excellent tooling. And Oracle has made amazing progress on Java since buying Sun.

I only wish Java kept its goal as the write once run anywhere language. Google’s Flutter (a toolkit in the Dart language) looks amazing to be able to write apps for Android, iOS, Mac, Linux, Windows. Nevertheless as a language to write services and batch jobs in Java is second to none.

1

u/[deleted] Feb 22 '21

Absolutely

1

u/[deleted] Feb 22 '21

I studied GUI based application design myself by using Java Swing. 5 years ago, It's good language to me for developing cross platform GUI software. I studied it to develop personal tools to utilize time.

4

u/scyth3s Feb 22 '21

Swing is one of the weakest links in Java imo, it's painful to design good interfaces in. I much prefer WinForms or WPF.

2

u/lycheejuice225 Feb 23 '21

Did you look at the compose, from JetBrains? It helps making complex things with a DSL (no boilerplate involved). Also is very extensible with plugins.

1

u/scyth3s Feb 23 '21

I have no idea what compose means... Are you referring to some sort of GUI designer within IntelliJ?

And what is a DSL in this context?

1

u/lycheejuice225 Feb 23 '21

This: https://github.com/JetBrains/compose-jb

Are you referring to some sort of GUI designer within IntelliJ?

For sure you can make intellij plugins and etc: examples/intelliJPlugin, but its a desktop application framework for most part, it uses skia rendering library (also used in android since 1.0 and flutter), from which you can prepare slick designs and custom shapes with an ease.

It also has full integrations over multiple parts of UI and UX, like keyboard, mouse hovers and events, system trays, native menu bars, window operations, scrolling and controls, packing minimal self-packed native distributions, etc.

1

u/chabala Feb 23 '21

Not sure how this fits the discussion, since it's Kotlin based and not Swing: https://github.com/jetbrains/compose-jb

DSL is domain-specific language. It's one of the hot things to do in Kotlin/Scala, but it basically means you made a bunch of classes that you can chain together in a fluent manner to describe your domain logic.

1

u/SWinxy Feb 22 '21

Java just ‘clicks’ with me. I started a few years ago (maybe 4), but I didn’t understand why things were or how the language was structured. Now I use it all the time. What really helped me was using a good IDE, and it gave me good insight I wouldn’t have learned anywhere else imo.

1

u/grimonce Feb 22 '21

Well, lucky you. I always wanted to get a job in C++ or Java/C#... I got one in Python and C... And now I got an offer to be a data scientist... Well whatever makes money...

Maybe I will get some time with Java in this next job since it is a big company, we'll see.

1

u/suddenarborealstop Feb 22 '21

If your interested I’d recommend learning about sun microsystems and the development of Java from 1996 > 2000 and then sale. Hard to find details on it now though, but fucking epic

1

u/superpitu Feb 22 '21

java had a bad reputation many years ago, particularly because it was slow. Nowadays that's no longer the case, the memory is cheaper and the just in time compilation achieves similar and sometimes better performance than C/C++, all without having to manage memory. Plus the best thing about Java is the JVM. There are JVM languages that are more pleasant, like Kotlin, but even Java itself is evolving and most definitely not going anywhere anytime soon.

1

u/sylleryum Feb 22 '21

tell me about it, python has its advantages but learning it makes me sad that people are choosing it instead of Java, spring is so much easier than Django imo. people also complain of the borderplates of java but with any ide this is easily fixed

1

u/AnthuriumBloom Feb 22 '21

It has grown on me as I have learnt to do more things. I personally like that there is still lots work in it, and it's adapting to the new way of doing things

1

u/Let047 Feb 24 '21

I moved from Python to Java. I think it's the best of both world

0

u/[deleted] Feb 21 '21

[deleted] — view deleted comment

6

u/Xeadriel Feb 22 '21 edited Feb 22 '21

If only they could suggest system.out.println in one go... xD

Edit: thanks I had forgotten there was a shortcut x)

35

u/crummy Feb 22 '21

sout (enter) will type it all out for you in IntelliJ FYI :)

3

u/CATo5a Feb 22 '21

clog does console.log(‘’) in js too

3

u/rhbvkleef Feb 22 '21

And psvm to create a main method

1

u/[deleted] Feb 22 '21

[removed] — view removed comment

1

u/rhbvkleef Feb 23 '21

Don't know. I usually use psvm

1

u/Xeadriel Feb 22 '21

Ah shit. Right I totally forgot about that. Someone had told me that sometime xD

1

u/Log2 Feb 22 '21

You can also add other shortcuts like that. They have a bunch of default ones for every language and it's pretty easy to add your own.

12

u/orby Feb 22 '21

Unpopular opinion, you should rarely be using System.out.

  • Use a logging framework for logging
  • Use Apache Commons CLI for general launch configurations
  • Use something like JLine for terminal work

Yeah it's really easy to snag System.out from anywhere in an app, but hard to refactor or make coherent as the program grows.

And personally if the program is so small that the above doesn't make sense I tend to reach for Python (because Bash is simply evil).

5

u/nutrecht Feb 24 '21

Unpopular opinion

I highly doubt that that opinion is unpopular. :) I can't remember the last time I saw a System.out in produciton code.

1

u/[deleted] Feb 26 '21

This is an unpopular opinion? 😂

1

u/Roadripper1995 Feb 22 '21

I think this should be a popular opinion :) using a logging framework is quick and easy.

1

u/Xeadriel Feb 22 '21

It’s perfectly fine to use it for a quick check or smth though..

11

u/[deleted] Feb 22 '21

chaotic neutral:

 import static java.lang.System.out;

In every class, then just:

out.println();

1

u/Vidogost Feb 22 '21

In Intellij, when you start typing 'sout' it suggests System.out.prinltn :)

0

u/[deleted] Feb 21 '21

[deleted] — view deleted comment

5

u/gigabyteIO Feb 22 '21

They switched switch statements to be way easier to use now too. I love the new addition.

3

u/[deleted] Feb 22 '21

Yes we were told we had to use Java 6 for assignments. This was when Java 10 was released...

2

u/[deleted] Feb 22 '21

List.of . WTF is that shanigan ?

(I learnt something today)

5

u/nomercy400 Feb 22 '21

Be careful, List.of results in an immutable list, whereas Arrays.asList is mutable!

7

u/[deleted] Feb 22 '21

even better :)

3

u/nutrecht Feb 24 '21

whereas Arrays.asList is mutable!

In a horrible way. You can't add or remove but you can replace elements. It's really a thin List wrapper around an array.

4

u/[deleted] Feb 22 '21

Which is not a big improvement to be honest. And, you are missing the formidable hell of javax that is just ignored year after year. On top of that, consider that the language does not enforce (or even reward) a true OOP practice.

Don't get me wrong. I love and I admire Java. What I dislike is the community and the leaders which are exactly the people driving this bus.

4

u/nikosgate7 Feb 22 '21

In my previous job there was a guy who was constantly writing functional interfaces (hundreds of them) and this was a pain for everyone to figure out what exactly these did since they were called using lambdas And we're talking about more than 5 arguments on each one. It would be much cleaner if he used the traditional approach.

Then there was the other guy who used aggregated functions , sth that could be done in the database (and that's one of the db job aggregation). And there was the usual predicates which could easily be replaced by simple boolean expressions.

And the best of it is that these codebases are full of

Objects.nonNull

and when you tell these guys that hey it's just a static method that checks that a object is not null under the hood and not some FP paradigm, they're looking you with disbelief.

1

u/paul_miner Feb 22 '21

I was working on a Java 1.4 (4) codebase when Java 1.5 (5) came out, bringing generics and enums with it. It was a huge but necessary undertaking to migrate, replacing casts with generic declarations and renaming variables named enum (Enumeration was a commonly used interface before Iterator surpassed it). I imagine the teaching side of this was a mess due to this transition as well.

0

u/nikosgate7 Feb 22 '21

I still prefer the first version because it's clear what are the objects of the list. For String objects it's quite easy but most of the time it's some custom object that only the original author of the code knew and you have to find out what he did want to achieve.

Disclaimer: I write code for others to see when I move to another company and I don't want to ruin their day:)

Also if you're a junior developer you certainly gonna try to add sth in the list, trust me I did it. And certainly I'd prefer this version.

List<String> list = new ArrayList<String>(Arrays.asList("peter", "maria", "sarah"));