• Post Reply Bookmark Topic Watch Topic
  • New Topic

Is Java a Primitive form of C#? I'm trying to love Java.  RSS feed

 
Jacob Pressures
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, It is not my intentions to insult anyone or Java. I have a new job offer and they are sending me to 2 months training on Java. I'm familiar with C#. I'm not a well experienced programmer. I still consider myself entry level but I'm familiar with the N-tier architecture, design patterns, web services, etc. I've just not done a lot of coding.

Over the last few days, I've been watching some videos on Lynda.com to learn and get a primer on Java. I feel that Java is like C# but very primitive. If I'm trying to build a house, i feel i have to dig a hole, collect some dirt, make cement and make my own bricks. When I get finished, i have a nice house, but... i can still see and feel. the grit in the walls and when i'm sitting on floor. Have i left a nice home and gone back to Africa?

It seems like a long way around to do basic stuff. Creating java beans to do CRUD operations in a database? Really? StringBuilder was a bit off putting that pales in relation to some stuff.

Is there a bright spot? I'm moving on to web services tomorrow to try to get a good grasp of that. But... just when i start getting interested in something, i feel i'm thrown a curve ball.

I want to see the beauty in Java. I'm wondering if i will come to love the language from writing more programs in it or what. I would hate for my company to spend 2 months training me in Java and I end up hating the language.

Why is Java so popular? Why hasn't it been replaced? Is it all politics against Microsoft? Or price issues? Can a person love Java coming from C#?

Thanks guys. Please give me some advice.
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As you are quite new to Java, you have probably seen only a very small part of the Java ecosystem and you've probably seen only a few simple ways to do things, and you're basing your conclusions on just your first impressions.

And maybe you are used to doing things in a certain way in C# and the Java way of doing the same things feels weird to you, making you think that somehow the Java way of doing things is strange or inferior to what you already know.

With regard to language features, Java and C# are not that different. C# has some features that Java lacks, and Java has some features that C# lacks.

Java has a huge ecosystem of open source libraries. You can't possibly have seen them all in 2 months of Java training.

Jacob Pressures wrote:Why is Java so popular? Why hasn't it been replaced? Is it all politics against Microsoft? Or price issues? Can a person love Java coming from C#?

It's popular probably because of historical reasons, because in the mid-1990's a lot of people were programming in C++ which was very hard, and Java was easier and had automatic memory management and made programmers more productive. It's currently the most popular programming language in the world, and the billions of lines of code that have been written in Java in companies all over the world cannot so easily be replaced by something else.

Ofcourse it is not all "politics against Microsoft". And neither is it price issues, you don't have to pay anyone to learn either C# or Java, you can get free development environments for both and you don't need to pay anyone a license for using it for production software.

Do you have some more specific examples of what you can do in C# in a much more sophisticated way than in Java?
 
Henry Wong
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jacob Pressures wrote:
Why is Java so popular? Why hasn't it been replaced? Is it all politics against Microsoft? Or price issues? Can a person love Java coming from C#?


Well, if you want a data point... I code in both Java and C#, although admittedly, these days, I am more using C (with a little C++) more than either Java or C#. Personally, if I had to choose, I like C# more than Java, and the reason would be that I like Visual Studios more than Eclipse.

Henry
 
Winston Gutkowski
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jacob Pressures wrote:Hi, It is not my intentions to insult anyone or Java. I have a new job offer and they are sending me to 2 months training on Java. I'm familiar with C#. I'm not a well experienced programmer. I still consider myself entry level but I'm familiar with the N-tier architecture, design patterns, web services, etc. I've just not done a lot of coding.

Well, first off: Java is about 6-10 years older than C#, which really only became a major "product" after MS got sued for trying to "Microsoftize" Java; so there's probably several things that the development team were able to learn from perceived "mistakes" in Java.

Not being a C# expert, I can't really comment, but from what I've seen, I really like the "properties"; and also the fact that literals behave like objects.

However, I really dislike the implementation of 'final'. It seems way more complex than in Java, with "sealing" layered on top of it all, rather than just having it mean "you CAN'T override (or change, or extend) this ... EVER".

