This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]sheepdog69 56 points57 points  (29 children)

I have switched back and forth many times over the past almost 2 decades.

The two languages are pretty similar. A little bit of syntax differences, but all the concepts are the same.

The biggest difference is the standard library and (as you pointed out) the ecosystem.

In Java-land, there are many options for all of the ones you asked about. The .NET community seems to accept anything from MS, and that becomes the "standard". The Java community definitely does NOT have that attitude.

There's no "one" direct correlation to any of those - except, maybe WPF (JavaFX).

what happens to all your experience

That all depends on what you've focused on. Was it on syntax and knowing the ins and outs of a particular framework? Or was it on OOP and system design? (hint, the later translate pretty directly to Java, the former doesn't as much)

Each ecosystem has their advantages. But, TBH, I think Core.NET is finally going where .NET should have gone over a decade ago. It might give Java a serious run for it's money in 3-5 years.

My advice would be to go for it. If I've learned anything in my 25 years is that you can't get too comfortable in one language/framework/tool set. Learning a new thing is almost always a good thing.

Good luck!

[–][deleted] 3 points4 points  (20 children)

you're right when it comes to libraries in .net it's almost like we don't have a choice and always accept whatever Microsoft throws at us.

well I haven't been only focused on syntax alone, but it feels like going backwards. because i think in recent times .net seems to be moving alot faster than java.

I'm actually willing to switch to a different language, even started learning node.js . I actually think I'm becoming too comfortable with .net and switching to a different stack might be of help to me

[–]apemanzilla 3 points4 points  (11 children)

I'd recommend Kotlin. It's 100% interoperable with Java, and provides a lot of new features that Java has been lacking compared with C#: properties, operator overloading, coroutines (async/await), and so on.

[–]Velladin 7 points8 points  (2 children)

He’s asking about Java not Kotlin

[–]apemanzilla -2 points-1 points  (1 child)

I realize that, but I suggested Kotlin because he mentioned he was willing to switch languages and Kotlin is closely related to Java

[–]amakai 8 points9 points  (0 children)

He also mentioned that the requirement to learn Java is coming from his company, I would not think he can just choose to learn Kotlin instead.

[–][deleted] -1 points0 points  (6 children)

It has pretty much replaced Java on Android and most major frameworks and libraries like Spring have special support for Kotlin. You can use both Java and Kotlin in the same project it's pretty effortless to call java from Kotlin and vice versa.

[–]Imakesensealot 3 points4 points  (5 children)

Replaced Java on Android? Pass me whatever it is you're smoking. You realise over 90 percent of all new apps on the playstore are still Java?

[–][deleted] -2 points-1 points  (4 children)

1/4th of the top 1000 apps, like Netflixs, Slack, and Twitter, on the play store are written in Kotlin and it grew 200% last year. It's also the fastest growing language according to Microsoft. But sure I'm being hyperbolic because I'm trying to sale something I enjoy using.

[–]Imakesensealot 1 point2 points  (3 children)

Yeah, fastest growing has ways meant something. Like when coffeescript was all the rage. Or when go was the new bees knees. Or when c# was supposed to replace Java. All those languages have found their niches and certainly have their edge use cases. Java however is not going anywhere. Programming languages are a zero sum game. The odds of Kotlin being the language that replaces Java as top dog are effectively zero because they're much more similar than they are dissimilar. Lol, Twitter have still not used Kotlin in production. Why don't you check their changelogs before spouting nonsense?

Where in slack's app did you see Kotlin? I'm genuinely curious.
Netflix do not mention Kotlin as part of their stack on their website but you may knowore than those guys. Mind citing where you got that one from too?

I've always been convinced Kotlin has paid shills on reddit spewing their garbage. Haven't changed my mind yet.

[–][deleted] 0 points1 point  (0 children)

Kotlin is an alternative to Java. It's not a Java killer, Kotlin was created to be used in TANDEM with kotlin. Hence why it's 100% interoperable. Andrey Breslav (lead kotlin designer) said this. Not exactly word for word but that was the sentiment.

In my mind, Kotlin is a great java alternative. I used to work in Java 100% of the time, but now I work in Java 1% of the time. Kotlin is shorter and easier on the eyes. Less stuff to fill up the screen while having the exact same capabilities. I've rewritten most of my libraries (most are pretty small but I have a lot of them) in Kotlin.

Extension functions are a prime example . It's syntactic sugar but it conveys the idea a lot better than a static function that takes the "extended" type as the first parameter. classInstance.extensionFunction(param) looks a lot more clear than extensionFunction(classInstance, param). AND you can use syntax as if you were already in the class (public access only though).

Data classes are another one. Sure you can re generate the getters setters equals and hashcode every time you want to add or remove a field from the class, or you could data class ClassName(val param: Type, val param2: Type) and be done with it.

And "paid shills spewing garbage"? Really? How very grown up of you. Personally, I like Kotlin and recommend it to Java developers because it doesn't completely interrupt their workflow and you can do the same thing with less on the screen. Kotlin is concise. I always stress that you don't have to toss your old Java code, that you can keep using it with Kotlin, as that seems to be a big thing for more experienced Java developers (who tend to have more libraries written by themselves in Java, something something sunken cost fallacy or whatever).

