Your Thoughts on Java and C#

Its been 10 weeks with studying both c# and java and im starting to realize there of course both high level programming languages but which one can you see acheive a better performance... algorithm wise? In my opinion c# code is longer than java code... java allows you to make short circuit circulations in your code with logic operators but how about c# ? Do they even have the same compiler time?

Not exactly sure if this is what you're asking, but from my understanding Java(everywhere but Android) is considered pretty obsolete and low performance. Also it's a major PITA to deal with on the client side because seemingly every Java update breaks your application. The company I work for has some Java stuff and we are trying hard to get away from it. C# is great if you plan to stay in a Windows world, I learned a decent amount of it in school and am using it on the job now in conjunction with PHP on my current project. I did some Java in school too but thankfully it was just one class and I didn't waste a lot of time on it. I don't really remember enough about the code for it to talk much about it, not to mention it was only the second programming class I took and the first Object Oriented one.

IMO web programming is where "it" is at these days, whether it's ASP.Net, PHP, or something else server side. Then there's client side with HTML5, JavaScript, and CSS. I've been learning most of this stuff on the fly on the job as the school I went to didn't offer much of it.

Happy coding!

1 Like

yeah... web devs get more attention i guess. i hate server based shit :(

There was a magazine advert years ago, From Microsoft on dot net and such. The advert was of two photos, both depicting the same two guys in two separate development universes; Java vs dot net.

"Spend more time doing things that are important to you" or some crap was the slogan.
The dot net guys had swapped things like stress-balls and coffee for tennis balls and apples.

1) I can throw stress-balls at anyone with little to no consequence; devs, admins, DBA's, network pricks, the receptionist etc. And it's hilarious because we got the stress-balls from a sensitivity training program. And I can do this because I have probably finished already for the day. Unless there are updates to install.
2) Have coffee AND apples, for that double-diatretic-whammy. Plus, coffee. Coffee++.

Nah that's actually a common misconception but it's really not true.
Java in most cases won't reach the performance of optimized C or C++ code but if you put the more popular languages into categories according to their performance Java clearly would be in the second highest class, behind C,C++, etc

I think the myth that Java is slow comes from a second misconception.
Some people put Java strictly in the category of interpreted languages which in fact are usually slow, but it's a bit more complicated than this, java source code is compiled into java bytecode, which then can be interpreted by the jvm or compiled to native code.
When the JVM runs the bytecode it usually figures out which parts of the code have to run extremly frequently, this parts are compiled to native code and directly executed by the CPU, so some Java code actually got compiled twice and runs natively.

At the end of the day it's not completely wrong that Java to some extend also is an interpreted language but it's way faster than languages which usually fall in this category.

Also I really wouldn't call Java obsolete it's still the most requested language in industry and a lot of times will secure you the highest income/skill ratio compared to other languages.

A lot of the Java 'hate' is mainly based on two factors imho:
-It maybe didn't really live up to the initial hype
-People actually use it ('There are only two kinds of programming languages - those people always bitch about and those nobody uses')

Apart from that personally I still feel C# as a language is more appealing than Java and kind of represents what Java was supposed to be though

2 Likes

C# as a language is way more advanced, you can write clean and smart code more easily than with Java. Java makes some things unnecessarily hard, Reflection is a better on C# meaning there are some awesome serialization libraries, that are orders of magnitude better than ones found for Java.

You do have ton of options in Java, due to obvious reasons, some people of course can't decide what options are good to use, so they don't perfect anything and then nothing works and then they want to move away from it, that's what happens often. I love that it runs on Linux, that is a major reason why I love it more than C#, even though I like The C# language better. Yeah, I know - Mono, but it's way rougher around the edges than Java in comparable situations.

Performance wise, it's all of the same, both Java And C# are JIT languages, C# has a bit more advanced. and better GC process, but you can tweak almost everything GC related in a JVM, so you can achieve some pretty damn good latencies on high-load systems with both of these techs. Java is without a doubt a hard-hitter when it comes to server stuff.

At my workplace I get to work with both for high-load systems and really, you just have to pick the right tool. If you need those great features of C# that are missing in Java and you know you're going to get away a lot more easily, then pick C#. Easy.

The fact is when you go down to the lowest common denominator, It is best to know as many languages as you can. You may be working freelance for one company in java then another in c++ then another wants you to do some lua scripting. Learn all you can because once you learn one, the second gets easier then the third one. Before you know it you can pick up any language in just a few hours.

I started in Visual basic then to c++ then c# then c and now im using java and c++ again.

I would personally recommend learning structures in c and then move onto object orientated in c++ or java.

Yes c++ is more efficient than java but not java wont die. The fact is in most cases, you dont need that efficiency. Its only in real crucial programs or games where every saved tick is worth saving that you need c++ but if your making some database or a light game or something, java is more than capable.

Correct. I'll add to this by saying that most companies that require some custom software want stability over a couple of ticks of performance. JIT compiled languages offer far greater stability than say C++, where you can get unrecoverable segfaults, etc. Also writing such code is easier and faster, therefore you can fill business requirements faster.

Many companies like Java because you write it once and apply any place that the JVM runs.

1 Like

LAZY MUCH... HAHAHA thanks for the responses people

The performance of Java issue is probably based on people seeing really old versions of Java. My employer (a large team of colleagues) wrote a matching engine for a major trading company in Java which is in use currently covering £$billions a day. So it can be made to work if you want it to.

Don't get hung up on this is better than the that, even it it's clearly the case. Learn many languages sure but make sure you know some of them in depth and use the best tool for the job. Outside of academia it's usually about solving a problem that a business wants solving - not which language to use. It will either be dictated to you or they will care more about the initial/ongoing costs rather than what it's written in. (obviously if it's something obscure it's not going to be easy to maintain in the future)

1 Like

I have worked at a company that used primarily Java, and am now working in a company that primarily uses c#. I enjoy the java language as a whole more, but did not enjoy java web development( we used server faces ) I find myself writing quick scripts in java in my free time.

As for C#, I enjoy backend development quite a bit more at work. As far as IDE's go, I prefer Visual Studio over most others.

As far as speed goes, there is not a meaningful difference between the two. The main limiting factor of choosing asp/c# is being mostly bound to a windows environment.

A lot of the complaints I've heard about, such as the lack of function values and whatnot in Java were addressed in the 1.8 update. I'd recommend you guys looking at this post for more info.

I think some of the issues lies with the web frameworks in the ecosystem. One less popular alternative which is more modern would be Play! Framework. I've used it a few times and I must say its quite nice. It has automatic incremental compilation for fast iterative development, among other things.

I not sure why I keep hearing that Java is slow, the Hotspot JVM is one of the fastest out there. Its the main reason for the existance of JRuby afaik, and is also why there are so many other languages such as Groovy, Scala, Clojure, and Kotlin primarly target this environment. Its an open sourced VM with non-trivial features such as parallel garbage collection.

As a low level Dev, just see Java as a mess of a language, nothing wrong with it just makes ugly code. Personally C# all the way here, as least if you've learnt the language and don't like it, least it's at least similar to C/C++, so you can migrate to a lower level language if you need.

Hello!
Iam super experienced programmer, iam doing my second course atm...
But dosent java have the "same" overhead?
I mean: "In my opinion c# code is longer than java code..."
The compiler will just add the code for ya, any ways?
I found a really good channel(the best perhaps?! :S) on youtube, thrue that ive understand that there are alot of ways to reduce your c# code with the newer version...
But maybe this isnt what you are asking about?

Best regards Tomas!

Here is the link/channel:

Check it out ppl

facepalm...

OFC i meant to say, that iam a super unexperient programmer. haha

1 Like