Java 1.5 vs C# 790
Here's the list of enhancements to the Java Language:
- Generics (C# 2.0 already supports this)
- Enhanced For-Loop (the foreach construct in C# 1.0, duh!)
- Autoboxing/Unboxing (C# 1.0 already has this, everything is an object, even the primitives - not really, but they do it so well...)
- Typesafe Enums (again C# 1.0 already implemented this, but I think they've added a little bit more twist in Java, that its actually a better implementation)
- Varargs (C# 1.0's params construct, ellipsis construct in C++)
- Static Import (I don't know if C# 1.0 has this, or C#2.0, but C# has a construct for aliasing your imports - which is way cooler. Static Import, actually promotes bad coding habits IMHO)
- Metadata/Annotations (this is C# 1.0's Attributes, Sun's upturned noses just gave it a fancier name - also, C#'s implementation is better and more intuitive)
They've beefed up the API some, and integrated several packages with the regular JSDK that used to be a part of a separate package or installation ---in my NSHO, the Java API has become bloated...
At this point (even before Whidbey) the deciding factor (as always) for Enterprise work, when choosing a language platform, should be the support it has behind it, in terms of IDE, tools, api, and longevity of the vendor pushing it (forget the OpenSource crap argument, those guys are too in love with Perl, Python, and Ruby - Java could become the child nobody wants to talk about if Sun dies) - right now that's C# and the .NET Framework ---
If you ask Paul Graham though, both language would be utter crap and fit only for idiots :) http://www.paulgraham.com/gh.html [I'm exaggerating, so hold off on those flames.]
All in it together (Score:5, Interesting)
C# and Java (Score:1, Interesting)
Re:flamebait (Score:3, Interesting)
Re:I code C# for a living (Score:4, Interesting)
Meh, that's just my take on it. And it would appear that my opinion is officially modded "troll". Oh, well. =/
the crap argument (Score:5, Interesting)
"At this point (even before Whidbey) the deciding factor (as always) for Enterprise work, when choosing a language platform, should be the support it has behind it, in terms of IDE, tools, api, and longevity of the vendor pushing it (forget the OpenSource crap argument, those guys are too in love with Perl, Python, and Ruby..."
Which "crap" argument is he talking about? I assume he means that when using those languages you have thousands of directions to go for help in howtos, docs, tutorials, books and of course the loving #perl. I normally would not reply to something like that, but I took offense. Yes I love those languages. They all have strong points and make life fun when coding. I have support and have never had to rely on a company to provide said support. Oh yeah, and I write enterprise software with the mod_perl crap everyday of my life. Thanks.
iamchaos
Re:Only Microsoft (Score:2, Interesting)
I've no plans to use C#, but it's something they definitely did right.
Java C# porting - Lucene as example (Score:5, Interesting)
If C#/Java continue in this direction, I think we will see many more applications that have parallel versions in the two languages.
See:
Lucene [apache.org]
dotLucene [sourceforge.net]
Re:All in it together (Score:5, Interesting)
And multiple inheritance is due when...? (Score:2, Interesting)
Limitations of Generics in Java. (Score:3, Interesting)
Java, which are properly addressed in C#.
For more details, you might want to read:
http://www.artima.com/intv/generics.html
C# still has a few extra niceties like properties,
events, delegates, anonymous methods and iterators.
Miguel.
Re:Only Microsoft (Score:2, Interesting)
C# supports a full exception handling model, it just does not force you to declare and handle checked exceptions, an issue of strong contention within the Java community. Its left to the developers discretion when to check and handle errors. The orinal exception will still be available no information is lost.
For my own opinion I prefer unchecked exceptions as the code is far cleaner. Enforcing checked exceptions can be extremely clunky to handle and its highly debatable whether exceptions should be part of an interface. I also noticed a recent trend among java developers to use a single catch all exception in many cases to simplify coding.
Re:Flaws in both Languages (Score:5, Interesting)
Neither is open source. Languages can't be classified open source, because they aren't programs. Certainly both languages have non-open source implementations, but they also have open source implementations.
Both require virtual machines. Well, I guess it depends on what you mean by a virtual machine. Technically even the C runtime is a virtual machine. That being said, both Java and C# can be compiled to native code, bypassing the need for the JVM/CLR.
Despite being marketed as portable, but have portability issues. ROTFL! Yes, perfect portability isn't possible. However, both languages are amazingly portable considering their extensive feature sets.
We don't really need them. Really, when you think about it, we only really need C. PHP/Perl/C++/Python are really all flawed languages as a consequence.
They're closely tied to their respective companies. This is more of a perception problem than a reality problem. I can do development in either language without getting involved with either company.
Enterprise development (Score:3, Interesting)
The new features to Java in version 1.5 are all anticipated and appreciated by the development community, but us J2EE developers won't be able to access these new features in our apps until the official J2EE 1.5 release comes out, and the various app server vendors (IBM, BEA, Oracle, Sun, JBoss, Apache, etc.) support it in their products.
Re:I code C# for a living (Score:5, Interesting)
Regards,
Steve
Re:Java poor design choices (Score:2, Interesting)
Re:the crap argument (Score:1, Interesting)
In commercial developement there are different values.
Really Good Ide. A MUST. There is no way your averange programmers will work day to day in a text editor. There has to be a layer that catches some of their mistakes and highlights others.
(winner: Java. IntelliJIdean and Sun Java SDK. Nuff said)
API. Even more important. Remember, the software, occasionally, is written for the client (yes, yes, I know this is not the usual case with hardcore
(Winner: C++/C#. On Windows.)
Consistency. What point to invest in language or technology if each release of it creates a totall mess trying to clean up our own code because there are some "small improvements" to the api. If you made it stupid first time, don't change it. There is code that relies on that.
(Winner: none. They All Suck. But from my experience nether Java, nether C# isn't the worst offenders).
Open source. This is not an argument. In fact, for enterprise world, open source sounds much more problematic than any of good old microsoft solutions. They are GUARANTEED to receive support, should they need it, they are guaranteed to have an access to consistent and high quality materials as a reference instead of "take a look at that and that site (full of dirty jokes, 1st semester level 'solutions' and racism)".
And as regards to writing enterprise software with mod_perl - good luck. I'll take a look at you when you will keep supporting it for the next 20 years. The language just isn't meant for this.
But, in example, Java is. It allows me to implement some nifty features like code autoupdate or object lifecycle monitoring without any hassle. And, it shows up to be so simple, that even newbies that could be looking at my code could understand that.
Re:flamebait (Score:2, Interesting)
Re:Meanwhile, C++ goes nowhere (Score:3, Interesting)
So, why do we still have buffer overflows? Is it because of the language? I think my previous paragraph shows that this is no longer the cause, and hasn't been for years. On the other hand, C++ does still allow you to make use of C-style strings, unchecked arrays, etc., so perhaps we can blame C++ because it allows you to shoot yourself in the foot, you just have to be very explicit these days. Or perhaps the problem actually lies in the hideously outdated libraries that people are using, libraries such as the ones Microsoft gives you (I'm not talking
More Features != Better Language (Score:2, Interesting)
Re:APIs (Score:2, Interesting)
Re:All in it together (Score:2, Interesting)
Re:Welcome stranger! (Score:1, Interesting)
>powerful, that when used together with structs and
>classes, one can produce beautiful code that is
>extremely powerful, yet so simple
Yes... until you forget a blank between several lowerThan or greaterThan operators when instantiating a template... then suddenly, all hell breaks lose and you'll get 600 lines of error messages, leaving you absolutely no chance of finding the place where you actually made the error
(well, the only way of finding the guilty piece of code is by guessing.).
> I would then suggest that we join our efforts, in
>teaching the unwashed masses how to actually use
>the language properly, so that we will not have to
>re-do all software in the world (both ours and
>yours) by ourselves.
Indeed... of course, C++ programmers like learning their language so much, that that's everything they'll do. Sure, for the first 3 years it's necessary, because whenever you've mastered one concept, you'll get bitten by all of it's little problems and exceptions and special cases.
And after that, C++ programmers always get so hot about templates and generic programming, that they'll write 1000s of lines of code just to use
that feature, thereby turning their code into something unmaintainable... except maybe by Bjarne Stroustrup, Alexandrescu or themselves... And after 10 years of that, they suddenly realize, that there's more to programming than just calculating the factorial at compile time (using templates) or
thinking about the PIMPL idiom (yes, that's a real thing, google for it, and yes: it's basically a hack to get around some C++ problems, and yes: it's bascally a neutered bridge pattern).
In short: Java (and, in turn C#) were created, to cut off the cruft of C++. Java is a simple language, that can be learned in a short time because the sheer number of language features and syntax ambiguities is considerably lower (do you know what "C++ digraphs" are? Yes? OK... so how many lines of code have they saved for you or how much safer have they made your code?).
Oh... and BTW: I prefer using a language, where I can actually get more than one fully compliant compiler; C++ doesn't have that. (Think I'm talking trash? Try using the "export" feature for templates in GCC or Visual C++... the only compiler frontend that supposedly knows them (haven't checked) is Cormeau).
murphee
Re:Java checked exceptions suck, but how to fix th (Score:5, Interesting)
And, before you whine about having to write the try/catch block, let me echo what somebody else said, that an IDE like IntelliJ will do it all for you (except for the comment).
Re:varargs (Score:3, Interesting)
I love this feature. Currently I have to do this sort of crap all the time:
String to int:
new Integer("1").intValue();
or parseInt
int to String:
String.valueOf(1);
In truth, Java should have dropped the primitive types altogether and went with a 100% object approach and allow things like this:
Integer _integer = 3;
Long _long = 5;
Number _number = _integer + _long;
_number--;
The above would be total sweetness.
What they should have done in 1.5 is strip out all the deprecated crap
Agreed. First to go: java.util.Date. And fix Calendar to be actually usefull.
Re:Mistake (Score:2, Interesting)
Of course that is merely the tip of the iceberg of the power of generics. C++ templates are a Turing-complete language in their own right, and when used correctly can do many of the things LISP programs can do, except executed at compile time.
Rules on languages... (Score:3, Interesting)
1. Does it have wide industry support or is it merely another "we ship it until we kill it" single-sourced language.
2. Does the name sound like it could hurt you?
C# pretty much fills the bill (no pun intended) for both 1 and 2.
MS is no stranger to introducing something and then killing it some time later (hence my avoidance of both
Then there is the whole "C#" name which, frankly, I think sounds retarded. To most Americans, the '#' symbol is pronounced "pound". Few people I know call it a "sharp" (actually, NO ONE that I know calls it that).
Finally, just the sound of it sounds dangerous and, if inserted in the wrong place (like my MIND) could cause harm.
Re:JNI (Score:1, Interesting)
Re:Flaws in both Languages (Score:2, Interesting)
CLR and Java VM are essentially the same thing. CLR is more flexible (it supports more languages, even though the list of currently supported languages is actually bigger for Java VM) and you can mix different languages for the same project. They both have advanced garbage collection schemes and both run 'inside' a virtual machine, although in C# you can 'step outside' (unmanaged mode) to do your own memory management (which is a big bonus for some projects). Duh!
Re:and how is this insightful? (Score:1, Interesting)
You're comparing apples to oranges. If you want to compare GUI front ends, you should at least use one of the gui front ends in your comparison. I used DDD in the past. There are others.
Personally, I use GDB-mode in emacs - my biggest frustration with Visual Studio is that there's no easy way to see the history of variable's values.
I'd want to run through a loop 100 times and have a buffer showing the values of the variables from each of those hundred times in a table. Trivial with gdb-mode under emacs. With Visual Studio it refreshs the values each time I hit a breakpoint so I can't see the history.
tunnel vision (Score:1, Interesting)
For all those who keep saying java is dying, Unix is dying, and mainframes are dying. Fact is, they aren't dying. Are the roles changing? Well yeah! Nothing ever stays the same and things will always change.
A professional developer should always think about the needs of the clients first. that means using C# and .NET if they are a Microsoft centric shop. It also means being up front and honest about everything. No one language is perfect and no one platform will ever be perfect. Most of the platforms today are sufficient for the majority of the businesses. Blindly believing marketing and PR material is both retarded and silly. Languages and programming shouldn't be a religion. It's a tool god damn it.
If you aren't willing to spend the time to learn the tool, freaking get out of the IT industry so the rest of us can focus on getting work done. </rant>
Exceptions anybody? (Score:1, Interesting)
In my C# development over the past year, I've been repeatedly frustrated by exceptions popping up in unexpected catch blocks because they were thrown and not caught deep down in the bowels of my code.
To me, that's more or less a deal-breaker in choosing C# for large-scale development. Unless developers are exceptionally disciplined (and that's hard to guarantee across a large/distributed team), lack of compile-time enforcement limits Exceptions' usefulness.
Re:With Java, stuck in Windows/Linux/Solaris (Score:5, Interesting)
If it's a choice of language based solely on the portablity of code, C# wins out IMHO. With Java, you're dependant on Sun to support your system, which is a royal pain. (as anyone with a *BSD box will tell you)
I run a J2EE application on WebSphere on a mainframe under OS/390. Where's .Net for OS/390? I can (and have) also deploy that same application with zero changes to Linux, Windows, Solaris, AS/400 or Mac OS X. I can choose from a number of J2EE implementations like WebSphere, WebLogic, JBoss or Resin, each of which have different features and strengths. I don't even recompile, I just drop in the WAR and go.
And it is incorrect to say that you are dependent on Sun to support your system. Independent vendors like IBM, BEA and Apple also license and support J2SE and J2EE for their own platforms. My personal systems are Macs and I get my Java from Apple, not Sun. My corporate systems are IBM and I get my corporate Java from IBM, not Sun. If I have a problem with either, I don't call Sun, I call Apple or IBM. IBM provides my production support contract. IBM are the ones who responded with a custom patched version of WebSphere for OS/390 in less than 24 hours when I had a production problem. Not Sun.
Apples and Oranges (Score:2, Interesting)
1)Simplicity. Everyone loves to argue about how purists should code things, but in the real world, a lot of code is written by people who are blissfully ignorant of theory. VS allows them to make obvious progress, reusability be damned. A crude, but working app is more impressive to a clueless manager than a collection of nascent classes.
2)Integration. This goes along with #1. Much of the heavy lifting in creating desktop apps is rolled into
3)ASP.NET. I would argue that ASP.NET is the easiest way to accomplish application-like behavior in a web site. Session state works well, database access is a couple lines of code, and you can even draw the page on a coordinate system if HTML stymies you. Scorn it if you must, but it's a good step toward standardizing web/application development.
varargs is *not* an enhancement (Score:4, Interesting)
As Stroustrup says of the ellipsis construct in C++, "The most common use of the ellipsis is to specify an interface to C library functions that were defined before C++ provided alternatives", and gives an example of the "extra work that face[s] the programmer once type checking has been suppressed using the ellipsis." Using the ellipsis construct, other than where it has to be used to access some legacy C library, is definitely very poor style in C++.
The libraries will make/break a language (Score:3, Interesting)
The biggest weakness I see in the
Even so, the Visual Studio IDE is so far ahead of any of the Java IDEs (Eclipse comes closest), that it's probably Microsoft's single best competitive advantage.
Chip H.
C#2.0 and IDEs (Score:3, Interesting)
I don't think it's fair to compare Java 1.5 (released) vs. C# 2.0 (beta, who knows when it'll actually be released). That's like comparing Linux to Longhorn.
And re: IDEs, while programming so much in VS.NET, I missed all of the cool features of my IDEA IntelliJ Java IDE [jetbrains.com] that I was excited to buy ReSharper [jetbrains.com], bringing some of IDEA's cool features to VS.NET.
One of the main things I like about
Re:and how is this insightful? (Score:3, Interesting)
indeed, debuggin in visual studio is awesome. Granted. Hm, does anyone remember the company from wich MS bought that technology? I can reboot one of my very old 486 (year 1993) PCs where I have used the same debugger on Symantec C++ 6.0 (Larry Wall, D++, ever heared about?). Frankyl, I don't see much improvement in Visual Studio, but my latest version is from 1999
OTOH, I use Eclipse at my customer sides
I would dare a statement:
*ALL* Java IDEs are *FAR* beyond any C++/Microsoft IDE. The only thing comming close to Eclipse is SNIFF+ from WindRiver (shit, forgot the old company name, was it Take Five?)
angel'o'sphere
Re:flamebait (Score:3, Interesting)
Or even JBuilder.
And I assume all the other IDEs have debuggers built in too.
And there's heaps of stand alone ones too. There's bound to be one that suits your needs.
hmmm....googling for "java debugger" gives a nice long list of java debuggers.
".net debugger" gives you a page full of problems with the VS debugger - headed with "The VS7.X Debugger doesn't work, What can I do?"
and one or two links that appear to be 3rd party debuggers - but aren't related to
I'm pretty sure that says something...I'm not quite sure what though....
Exceptions... (Score:3, Interesting)