I read an interesting article somewhere where a high-up as much as admitted that the reason for it was to deal with "legacy" software (if I can find it again, I'll post the link) - and it may be worth remembering that .NET itself was (or started out life as) an improvement to the God-awful COM framework.

I'd also say that Java has C# beat when it comes to WORA. Maybe not theoretically, but pretty much all Windows boxes run a JVM; I'm not aware of too many Unix/Linux systems that run .NET though.

Now that may have something to do with "anti-MS" bias (I'm certainly guilty of it myself ) but, given their previous track record, I think that some clients may worry that by choosing .NET exclusively, they might "paint themselves into an MS corner".

My 2¢.

Winston
 
Matthew Brown
Bartender
Posts: 4568
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Winston Gutkowski wrote:However, I really dislike the implementation of 'final'. It seems way more complex than in Java, with "sealing" layered on top of it all, rather than just having it mean "you CAN'T override (or change, or extend) this ... EVER".


In practice you use the word sealed instead of final for classes and methods to prevent overriding/inheritance, and readonly instead of final for member variables to prevent them being changed, and they behave exactly the same. What's the objection, exactly?
 
Matthew Brown
Bartender
Posts: 4568
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For me, the biggest difference is that C# moves faster than Java, for various reasons. Before C# 3 there really wasn't a lot of difference. But since then it's brought in a number of features that Java either hasn't, or picked up later (try-with-resources in Java 7, and lambda expressions in Java 8 being a couple of examples).

The impression I get is that in the .NET world the language development has been mainly in C# (with a bit of F#), whereas in the JVM world a lot of the innovation has been in alternative languages (Scala, Groovy, Clojure etc.).
 
Winston Gutkowski
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Matthew Brown wrote:In practice you use the word sealed instead of final for classes and methods to prevent overriding/inheritance, and readonly instead of final for member variables to prevent them being changed, and they behave exactly the same. What's the objection, exactly?

Possibly only the fact that it's "what I know", and that in Java it's absolute - ie, it's a simple keyword that can "harden" your design on a namespace basis.

If you can, for example, explain to me how you would code a final method in C# - ie, one that cannot be overridden without producing a compiler error (as opposed to a warning) - I may have to eat my words; but it didn't appear to be that easy when I was investigating C#.

Personally, I don't think final is taught enough in Java. It's an incredible keyword that eliminates a lot of preventable mistakes.

Winston
 
Henry Wong
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Winston Gutkowski wrote:
I'd also say that Java has C# beat when it comes to WORA. Maybe not theoretically, but pretty much all Windows boxes run a JVM; I'm not aware of too many Unix/Linux systems that run .NET though.


Two points.

1. All .NET shops that I worked with are Windows shops. They may have Linux machines, but they are the minority, and they are never configured to run .NET.

2. The issue with Mono is support. No commercial company (that wants to stay in business) will go into production without Support. And with Mono, there is no way to get support, especially when Microsoft changes something in .NET.

Henry
 
Winston Gutkowski
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Henry Wong wrote:The issue with Mono is support. No commercial company (that wants to stay in business) will go into production without Support...

And isn't it interesting that when you pick an MS product you need it, whereas when you "go open-source" there's a pile of free support out there in Web-land?

Those same companies that want a support contract for More - didn't know that's what it was called, but thanks for that - are quite happy to download a JVM; or have Linux servers running their networks, or webcaches, or firewalls, when (as far as I know) there's nothing that actually guarantees they'll even run.

Winston
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Henry Wong wrote:..., if I had to choose, I like C# more than Java, and the reason would be that I like Visual Studios more than Eclipse.

I've been a long time Eclipse user, but now I'm using a much better IDE...

Matthew Brown wrote:For me, the biggest difference is that C# moves faster than Java, for various reasons. Before C# 3 there really wasn't a lot of difference. But since then it's brought in a number of features that Java either hasn't, or picked up later (try-with-resources in Java 7, and lambda expressions in Java 8 being a couple of examples).

The impression I get is that in the .NET world the language development has been mainly in C# (with a bit of F#), whereas in the JVM world a lot of the innovation has been in alternative languages (Scala, Groovy, Clojure etc.).

Yes, in the Java world, innovation happens first in the alternative JVM languages, and the Java language itself is regarded as the stable, "proven technology" language. Oracle is very careful with adding new features to the language and takes a lot of time to think and implement new features - mainly because they want Java to stay backwards compatible, and any language change can have consequences for backward compatibility. So they want to be really really sure that they don't add anything that they will later regret or that will cause unforeseen incompatibilities.

Ofcourse backward compatibility is good on one hand, and it's one of the reasons why it is so popular, but on the other hand it means that we are stuck forever with for example raw types, legacy classes such as java.util.Vector and badly designed APIs in the standard library.
 
Winston Gutkowski
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jesper de Jong wrote:but on the other hand it means that we are stuck forever with for example raw types, legacy classes such as java.util.Vector...

Not to mention Stack.

...and badly designed APIs in the standard library.

Agreed, but do these more "dynamic" languages not suffer from the same problems? It seems to me that it might be even worse, unless they've got some way of simply eliminating them from their "foundation base".

Winston
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Winston Gutkowski wrote:Not to mention Stack.

And other legacy classes that nobody should be using such as Hashtable, Enumeration, StringBuffer, and badly designed classes such as java.util.Date, java.util.Calendar, java.sql.Date, everything in org.w3c.dom, unnecessary and out-of-date stuff like the CORBA support, the Serializable mechanism, ...

Winston Gutkowski wrote:Agreed, but do these more "dynamic" languages not suffer from the same problems? It seems to me that it might be even worse, unless they've got some way of simply eliminating them from their "foundation base".

Let's look at Scala, for example: nowadays they are a bit more careful with backward compatibility, but the Scala language developers haven't hesitated in the past to completely remove or redesign classes in the Scala standard library. People who wanted to upgrade simply had to rewrite part of their code.
 
Winston Gutkowski
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jesper de Jong wrote:Let's look at Scala, for example: nowadays they are a bit more careful with backward compatibility, but the Scala language developers haven't hesitated in the past to completely remove or redesign classes in the Scala standard library. People who wanted to upgrade simply had to rewrite part of their code.

Wow; fair enough. Obviously a different paradigm. Not sure I'd want to be a jobbing programmer under a regime like that, but it certainly solves a lot of problems.

Winston
 
Henry Wong
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Delayed response. Sorry. Doing some travelling so not keeping tabs on the topics.

Winston Gutkowski wrote:
And isn't it interesting that when you pick an MS product you need it, whereas when you "go open-source" there's a pile of free support out there in Web-land?

Those same companies that want a support contract for More - didn't know that's what it was called, but thanks for that - are quite happy to download a JVM; or have Linux servers running their networks, or webcaches, or firewalls, when (as far as I know) there's nothing that actually guarantees they'll even run.


In my opinion, in most cases, I don't think that there are any form of free support that is suitable for production. If the production system has value, then it will need some sort of SLA with support, and no free support does that. With open source it is possible to achieve an SLA (with a cost, of course). The support staff has full access to the source code, has knowledge of the direction of the open source product, can patch and submit changes to the open source product, etc. As such, there are vendors that will support various open-source products.

Even then, the open source product needs to have traction, ie. a large enough community using it and hence, supporting it. And of course, the paid support staff should know the level of traction of the individual components, so that they can train, and help guide the usage of the product to avoid using lesser user features.


With Mono, the support is indirect. It is direct support of an emulation product. Because of that, there is a lot of difficulty, and lot of concern of the viability that it can be supported. It certainly doesn't have the traction (yet) to have a large enough community that can support it (with an SLA). Or at least, I haven't ran into any vendors in this business (supporting .NET shops using Mono).

Henry
 
Winston Gutkowski
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Henry Wong wrote:In my opinion, in most cases, I don't think that there are any form of free support that is suitable for production. If the production system has value, then it will need some sort of SLA with support, and no free support does that.

Hmmm. Not sure about that. From what I understand, Debian is petty much entirely community-support based, and yet it's the Linux of choice for many high-end servers running critical stuff. And I suspect that one of the reasons is that it's perceived as an "admin's" Linux, with lots of tools for kernel recompiling and the like - and also that it's very robust.

And at the other end you have distros like Ubuntu - and, more specifically, Mint - that, IMO, will soon be competing with Windows for the "desktop" market, simply because they're so much better. I've been running Mint on three of my machines for about 5 years now; and I can still count the number of times I've been into the shell on the fingers of both hands. And I've never had a crash of any kind.

I certainly can't say that about any version of Windows I've ever owned - even the more "stable" ones like 98 and XP.
I also don't have to worry about "new paradigms" like the ongoing disaster that is Windows 8.

SLAs may be needed for specific areas - often involving chains of them - but in general, what most users want, even at the server level, is something that will work "adequately" ALL THE TIME.

Winston
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!