Pages

August 26, 2008

Why I Love Java Way More Than .NET

So tonight I just spent two hours trying to add a simple library to a .NET project so I can simply cast an ActiveReport object as the child class my team uses to represent reports. The library could be added to the project very easily, but when I would try to build I would get an error stating that the referenced library did not have a "strong name," meaning the library had not been signed. So I changed the library to digitally sign itself when it was built and then did a new build of the project... Same error this time, but for another library that was being referenced in the referenced library. As I daisy-chained my way through all the libraries, updating them to have a digital signature I began to wish that I was back working on a Java project.

In Java, all you need to do is set your classpath to include all the libraries you need. There is no need to sign your libraries and I am very thankful for that. I have got to find a way to do more Java development at work because dealing with all this .NET mess is starting to drive me crazy.

17 comments:

  1. so true...and hate the C# way of naming a function starting with capital letter. That than anything else really kicked me off.
    And later on I found out the .NET does not have well defined deployment model like java for web app, enterprise app, mobile app etc. It's like create creepy dlls and copy paste them...

    ReplyDelete
  2. At least assemblies exist that are fully versioned. In Java, all you have are JAR's
    which also btw. have to be signed if you want to do anything remotely interesting with them (i.e. deploy as Web Start). You may be right on other points, but this one seems a bit weak. The grass is not always greener on the other side, at least you don't have to spend time on each project wondering whether to use java.util.logging, log4j, commons logging, SLF4J or... you get the picture.

    ReplyDelete
  3. I think you didn't understand the concept of Strong Name Signatures. This is a security concept which prevents spoofing your assemblies after they have been built. It is an optional feature which you do not need to use.

    ReplyDelete
  4. >>Stefan

    I understand strong name signatures and that you don't need to always use them especially for private assemblies, but in this case I had no choice. I was trying to add the libraries to a COM component so its assembly already had a strong name which then requires every library it references to be strongly named.

    I understand the power behind strongly names assemblies. I just didn't like having to take 2 hours of my day going back and adding strong names to the shared assemblies in my company that should have already been named in the first place.

    ReplyDelete
  5. You might enjoy your work more if you use some of the more recent C# language features. They really set C# apart from Java.

    ReplyDelete
  6. welcome to my horrible world ... when your projects become bigger you'll see other tricks too like, assembly does not match ....
    it happens when you have assembly2 uses assembly1
    assembly3 uses assembly2 and assembly1

    you changed the assembly3 and assembly1. Depending several factors like version and the assembly loading it complaints at runtime: The located assembly's manifest definition with name 'assembly1' does not match the assembly reference.

    ReplyDelete
  7. > I was trying to add the libraries to a COM component...

    You don't needed signed assemblies for COM.

    ReplyDelete
  8. There is a reason why your nerd score is just 79 :)

    ReplyDelete
  9. Casper - OSGI. Try keeping up.

    ReplyDelete
  10. @Anonymous
    Nah SUN is burying OSGi with JSR-277.

    ReplyDelete
  11. LoL. Sure. JSR-277 will bury OSGI. (Glassfish uses OSGI) Either way, point stands.

    ReplyDelete
  12. OSGi is not a standard, NetBeans Lookup is not a standard, JSR-277 is not a standard (yet) - hence my point. At least in .NET you have one unified way of dealing with modules, components and versioning. But whatever cooks your bacon Anonymous. lol

    ReplyDelete
  13. So, who cares if it is a standard or not? Standards are meant to be broken. Just ask Microsoft.

    That is what is great about Java. We don't have to wait for Sun or JSRs.

    To be honest, I have don't plenty of .Net and Java. Versioning has not been an issue. Now VB and DLLs ...

    ReplyDelete
  14. I agree, Mircosoft's apis are not programmer-friendly. As languages, both Java and C# suck, C# is a little better, but the editor (vs2005 for me) sucks big time compared to eclipse..

    ReplyDelete
  15. I agree that same task is easy in case of java i.e as you mentioned set classpath to include all the libraries you need. There is no need to sign your libraries is quite simpler than what is needed in .NET

    ReplyDelete