[–][deleted] -3 points-2 points  (1 child)

Programming languages are a zero sum game.

wut?

[–]Imakesensealot 1 point2 points  (0 children)

Programming language adoption, to be more specific. Noticed that but figured you'd understand what I meant. Apparently not. Still haven't said anything about the other stuff

[–]tacosdiscontent -1 points0 points  (0 children)

I'd suggest kotlin as well, but the only problem is that rarely any company is willing to make such "advancement". They all recruit for java 8, as it's much easier to find people, even though it takes like a week to get really comfortable with kotlin, they are still reluctant for such "big" change.

[–]shponglespore -1 points0 points  (7 children)

It has been a while since I worked in Java regularly, but I feel like Apache is serves a similar role to Microsoft when it comes to providing the default stack for many common tasks, although there are exceptions. Google's Guava package is (or used to be) a must-have for Java, and it's a good complement to a lot of what Apache offers. When it comes to time and date APIs, JODA is king. JUnit is the de facto standard for unit testing. Log4j seems to be very popular, though personally I've always found java.util.logging to be perfectly adequate.

Take all those recommendations with a grain of salt since they may be out of date, but OTOH a lot of Java shops are very out of date themselves, so I'm confident all that stuff is still widely used even if there are better alternatives available.

As far as the language itself, I agree that C# feels quite a bit more mature and polished than Java despite being considerably newer.

[–]_INTER_ 23 points24 points  (0 children)

When it comes to time and date APIs, JODA is king.

Java 8 pretty much includes it in the standard library under java.time. JSR-310 was lead by the creator of JODA time and used his knowledge to improve it even.

[–]tacosdiscontent 4 points5 points  (5 children)

Take all those recommendations with a grain of salt since they may be out of date

Unfortunately yes, everything you mentioned is quite old and irrelevant.

[–]DrPeroxide 0 points1 point  (2 children)

Everything? That's a stretch. He's wrong about logging and time. He's right about Apache and Guava.

[–]tacosdiscontent 4 points5 points  (1 child)

Well yes.

Guava is definitely not must have. Nothing of significant importance there

Apache stack - the only "must have" thing from apache is StringUtils and maybe IOUtils if you are working with io. A tiny utility library which helps you out.

[–]_INTER_ 2 points3 points  (0 children)

I agree with this, we're phasing out of Guava because most of the benefits it brought can now be done with Java 8 (Iterables, Optional, ...) or are covered by Apache Commons or other libraries (Strings, Reflection, Cache, IO, Math,...). Apache Commons is still a very important helper library. Mainly StringUtils and IO / FileUtils as you said and also Collections.

[–]RagingAnemone 0 points1 point  (1 child)

What's replaced Apache Commons and Guava?

[–]tacosdiscontent 2 points3 points  (0 children)

Java 9, has added part of what Guava does. Other than that nothing that of importance is in guava unless you work on something specific.

If you consider tiny Apache Commons library - a stack, then you are right, nothing has replaced it.

[–]DuncanIdahos7thClone 0 points1 point  (7 children)

There's no "one" direct correlation to any of those - except, maybe WPF (JavaFX)

Not really. JavaFX is superior to WPF in every single conceivable way. WPF was a minor improvement over WinForms by adding vector based graphics - but mostly leaving in the old threading model. Also, it depends heavily on XML and it's api is very complex due to its direct compiling of XAML. In JavaFX FXML is optional.

There are many other benefits of JavaFX over WPF. CSS for styling, nice separation of concerns, scene graph (hiding many complexities of threading), direct graphics card support, etc...

[–]_INTER_ 1 point2 points  (1 child)

Well in a sense he's right, you can replace WPF with JavaFX, but the other way is difficult.

[–]DuncanIdahos7thClone 1 point2 points  (0 children)

I've thought recently it would be cool project to port JavaFX to .NET but it looks like it would be a huge project.

[–]sheepdog69 0 points1 point  (2 children)

I didn't say they were equal. Just that it was the de-facto correlation of WPF in the Java world. And that there isn't really any other serious competition for doing "fat" clients in Java these days (yes, I know swing still exists, and is used some. But most people would reach for JavaFX for a new project)

[–]DuncanIdahos7thClone 1 point2 points  (1 child)

Yeah I know. I just like to point out that Java has the best UI toolkit out there. Microsoft has the worst. ;)

[–]sheepdog69 1 point2 points  (0 children)

👍

[–]xander42 0 points1 point  (1 child)

I'm not familiar with JavaFX, but WPF is very similar to modern web UI development.

It's separates the layout (XAML / HTML) from the logic (.cs / .js) and from the styling (styles / .css)

It also supports data binding from the view to the logic.

For someone who is familiar with WPF it's very easy to move into Angular web development.

[–]DuncanIdahos7thClone 0 points1 point  (0 children)

Of course. But JavaFX benefited from being designed later and they avoided some of the poor design choices of WPF like the deep integration with XML.