Journal dthable's Journal: Java Is Dead. Long Live The Queen. 7
...or something like that. I read the following front page article on Java being a dead language. While I won't go as far to kill anything this afternoon, I do have to agree with Mr. Eckel that Java is unpleasant to C#. After working for 5 years in a Java environment, I actually found C# fun to program and always wondered why Java didn't have the same features.
I found myself envying three C#isms - type safe generic support, the "all data types are objects" mentality and C++ style code orginization.
The first to features do away with a lot of casting syntax. The damn java.util classes always manipulated elements as Object and for good reason. A list is generic. Give the list something to hold on to and it will. Yet, the lack of generics made this more error prone and just messy code. Cast an element coming out of a list and you get an exception. Type the expression into an IDE and it will tell you that you're getting an object, not a Widget.
I know Java added generics with Java 5, but it looked like it was more of a preprocessor than a fundamental design decision built into the type system. This creates a new issue where I have a SuperWidget and only want to create a list that can hold SuperItems. If I want to use generics I end up opening the list up for everything. If I pass things around as a SuperItem, I still have casting hell. This might seem too picky but think about how many times you have some generic process that should only be applied to a certain class of items. C# ends up implementing generics and keeps them type safe.
I also don't know how many times I've butted up against code that uses the primitive int type versus the class Integer type. Did you ever try to work with a Map using a primitive data type? I just hate having to type Integer.getInt(foo) into my code all the time.
Ok, the last one is a personal preference. I like to combine lots of stuff into one file. It just makes sense that I add a few loosely related classes into a single source file. Not close enough for an inner class but not separate enough for a new source file.
Just remember, opinions on programming languages are like a$$holes. Every one has one and they all stink.
Two things (Score:2)
1. If you are coding in C# professionally you are coding for Microsoft's platforms.
2. Not as many spiffy server-side frameworks exist for C#, what exists is tied again to Microsoft platforms.
OK so the browser doesn't really give a flying rip what OS the server is running, but there are perfectly valid reasons someone might not want to run their webserver or application server on Windows using Microsoft server products.
I think almost all you mentioned is there.... (Score:1)
http://java.sun.com/j2se/1.5/pdf/generics-tutorial
Also, autoboxing in 1.5 will take care of your need to never type Integer.getInt(foo) into your code again. If Java finds that it needs to do that for you, it will.
Re: (Score:1)
Java 1.5 (Score:2)
Re: (Score:1)
Just got a PHP assignment so it will be another year or so until I get to touch java again.
Class - File organization (Score:1)
Why?
So I know where my class is at!
I have seen
Re: (Score:1)