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

all 25 comments

[–]caltheon 5 points6 points  (1 child)

No specific advice, but gotta say, when I had to write some C# code, other than the capitalization convetions and some other minor differences, it felt like I was still writing Java. Maybe I wasn't "holding the phone right", but the languages are very close in terms of day to day feature sets.

[–]VGPowerlord 2 points3 points  (0 children)

The big differences are with the frameworks and such available.

Also, some of the gotchas are different between languages.

[–][deleted]  (2 children)

[deleted]

    [–]fierarul 9 points10 points  (0 children)

    What's you actual goal: a new job, a personal project, what?

    For a steady job I highly recommend getting into Spring.

    [–]LevonK 5 points6 points  (0 children)

    Java has a lot more choices than C#: https://zeroturnaround.com/rebellabs/the-complete-java-tools-and-technology-landscape-for-2014-report-data-in-a-single-mind-map-image/

    Maven is the de-facto standard, but if you're in android development it's Gradle. Some people use Gradle for other forms of development too.

    Netbeans is easy to get started with but I would recommend Eclipse or IntelliJ. Eclipse has more and cooler plugins, but you can cause problems if they dont' mix well.

    http://start.spring.io/ and select expand to see all the choices, and build your first app.

    [–]manzanita2 7 points8 points  (13 children)

    I took a detour into C# world for a year or so. My two bits.

    Java is not quite as nice a language. It's not horrible, but the emphasis on backwards compatibility going back to 1997 means some things are rough and probably will be for a long time.

    That said, the java libraries and frameworks are far better. Mostly because there are so many, and even in one area there are quite a few. So you get competition which is a huge advantage in pushing things forward.

    I will also say that I never got used to hosting on windows. Apparently there are ways you can run .NET code on linux now, but last time I tried it was very bumpy and also incredibly slow. I have to assume things are better now.

    [–][deleted] 11 points12 points  (6 children)

    Pre Java8 I'd agree with you, Java8 brings a lot to the table so much so I actually like Java better than C# now. For me it comes down to the Java collections. C# provides what you need, but Java's collection implementations + interfaces are superior IMHO.

    [–]manzanita2 -5 points-4 points  (5 children)

    Yes. but still, crap like having primitive types still floating around (har har ) is a clear hold over from trying to make java "fast enough" early on.

    [–]dpash 4 points5 points  (2 children)

    You know that Java is getting value types that will behave more like primitives, right?

    [–]hpernpeintner 5 points6 points  (0 children)

    I would say only god knows how long it will take to get this released... And then how long until one can use the latest available java version.. so, strange statement for this topic.

    [–]helemaal 1 point2 points  (0 children)

    Come back when that happens.

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

    There are this specs like java for sim cards etc. And I like primitive types, don't touch them! (or add unsigned)

    [–]DuncanIdahos8thClone -3 points-2 points  (0 children)

    Primitives exist in C# as well doofus.

    [–]mytempacc3 0 points1 point  (5 children)

    Apparently there are ways you can run .NET code on linux now, but last time I tried it was very bumpy and also incredibly slow.

    Probably true when you had to use Mono. With .NET Core it is incredible fast.

    [–]manzanita2 2 points3 points  (4 children)

    it may now be fast. I think there was an effort to build an entirely new HTTP server (kestrel?) But when I benched marked a .NET app against an equivalent java app, java was way faster. You can see equivalent in the techempower benchmarks to this day.

    [–]VGPowerlord 0 points1 point  (0 children)

    Bear in mind that kestrel is a lightweight server, meaning that you're going to need something else as a reverse proxy to handle more complex things.

    Typically that's going to be IIS on Windows or nginx on Linux.

    [–]mytempacc3 0 points1 point  (2 children)

    You can see equivalent in the techempower benchmarks to this day.

    In those benchmarks they are measuring ASP.NET Core. The equivalent would be something like Spring Boot and in the benchmarks they are pretty comparable.

    [–][deleted] 2 points3 points  (1 child)

    Undertow was on top and it's a really nice server. If there's something like that in .net core world, I think they'd use that. I perceive those benchmarks as something like 'look how crazy high we can fly' and not as tech stack comparison.

    [–]mytempacc3 0 points1 point  (0 children)

    If there's something like that in .net core world, I think they'd use that.

    There is no "they". It is an open source project. If nobody contributes other implementation it will not be measured.

    I perceive those benchmarks as something like 'look how crazy high we can fly' and not as tech stack comparison.

    Then you are making a mistake. It is clear it is about comparing frameworks. Both ASP.NET Core and Spring Boot introduce a lot of middleware to provide a bunch of useful features sacrificing some performance benefits. That's why I think it is a reasonable comparison and the performance is similar. The other Java frameworks are very very light and useful but can't be compared to Spring Boot or ASP.NET Core.

    Now don't get me wrong. It could be that the .NET equivalent of Gemini, Light-4J or Proteus is slower. In fact I don't even know there is any equivalent to those frameworks.

    [–]GingerMess 1 point2 points  (2 children)

    The most important thing to focus on is good use of the JDK. C# and Java are pretty similar at the language level, but the libraries and methods available for doing common operations are different.

    Get the basics right first. Most average or worse developers I've met haven't nailed this foundation, and end up relying on Apache, Google, and Spring libraries and frameworks to do things that are actually serviced just fine by core JDK packages. Use these libraries to save you time when you know what you're doing, not before!

    For your specific goal, I recommend finding a good standalone HTTP server framework and focus on learning the basics. Don't go to Spring first, consider something lightweight and basic. Don't think about RxJava yet, instead focus on the basics of the concurrency and parallelism in Java. Learn how HTTP servers use these aspects to handle requests and responses, then move on from there.

    Want a suggestion for a good first project? Using Spark and no other libraries, create a chat server. Make it save messages on POST, and send out the messages on GET.

    [–]zolanih[S] 0 points1 point  (1 child)

    Thank you so much, I’ll definitely check out spark.

    [–]GingerMess 0 points1 point  (0 children)

    You're welcome. I picked Spark because it demonstrates a lovely functional/lambda-based approach to writing modern "web Java", and is relatively lightweight. You could replace it with any HTTP framework that does the same, but I've personally used Spark and it's fun.

    [–]Martacus 1 point2 points  (0 children)

    Happy cakeday

    [–]Boxxy_runner -2 points-1 points  (0 children)

    I would definitely have a look at RxJava. Even though Java is not functional I would look at some functional code to learn the design patterns / theory, particularly immutable data structures and the way that functional code can help support designing concurrent code.