Java 1.5 vs C#
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.]
...and let me tell you, java doesn't have to do that much to "catch up" to it.
"Quoting famous computer scientists out of context is the root of all evil (or at least most of it) in programming." - K
That sounds like it should be some Adams-esque race of semi-competent space pirates...
Obliteracy: Words with explosions
How about a cross-compiler that takes advantage of this vendor competition in cooperation to combine both communities of programmers into one pool targeting either virtual machine?
--
make install -not war
Fix that first link. It shouldn't have a slash at the end:
a tu res.html
http://java.sun.com/j2se/1.5.0/docs/relnotes/fe
Where's the story? Or is this just one person's interpretation of Java vs. C#?
I've never seen so many grammatical errors. You win.
Attention deficit disorder is a complicated issue, spanning several major... HEY LET'S GO RIDE BIKES!
and you're foundations in OOP is rock-solid
What about our foundations in English?
Quidquid latine dictum sit, altum sonatur.
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 ---
Why again can't I mod a story as -1 Flamebait?
--
I'll pay you $10. Really.
It's a bit unfair to compare the new Java 1.5 release with c# 2.0 since c# 2.0 is not due to be released until sometime Q2 or Q3 next year. But I do agree that before the 1.5 release Java had a lot of catching up to do to c#, but now c# is a bit behind (Mainly because of it's lack of support for generic classes which Java now supports).
Take it easy this article is a lot more correct then most of the ones I read here!
What language was this post written in? Amazing.
Growing up as a software developer in C and C++, I'm really impressed with Java. Although it IS slower and it runs on another layer on top of the OS, it IS still very impressive because OOP gives people the chance to understand programming without having to know much besides how objects interact with each other... (Dog plays with Ball, Car has Wheels, etc.) The platform independence is also a plus, and as our processors increase in speed, the overhead of running on top of a layer which runs on top an OS will become less significant.
I want actual functions, not "activity objects". Almost everyone, except for the extreme OO zealots, agree that OOP is not necessarily the best approach to every problem.
Table-ized A.I.
Actually... whoever buys the remnants of Sun will "pick it up" and do whatever they want with it.
This would get a -1 Flamebait.
My feeling is that these features are good news. There should be no gloating on the part of C#, it was clearly built on Java's coattails.
Competition is a great thing, ain't it?
It is certainly useful in some situations -- the Math class being the best example I can think of. The fact is, object orientation isn't a universal model of everything; some things, like algorithms, and even singletons, just don't have any need to be "objects". Static Import lets you drop that OO pretense. In the case of Math, where's the bad style in writing Cos(x) instead of Math.Cos(x)?
Maybe it makes more sense to listen to what the tech lead of Java 1.5 had to say here.
(= Calvin Austin)
Neither are open source.
Both require virtual machines.
Despite being marketed as portable, but have portability issues. Java is not backward compatible with older versions. C# has problems with porting some of the graphics stuff to Linux.
We don't really need them. PHP/Perl serve my needs on the web/server side. C++ and Python server my needs on the desktop side.
They're closely tied to their respective companies.
If you think this is flame-bait, check out this article's title.
Seriously, this looks like an ad for C#, a bunch of claims with very little support/evidence for those claims.
I've worked on C# and Java projects. As far as I'm concerned, C# = MS Java. MS could not control Java, so they abandoned support for it and built thier own "version." It's really a rinse & repeat cycle for MS: see successful software, build own version of said software to try to take over that market as well.
After templates (generics) come out in a few months, i dont expect java to have an easy time catching up.Personally, I really miss templates from C++ and would drift over to the camp that offers it.
The war with islam is a war on the beast
The war on terror is a war for peace
Perhaps /. will correct the error. I emailed the editor when the story was in preview, but it was too late.
Here's my theory. Along with the ubiquitous slashvertisements and the Microsoft-bash-of-teh-day barrage posts, these are a perfect opportunity to create a story that will generate 1,000+ comments and ten times those many page views and ergo ad impressions.
C'mon, C# vs. Java? Outside of "RIAA sues 86 year-old grandma", "We hate Bush, let's talk" and "Microsoft patents KDE" there is no better source of inflammatory material in the dorkosphere.
Sad, really.
Is this article flamebait? Maybe I am just misunderstanding when he says:
"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
I never did understand the need/desire for varargs in Java. Isn't that what polymorphism is for?
No folly is more costly than the folly of intolerant idealism. - Winston Churchill
So which version number is it? Java 2, Java 1.5, or Java 5? Someone should teach these guys to count before they start coding!
Java has a few advantages over C# in optimization. It's very easy to analyze Java programs to be certain that certain memory locations absolutely will not be modified. That's much harder in languages with native pointers. Those invariants allow you to compile out certain calculations that would have to be done at runtime in a C# program. You can even start spreading loop cycles over multiple CPUs, but I'm pretty certain that the present JVMs aren't that smart.
CMDRTACO CHECK YOUR EMAIL!
XML Parser
You mean like JAXP and JAXB?
Attention deficit disorder is a complicated issue, spanning several major... HEY LET'S GO RIDE BIKES!
It has been corrected now.
I'm not pleased with the "catch-up" game that Java is playing here. Java was a fairly nice middle-ground betweeen high and low level programming, and what appears to be an effort to become a high level language is rather ominous for those who are interested in testability and performance in Java.
This, BTW, is why you don't want your language to be controled by a company which in turn has a marketing-driven bottom-line. The idea that two languages could co-exist with different target audiences is nonsense to marketing droids, but perfectly reasonable to someone like Guido van Rossum, Larry Wall or any of the other maintainers of truly open-source languages. Open source isn't the only way to maintain this focus, but in today's marketing-driven world, you aren't likely to see too many Bell Labs-like organizations putting out languages like C (which was semi-open source, as was Unix). Java and C# are probably much more typical.
So Java is playing syntax catchup with 1.5. (Not making a statement, just noting what the intro seems to imply.) Great, they both seem to be taking plays from the good ol' C playbook. What appservers are available for C# though? Anything not made by Microsoft?
SexyFingers writes "Sun released Java 1.5...
The ultimate question is... how did you get those sexy fingers ? Java, C# or... Pr0n# ?
getSexySig();
No. Checked exceptions were an interesting experiment that turned out to be a bad idea. I won't rehash the arguments here (for a reasonable example, search for Bruce Eckel's writings on the topic), but when the ivory tower of checked exceptions meets the real world of deadlines, something has to give.
I've no plans to use C#, but it's something they definitely did right.
I use DOM within XML as well as the MessageDigest using the MD5 algorithm every day. So I'm letting you know...
Or, is your complaint based on the fact that the libraries that underlie the XML and Security algorithm API's can be swapped out? To me, that's a feature not a bug but YMMV.
Waltz, nymph, for quick jigs vex Bud.
whoever wins, we lose.
Combine this with the fact that nothing here is new news, and you really gotta as what exactly /. editors are for.
SexyFingers writes "Sun released Java 1.5. The non-API stuff that they've added made it finally "catch-up" with C# - like we were talking about before, since both language is built to support OOP from the ground-up, their constructs become almost identical as additional OOP "features" are supported overtime - so if you're doing C# and you're foundations in OOP is rock-solid, there really isn't any difference whether you're coding C# or Java."
"both language is built" being just one of the changes...now its "both languages are built..."
WTF? There are still grammatical errors in the "story," even with the changes. If there's nothing new to report, why can't we just have no new stories? Someone please make something like what /. used to be...
I code C# for a living, so according to your definition, sold (or more appropriately rented) my soul to the devil. (This does not change the fact that I personally prefer free/open source technology. My PDA, my media players, my home operating system are all free/open source based.)
Java is not any more closer than C# to open source technologies. Sun doesn't like open source, just as Microsoft.
It's a very well known fact that Java has been a base (or in other words "the" figure) for Microsoft while developing C#, but that does not imply that "Java is good, C# is bad" or vice versa.
I would be happier personally to code in Java, but professional life yields to disqualify who resists new technology.
Your choice of programming language is not your religion, and it can change continuously through your life. Just like your operating system.
A quick Google for "java MD5" gives a code example in the first hit, http://www.bombaydigital.com/arenared/2003/10/10/1
Think before you whine.
It's not so much the language that is a question of contest, but the platform they run on. I've done Java programming since 1.1.8, and have deployed on Tomcat, Resin and Weblogic.
.Net? What the fuck is up with IIS (oh yeah, it's crap)?? Where is any sort of replicated server side session management (no, long ass hidden fields are *not* sessions - and a M$SQLServer *only* solution doesn't count).
.Net's deployment platform (singular). Man I miss working with J2EE platforms and loathe IIS...even though it is my job to keep all this stuff running on IIS! :(
Recently I switched to C# (new job) and I have to tell you, the language is pretty neat with some of the tricks you can do. Nothing ground breaking though.
What's really missing is the platform for release, and release management. Where are WARs and EARs for
The constructs and tricks of a language can be debated as long as you want. You will probably find something nice in every language. But when you have to [operationally] deploy any application, great or not, on some cheap as shit, crap ass, hard to manage, non-repeatable platform such as IIS, that's when the real rubber hits the road with Java.
J2EE deployment platforms are light years ahead of
-bk
While neither Java nor C# is truly free of being controlled by an Evil Corporation(tm), Java at least has multiple vendors, runs on a wide variety of platforms, and has an open standardization process.
C'mon, C# vs. Java? Outside of "RIAA sues 86 year-old grandma", "We hate Bush, let's talk" and "Microsoft patents KDE" there is no better source of inflammatory material in the dorkosphere.
Oh, how I pine for the days of vi vs. Emacs.
- Tony
Microsoft is to software what Budweiser is to beer.
See this.
He kind of forgot that there are many programmers and customers who DON'T want to deploy their systems on win32. With Java apps, you don't have to. In fact you can choose almost any operating system and hardware. Anybody who chooses C# over Java for enterprise deployments is truly a MicroWeenie.
:]
I much prefer my 8 processor HP UX box any day
Let me know when stuff like an XML Parser and MD5 are native in Java.
They ARE.
XML package
MD5 and SHA support
The former has been in Java since 1.3, and the later since 1.1(!).
Honestly, Java has every feature and the kitchen sink in its core APIs. And if a feature isn't there, it's very easy to write a library to add it. That's why programmers like Java so much.
Any other features you'd like me to find for you?
Javascript + Nintendo DSi = DSiCade
How do you explain that Sun provides official Java runtimes for Linux (and for that matter sells Linux boxes) as opposed to Microsoft's complete lack of support for anything except Windows?
Sun has always been much more open than Microsoft. They are also allowing open-source implementations without fear of reprisal. We'll see if Microsoft manages the same tolerance with Mono.
Galileo: "The Earth revolves around the Sun!"
Score: -1 100% Flamebait
An XML Parser and stuff like MD5.
opinion. broken link... poor grammar... this guy is a joke. He pulls out 7 new features!! What about built-in queue support?
Only thing I agree with is generics has been long overdue.
So, were you trolling, or did you just not bother to keep up with Java?
It is this similarity and 'compatibility' of Java & C# that is now making it easy to port various applications between the two languages. For instance, the very popular Lucene (Information Retrieval library from Jakarta (i.e. Java)) has a very solid .Net port written in C# called dotLucene. The Lucene -> dotLuene port is fairly automated, it appears, which allows developers of the .Net/C# port to keep up with the original software written in Java.
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
dotLucene
Simpy
Hmmn,
:)
Doesn't mean a large project has to USE all of these features. There are plenty of different ways to accomplish a particular task in ANY programming language. Just because a way exists doesn't mean a project can't standardize on a particular method. Its pretty easy problemto solve and it goes something like this: "Please see Chapter 3, Section 8 of the project coding style manual for information on using import aliasing. Thanks".
The same rules apply were you to use Perl on a large scale project. It takes a degree of discipline to ensure everything gets done the right way. Regardless of the language it is ultimately a people and management problem
Jeremy
Now, now. Keep it civil. Taking the same route of insults as the original poster is only going to exasperate the situation. Keeping things calm gives him the opportunity to say, "Hey, that's pretty cool! Maybe I'll go try it out."
:-)
His bias does seem obvious, but it never hurts to try.
Javascript + Nintendo DSi = DSiCade
The world was a kinder, more simple place. And "news" didn't get edited after being published.
This problem is the primary reason that C# exists. If the C++ committee had fixed their language, we wouldn't need C#.
It's a big issue for the open source community. The publicly standardized languages have major problems, and the newer languages are controlled by single large vendors.
If sun dies... IBM will then pick it up... it's so clear.
Or perhaps Kodak will.
Sorry, guys but as long as you don't have that, you're not really OO.
In deep, in deep, in the very deep... if you dig a bit... /. maybe not look so bad as a news source.
sign(c14n(envelop(this)), x509)
There are some important limitations of generics in
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.
Nice troll.
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.
Do not try to read the dupe, thats impossible. Instead, only try to realize the truth
What truth?
There is no dupe
My biggest beef with java right now (well Sun, really) is that they are make design decisions in the name of backward compatibility that are leading to poor design choices. Backwards compatibility is an important consideration, but it should not be used as an excuse to make poor design decisions. I use a variety of java programs day to day that only work with certain VM versions due to bugs, features, etc. It seems silly to give this one aspect such heavy consideration as if the current java versions are perfectly backward compatible today when they clearly are not.
The new generics feature is clearly patterned after C++ templates, but in the name of backwards compatibility Sun chose to implement generics using erasure. This means that a generic type loses all of its type information leading to a alot of issues including broken support for arrays. Using erasure keeps much of the potentially confusing syntax of C++ templates and virtually none of the power.
I suppose I would be less upset if the feature had a different name. Maybe something like AutoCasting (like the name AutoBoxing). "Generics" implies things that the feature does not even try to deliver. Adding true generic programming constructs to java would have been a huge leap forward for the language. Instead we are left with a toy feature that allows you to build type safe containers, nothing more. Very disappointing.
SYS 49152
Coding standards are a waste of time to have to write and read and you know there will be plenty of people who won't follow them, or will at least gripe about their superiors having sticks up their asses for making those decisions. A language should be succinct enough that there should be no need to create a coding standard that has to specify which features to avoid.
Quick correction:
The XML APIs were part of a standard extension in 1.3. They were added to the core in 1.4. Also, I found the JavaDocs for 1.1, so here's a link to back up my statement that MD5 support has been around that long.
Javascript + Nintendo DSi = DSiCade
Netcraft confirms: C++ is dying
One more crippling bombshell hit the already beleaguered C++ distribution community when IDC confirmed that C++ market share has dropped yet again, now down to less than a fraction of 1 percent of all programming language distribution versions. Coming on the heels of a recent Netcraft survey which plainly states that C++ has lost more market share, this news serves to reinforce what we've known all along. C++ is collapsing in complete disarray, as fittingly exemplified by falling dead last in a recent programming language distribution study.
You don't need to be a Kreskin to predict C++'s future. The hand writing is on the wall: C++ faces a bleak future. In fact there won't be any future at all for C++ because C++ is dying. Things are looking very bad for C++. As many of us are already aware, C++ continues to lose market share. Red ink flows like a river of blood.
Bloodshed C++ is the most endangered of them all, having lost 93% of its core developers. The sudden and unpleasant departures of long time developers Jordan Hubbard and Mike Smith only serve to underscore the point more clearly. There can no longer be any doubt: C++ is dying.
Let's keep to the facts and look at the numbers.
Bloodshed C++ project leader Theo states that there are 7000 users of Bloodshed C++. How many users of Borland C++ are there? Let's see. The number of Bloodshed C++ versus Borland C++ posts on Usenet is roughly in ratio of 5 to 1. Therefore there are about 7000/5 = 1400 Borland C++ users. Bloodshed C++ posts on Usenet are about half of the volume of Borland C++ posts. Therefore there are about 700 users of Borland C++. A recent article put Bloodshed C++ distribution at about 80 percent of the market. Therefore there are (7000+1400+700)*4 = 36400 Bloodshed C++ users. This is consistent with the number of C++ Usenet posts.
Due to the troubles of half-baked C++ apps, abysmal sales and so on, many development companies is going out of business and will probably be taken over by another company who will sell another troubled product. Now C++ is also dead, its corpse turned over to yet another charnel house.
All major surveys show that C++ has steadily declined in market share. C++ is very sick and its long term survival prospects are very dim. If C++ is to survive at all it will be among dilettante dabblers. C++ continues to decay. Nothing short of a miracle could save it at this point in time. For all practical purposes, C++ is dead.
Fact: C++ is dying
Funny, we were talking about the 1.5 APIs last week here at work, while talking about migrating our apps over from 1.4.x. This site Official Java Programming Documentation gives you a ton to think about. I rem when we were on 1.2...
CB*($#@
free ipod and free gmail!
Last time I checked, few industries were doing enterprise development with J2SE, regardless of the version. J2EE is the preferred platform for enterprise application development (hence the 'EE', or 'Enterprise Edition', after the 'J2' bit). J2SE 1.5 is a great release, but it means little currently for J2EE developers.
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.
I've read the arguments on the topic, but I don't agree.
Relying on documentation to tell API users what exceptions can be thrown is a really terrible idea if you're trying to write server software that has to actually work. And work all the time, 24/7, not just in a demo. MS still seems to be in the mindset where their developers are mostly making client-side VB applications or tiny ASP sites.
We've had a number of cases so far where C# library methods unexpectedly threw an undocumented exception (that would most likely have been a checked exception in a Java implementation). Now, often if you were smart you'll be lucky and the exception falling through to a general handler won't break anything too badly, but other times something unfortunate will happen.
In my book, when Microsoft's fast-to-develop-cut-all-the-corners methodology meets the real world of SLAs where software actually has to work, something has to give. And yes, you can say "just use Java/Python/Cobol/whatever instead" but the point here is debating whether using checked exceptions is a good idea or not.
I'll be honest - I like a lot of things about C#. It's a good language and their IDE is also good. But deciding that checked exceptions were bad was very unfortunate.
The comparison only lists some baic language features, it makes no any sense! Java is NOT only a lanuage, it's a platform, it's a system, it provides all kinds of solutions for your desktop, network, micro device and enterprise web service.
> should be the support it has behind it, in terms
.NET.
.NET Framework ---
> of IDE, tools, api, and longevity of the vendor
Eclipse/IntelliJ/Together
Apache/Tomcat, WebSphere, BEA
RedHat/Suse/Mandrake/Debian
All of these tools and vendors have been around longer than C# and
> 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
You misspelled "FUD."
"For my own opinion I prefer unchecked exceptions as the code is far cleaner. "
No, the code will just appear cleaner. Hiding exception propogation is an invitation to ignore exceptions. If someone wraps code in a single catch, you can at least see where they've been sloppy. The equivalent in a non-forced exception check is to do nothing, which is invisible.
In implementation, there should be some syntax to say, I know that this function I called throws a checked exception, but I want it to be unchecked for me. This could be part of the method declaration, or (even better) part of the expression that trips the exception.
The evaluation of an action as 'practical' . . . depends on what it is that one wishes to practice.
I prefer unchecked exceptions as the code is far cleaner - Clean code vs. predictive application behaviour.. let me think...
its highly debatable whether exceptions should be part of an interface - Why? If it's part of the behaviour that can be expected from method, why not? Example: public void sendMail(Mail mail) throws IOException;
I also noticed a recent trend among java developers to use a single catch all exception in many cases to simplify coding - A recent trend you say? Noticed? Where? Bad programmers exist in any community, but I would be interested if you can find a succesful open source Java project where this stuff is considered acceptable.
Unable to read configuration file '/bigassraid/htdig//conf/14229.conf'
Geocrawler error message.
Sorry but the only reason i rejected Java some years ago was checked exceptions.
IMHO that was a major design fault of the Java designers to abuse the structured exception mechanism to provide semi-cooked validation of contracts.
That alone turned every simple operation in Java to a try/catch block
I think the problem you are seeing is Ravioli Code; a (perhaps excessive) reaction to spaghetti code. Also Java (and probably C#) programmers seem to take Patterns too seriously as well, patterns should be descriptive, not prescriptive.
ITs IEE and ansi certified and used for gnome development via mono. Java is more restrictive in terms of licensing and control.
http://saveie6.com/
No, he probably means like C#'s XML serialization / de-serialization, which is a hell of a lot nicer for most situations than either JAXP/JAXB (I've used all these technologies and I found JAXB so awful (and JAXP is just too much work for most situations) that I wrote my own utility for Java which works very similarly to C#'s XML serialization).
I won't even get into the speed of Java's XML parsers.
There are of course better solutions than JAXP/JAXB for Java (some similar to C#'s), they're just not standard and not quite as nice (in particular, because Java didn't have anything comparable to C#'s attributes until 1.5, and the attributes are quite useful in controlling XML serialization).
"...in my NSHO..." Sheesh, give us a break!
Down With Slashdot BETA!!! I've been around the corner and seen the oliphant; you can only abuse me from your perspecti
That's like saying "When I see a PETA member personally slaughter meat animals, I'll pay attention to his critique."
Basically, Sun did a bunch of things they could do without changing the VM too much and without breaking old code. But for a bunch of other features, they punted and just added a bit of syntactic sugar to the compiler that makes Java look superficially like it's doing the same thing but is much less efficient under the covers.
For enterprise applications, those differences may not matter much (and they may even be harmful), which is probably why Sun doesn't do anything about them. But for desktop use and application programming, they do matter. Microsoft wanted to create a new language that their legions of C++ programmers could use, and C# is a pretty credible answer for that. Those people don't care about cross-platform features, they care about getting the job done, and if that involves the occasional unsafe module, it doesn't matter to them.
If I am not mistaken MS helped Mono out on their C# implementation.
In the driver arena this the prefered solution to having a closed official impementation. I would assume it is the same for the sake of a language also.
Wow, sent an e-mail as suggested when clicking on "use classic" banner, and got a fast response that addressed my msg
I generally prefer unchecked exceptions. Mainly because the entire process of declaring a thrown exception through mutliple layers is an asinine waste of my time.
The cesspool just got a check and balance.
For enterprise-grade work I still prefer J2EE over
You state that .NET development implies having to purchase VS.NET which makes .NET inferior to Java where you can download the SDK for free and a third-party IDE for free. However you completely ignore that the .NET SDK is also freely downloadable and that there are free third-party IDEs, such as SharpDevelop. As such both stand on equal footing despite your FUD attempt.
As for docs, you find it easier to use JavaDoc because that is what you learned. Those who learned MSDN find that much easier. It has little/nothing to do with the completeness or organization of either documentation.
Given his quote, wouldn't that be rather like waiting for a good roman-number computation from Einstein? I mean, given that Pike has proven his skill and has stated that he doesn't like OO (in so many words), you're just faking it if you claim to be waiting for an OO design.
Either respect what he's done, or don't.
Personally, I have a limited agreement, and I suspect he meant it in the same sense that I agree. I believe that like roman numerals, OOD has a limited utility, but when used for purposes outside of that, other things work better. I will say that I also belive that unlike roman numerals, OO doesn't seem to have any _huge_ weaknesses.
-Billy
----- You know you have ego issues when you register a domain in your name.
cpghost at Cordula's Web.
Neither are open source.
.NET platform may be encumbered by a patent, but you don't have to use .NET in order to use C#--there are, in fact, better toolkits and libraries available for C# already.
.NET is not fully supported on Linux and probably never will be. But the C# language is fully supported on Linux, and there are multiple sets of libraries available for it, several of them even cross-platform (Gtk#, wxWindows#, etc.). In fact, C# does not aspire to guarantee the same degree of cross-platform support, and many people view that as an advantage.
Languages can't be "open source", only their implementations can be. Both Java and C# nominally have open source implementations. However, the open source Java implementations may be legally encumbered because Sun owns a lot of intellectual property in Java. The open source C# language implementations conform to an open standard (ECMA/ISO C#), and they seem to be completely unencumbered. The
Despite being marketed as portable, but have portability issues. Java is not backward compatible with older versions. C# has problems with porting some of the graphics stuff to Linux.
You're confusing language and libraries.
We don't really need them. PHP/Perl serve my needs on the web/server side. C++ and Python server my needs on the desktop side.
We need a replacement for C++ because people just don't seem to be able to code safe, secure, reliable applications in it. Java isn't a feasible replacement for C++ because it completely insulates the programmer from the underlying platform. But C# is a plausible successor: it gives programmers access to the underlying platform when they ask for it, but otherwise protects them from accidents.
Hmmm, In a way I'm happy this was placed under "IT" instead of "Developers".
[ Monday is a terrible way to spend one seventh of your life. ]
It may seem like a waste of time to you, but to the guy who's going to be using your API or modifying your code it will be a godsend. In any case, you might want to try using a good ide like Intellij. It'll will wrap a statement in an exception handler or add a throws to the method with a single keystroke.
Welcome to planet earth - we also have a language called 'C++', but it is rather different from what you describe.
Here, we have compilers that can do bounds checking - avoiding buffer overflows, if you decide to use them.
However, the template feature of our C++ is so powerful, that when used together with structs and classes, one can produce beautiful code that is extremely powerful, yet so simple that it is easy to ensure it is not susceptible to said buffer overflows (or memory leaks or the thousand other plagues of much of the software that surrounds us).
This is why there is actually not anything fundamentally wrong with our C++. We are some who want template namespaces though, but outside of little issues (that do have workarounds) like that, the only things we really want is additions to the (already powerful) standard library, the STL.
One problem remains with our C++ though. We live on a planet inhabited mainly by clueless morons, people who do not like to learn, people who refuse to accept that maybe others have seen farther than themselves. This is why we, too, have a lot of problems with software in general - buffer overflows as you mention, among many other problems.
I am sure we can arrange for you to get a copy of our C++ standard - that will allow a clever individual, such as yourself, to write software without the problems we discussed. 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.
Deal?
Pretty much any place where the action to multiple exceptions is the same log statement. Kind of silly to use multiple catch blocks in that scenario. (Technically correct, yes, but a waste of effort, when all you're doing is logging the exception)
The cesspool just got a check and balance.
Just because C# has more features does NOT make it a better language. Infact most of these Java 1.5 java changes annoy me. You could almost all these things in 1.4 there was just a certain way of doing it. If you have every programmed in C++ before with lots of different people who program things differently you will know that having different ways of doing things can be a VERY bad thing. This is way Java was so strong because there was 1 right way and 1 wrong way. Where in C++ you have like 3 right ways (that don't mesh together) and about 15 wrong ways to do something. Java is simpiler and faster to write code because you don't have 5 or 6 different ways of doing the same thing!
that I dont care which a client wants anymore. Its like asking for 6 of one and a half dozen of the other. I had been afriad of learning Java for ages but knew C# very well. Then I forced myself to learn Java and as soon as I got into it I kept saying "Wow MS copied Sun!"
When you think about it though good OO concepts tend to evlove toward similar goals. Languane and usablitly concepts are the same all around. Its to the point now where the differences between Java and C# are more syntax and available libararies. Ive even been able to easily port Java to C# and vice versa since the languges are so similar.
It has defintaly opened up things more for me, as now I leave it to the client as to what they want. If they are an MS shop then C# is an obvious choice if they use Linux or perfer alternative platforms then Java is obviously what you should build in.
"Don't mess with him, he taunts the happy fun ball."
This actually sounds like a good use of annotations.
The cesspool just got a check and balance.
> like C#'s XML serialization / de-serialization
Well, there's XMLEncoder and XMLDecoder in Java, which handle simple cases really easily. Now to be fair I don't know the first thing about C# XML serialization. Also I've found XMLBeans (an open-source XML parser) to be way way better than JAX* for dealing with just about everything XML related.
And I agree - I think the attributes/metadata will be a big deal for handling XML in future Java endeavors.
Keep your friends close.
Keep your enemies in a little jar on your desk.
Yes, and Microsoft happens to be right on this one: "enforced checked exceptions" are a lousy idea.
As for copying, there was very little in Java that was original--languages like it go back to the 1960's. And in the few areas where Sun tried to "innovate", they often screwed up.
I sincerely apologize for feeding troll. :oD
Sometimes the truth is arrived at by adding all the little lies together and deducting them from all that is known.
Only Microsoft could steal a language and do away with enforced Checked Exceptions (making try blocks optional) because it was "too confusing" to bother to check for errors.
Nonsense. Checked exceptions are bug not a feature. An exception is useful because it allows a programmer to handle an error or unusual condition in the place on the stack that makes the most sense. Checked exceptions force intermediate code that has no sensible way to address the condition to declare a throws clause. That's nothing more than pointless drudgery.
Worse, the entire concept breaks down when interfaces are involved. An interface can't predict what kinds of exceptions its implementations might want to throw, so there is no correct way to define them. Checked exceptions do more harm than good and should be removed from Java. I'm not a .NET user but I'm glad Microsoft had the good sense to leave them out.
Not all those who wander are lost.
No, he probably means like C#'s XML serialization / de-serialization
:-)
You mean, something like Java's XMLEncoder? Nope, Java was still there first. Perhaps you're referring to the way DOM nodes can be queried directly via XPath?
That's certainly a nice feature that's not part of the core. No matter, we've been using libraries like JDom to XPath for quite a long time.
Javascript + Nintendo DSi = DSiCade
Java's primitive types are not objects. There's no reason they couldn't have been (compilers that generated efficient arithmetic code from high level components date back to the '70s) but they're not... which means you have to drop down to C-style types over and over again.
It hinders programming efficiency, and it hinders code efficiency: any place where primitive types can be used, the compiler can infer that primitive code can be generated, any place it can't you'd have had to use object types... but the compiler is MUCH smarter about figuring where casts need to be than average (or even above-average) programmers.
Smalltalk is "OO from the ground up". Java is "OO from the Integer up".
it just does not force you to declare and handle checked exceptions, an issue of strong contention within the Java community
Um, Java supports both checked and unchecked exceptions.
Irritable, left-wing and possibly humorous bumper stickers and t-shirts
You only use 2% of your DNA
I've looked at most of the posts, and I haven't yet seen someone mention about the pointers and memory allocation that can be used in C#.
This is where Java and C# differ.
Java doesn't have these features and most likely will not have them any time soon.
Of course when using them in C#, you have to label the those areas of code using those features as unsafe.
"Two wrongs don't make a right, but three rights make a left."
"Two wrongs don't make a right. But three rights make a left!" - Cosmo, "The Fairly Odd Parents"
If you count not being able to run the program on any other platform than Windows. With JAVA, you could easily deploy a program for Win, Mac, and Linux.
That he trashes C#/Java for requiring virtual machines, then suggests instead people use PHP/Perl... both of which are interpreted languages.
...
What?
Irritable, left-wing and possibly humorous bumper stickers and t-shirts
In the same light you're also correct - although idealistic - it would be nice to have a language out there that you wont need to to document, annotate, enforces coding style, etc. --- but that's an ideal (i think) - Knuth is making a stab at it with CWeb, his literate programming stuff (just google: Literate Programming), and in the meantime, the world keeps turning...
It's good to use your head, but not as a battering ram.
Well people are here now saying oh java is better and people are saying that c# is better. In my opinion both are good and just like competition should do (assuming MS plays by the rules this time) both products will end up the better because of it. For the longest time java had no real competition (in my opinion) and its development slowed down greatly but now that C# is starting to be used more and more often javas development has finally started to take off again. Nothing but good can come from this so rather than flame each other over this I think we should simply consider what features might improve either language and attempt to talk to communicate with the developers when possible to request these features and improve competition all around.
You can freely download Java 1.5/Java 5 for no charge. It's available now.
You sound like you've been visiting Timecube.com too much. C# has memory allocation routines available, but by default it's also got garbage collection. The rest of your post is just drivel.
-]Phreak Out[-
I'm curious, why do we still get buffer overflows in C++ code? I mean, the C++ string type and the vector container have been around for the better part of a decade now, and a standard part of the language for, what, six years? Seven years? And you can grab smart pointers from boost.
Widespread support for the STL-- meaning standard support, meaning your code's portable, not meaning "it works sort of similar as with the other compilers"-- was really, really slow in coming, and didn't really become universal until, well.. after Java.
Meanwhile very, very little of the associated literature for C++ really covers the STL. Many introductory C++ texts don't even indicate the STL's existence outside of cout, and I've never, ever seen any sort of teaching institution use a text for learning C++ that introduced things like STL strings and vectors immediately as something that coders should be using as soon as they know what strings and arrays are. If the STL is introduced by C++ textbooks at all it's introduced very late, as an "oh you can do this as well" sort of thing, after the reader's already become accustomed to using C strings and arrays.
As a result the "standard" C++ classes never really caught on as such. When people use C++ generally either they're locked entirely in to some vendor's APIs, or they're just doing C programming with classes. Most C++ libraries you'll come across will expect data passed to them as a C string or a C array or some kind of library-specifc homerolled string/vector class-- which doesn't particularly encourage developers to use the STL container classes since they'll just have to convert them to some other format in order to interoperate with anyone else.
I think basically the problem here is that even after all these years C++ just doesn't have a standard class library. It does have a class library that's endorsed by the C++ standards body, and you can claim that's the same thing if you like. But I'm not sure I'd agree.
Irritable, left-wing and possibly humorous bumper stickers and t-shirts
Yeah, the moderators were right - that's an interesting opinion, all right... Free clue: Yes, some people want to ignore error conditions in the face of deadline pressure. That's their problem. Forcing people to explicitly think about exception cases is a good thing.
The java generics system just saves typing and ensures type-safety for collections. But it does nothing about the problem of excessive boxing and unboxing that plagued java collection classes from 1.0 on.
For example if you have an ArrayList<Integer> in java, it internally uses an object[] to store the elements of the array. So everytime you write a new value to the ArrayList<Integer> by e.g. calling list.Add(i), a new object is allocated on the heap.
A List<int> in C# on the other hand uses an int[] internally, so adding or changing an element in the List<int> will result in no boxing/unboxing at all. A List will be just as fast as an int[] since the indexer method will be inlined.
The performance difference is dramatic: try creating an ArrayList<Integer>/List<int> and filling it with 1000000 numbers. The C# code will run 10 to 20 times faster, while the java version will use 20 bytes per Integer instead of 4 bytes per Integer like the C# version.
I am currently not at home, but if somebody is interested I will post a benchmark later.
Private property is the central institution of a free society (David Friedman)
Yeah, there's a syntax for this. It's called "put the try and catch in the function, with an empty catch block, and a comment that indicates why the exception can't happen." Then your function doesn't have to be declared as throwing an exception, and someone who looks at your code will understand that you didn't just eat the exception for no reason.
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).
Java is free, MS VS Express products wont be.
The Internet is full. Go Away!!!
Oh, how I pine for the days of vi vs. Emacs.
You must have meant, of course mutt.
www.vanheusden.com - home of Multitail, HTTPing, CoffeeSaint, EntropyBroker, rsstail, bsod, listener, nagcon, nagi
Java has had a way to write "unsafe" code from day 1.2. It's called JNI. Write your unsafe code in an unsafe language and hook it in with a dll.
Just when i start reading /. for a few days again, i'm reminded why it's so easy to drift........ away......
I have a couple of rules when regarding languages:
.NET and C#). And just when you get used to version XYZ, they come out with XYZ+1 which changes EVERYTHING. Sorry, I don't need my code to die at the whims of MS.
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.
IANAL, but I've seen actors play them on TV
dom4j vs. jdom, the vi vs. emacs of the Pepsi generation ;-)
Waltz, nymph, for quick jigs vex Bud.
I don't code much for living, but I managed some projects, and programmers. But I put a list of priorities in a project. The most important thing for me in a project? RELIABILITY. Because it's cheaper for me and the client. I don't want to spend my time fixing things that shouldn't be fixed. So therefore, NON-PORTABILITY to ROBUST PLATAFORMS(UNIX etc) other than windows in C#, makes JAVA a superior language. I don't care if I code in C# in 20% less lines than JAVA(and that isn't true), running only in windows make it an option that I just can't accept. I hate both languages, C# and JAVA, both are slow, and resource hungry, but a never will put reliability, portability, in front of ease of use. So let's bring back VB? Maybe VB is C#... you know.
I can only talk about this from a C# POV but no, hell no.
The template crap from C++ was nothing more than a preprocessor/compiler trick. It took the templates and expanded it out, making it heavy, fat and inflexible.
Generics are build into the CLR now, type safe and fast, especially when building things like primitive collections, where you no longer have boxing getting in the way of speed.
I've done enterprise-level Java and C# implementations for financial institutions, and reckon there is one thing that people always miss when comparing the two languages: installation.
C#, despite any other flaws, Just Works(tm). Install Visual Studio, write some code, click the run button. Sure it takes a bit of thinking to get a n-tier implementation up and running properly, but the installation of the back-end stuff (IIS, db connections, remoting) is incredibly simple.
On the other hand, to get enterprise Java (J2EE, although some would argue that a class library is easier and more versatile), you need to learn how to install an app server (JBoss, Orion, or god forbid WebSphere), and how to configure that system for database connections, performance, session and object permanence, etc..
None of this really matters in a 'big-iron' enterprise environment, because there's room to hire a websphere monkey to look after the cat-herding. In anything below a mega-corp or mega-bank however, the overhead of running Java can sometimes be a burden that developers just don't want to think about.
I see it kinda like using Firefox over IE. They both do pretty much the same thing, and one does it 'better', but at the same time requires some effort to implement. Some people just can't be bothered with the effort.
gadgetophile.com
You don't need VS to write .NET applications. The compilers come with the framework, which is free, once you pay for the OS.
You're comparing the wrong things though.
The Java SDK and compiler are free. The .net SDK and compiler are free.
Visual Studio, the editing environment isn't, but provided you can write a make file (well, sorta) you're sorted. Of course there's always Sharp Develop if you must have a free IDE
I'm talking about cases where you cannot prove that the exception won't happen, so your technique (which I'm sure you are not recommending for those cases) would be reckless. It is actually rare that you can prove a checked exception won't happen, either because it is impossible in principle (eg FileNotFound), or because the specification doesn't guarantee the exact conditions in which it may be thrown.
The evaluation of an action as 'practical' . . . depends on what it is that one wishes to practice.
Sometime in 1999 after I'd worked at Sun for about a year, a routine all-hands meeting was held for all of the Java Software division. JDK 1.1.8 was the current version of Java on the street and JDK 1.2 was in the works, almost ready for release. We sat there and listened to the usual rah-rah speaches from the divison's head honcho (can't recall who it was at the time), and then he introduced us to a marketing guy to tell us about the launch for JDK 1.2. As he begun talking he displayed a new slide on the project and it read, in all its powerpoint glory, 'Java 2000!' And he went on to say that the new JDK would be called, not Java 2, but Java 2000. Everyone in the audience started laughing hysterically. We all thought it was a big joke. I mean, Microsoft was on the verge of releasing Windows 2000, so you don't really mean.... Turns out this marketing guy didn't have much of a sense of humor. "I'm not joking", he said. The laughs and knee slappings turned into boos and hisses. Head honcho guy says something like the marketing guys have worked hard on this and that's the name they've choosen. The Q&A session was next and, boy, did both of these guys get an earful! Anyway, I can't say for sure, but I think that had it not been for the outrage and disbelief at that all-hands we'd be stuck with even weirder Java naming convenstions today.
Rich
It doesn't matter because you can get VS Express for free (which allows you to write C# 2.0 code), and eventually C# 2.0 _will_ be released for free. You can just use the free VS Express to tide you over until then.
Static Import, actually promotes bad coding habits IMHO
Ever seen bogus base classes or interfaces used to declare a bunch of constants? Those guys apparently missed static imports badly, if only to make their bad habits a bit more elegant.
Bad coding is possible in every language.
My exception safety is -fno-exceptions.
Seems related to my favorite pet peeve in OOP.
Spaghetti programming techniques can be reimplemented with a vengeance using matryoshka techniques (named after those Russian nested dolls).
This kind of programming does violate XP tenets suggesting that interfaces should be kept shallow. Methods that reach back into the third nested doll make me just cringe.
It's like spaghetti that wasn't properly rinsed and starts sticking together together...
"Provided by the management for your protection."
the entire process of declaring a thrown exception through mutliple layers is an asinine waste of my time
Interesting. Which other aspects of creating reliable code do you skip? Do you ever test for null values? Also waste of time, right? C# must suck because you need to add all those "override" whenever you override a method in a subclass - a clear waste of your time.
Well, the safety problems are largely a result of having raw pointers in the language, which you can't really "fix". Major, backward-compatibility changes just ain't going to happen, and rightly so. There's room for a new language in the C++ space, but it will have to be just that: a new language.
My personal gripes:
- Being near-impossible to parse correctly and efficiently. Which mostly means the preprocessor, but also name lookup rules, template POI rules etc. This is why the state of C++ tooling is so dire; our IDEs are a sad joke compared to what's available for Java.
- Weak standard library. (cries of "Heresy! Burn him! Burn him!") Yes, the STL is terribly terribly clever, and elegant, and impressive. It's just not terribly useful. Most people use iostreams, vector, list, map, string and not much else. How often have you needed to stable_partition a deque? Compared to, say, needing to portably list the contents of a directory?
- As you say, obsession with templates. The original standard library was bad enough; std::string did not need to be templated, nor did the iostream library. The current metaprogramming craze has made things even worse; it's great as an intellectual challenge, and to discover through experiment which areas need better language support (*cough*typeof*cough*). But not for everyday production code. It's hard to maintain, hard to diagnose when it breaks, and multiplies compile times by orders of magnitude. Trying to do agile development in C++ is a painful experience at the best of times; when it takes MINUTES to compile a five-line file, it's flat-out impossible.
That said, there are still areas in which C++ beats everything else out there:
- Control. It's the only mainstream general-purpose language that supports deterministic destruction and RAII. The importance of this cannot be overstated. GC is all very well, but given the choice between leaking memory and leaking file handles, or DB connections, or mutexes, I know which way I'd go. Similarly, GC pauses still rule out Java/C# for many realtime apps, even soft RT.
- Programming-in-the-large. In my experience, a single C++ source file takes much longer to compile than a single Java or C# file. But a large C++ system can be incrementally rebuilt after a change to one (non-header) file much faster than a Java/C# system. Header files are a repulsive kludge and a royal pain, but they're there for a reason.
Relying on documentation to tell API users what exceptions can be thrown is a really terrible idea if you're trying to write server software that has to actually work. And work all the time, 24/7, not just in a demo.
First of all, checked exceptions are not the only, not the best and not even a particularly good way to get documentation about what exceptions might be thrown. Programmers can and often do declare "throws Exception" which completely defeats the purpose. An automated documentation tool like javadoc can and should enumerate the possible exceptions each method might throw.
Second, checked exceptions are an unacceptable burden on programmers for several reasons. They are a tedious obstacle to rapid prototyping, where a programmer cannot really know what exceptions are likely to be thrown and shouldn't be asked to enumerate them. You won't get a chance to write a server application that has to work 24/7 if you can't create an effective demo in time. Even when creating production code there is no reason to soak up programmer resources fighting pointless compiler errors. Some code simply should ignore exceptions, but checked exceptions don't allow that.
A good example of code that should ignore exceptions is interfaces. Checked exceptions make it impossible to correctly declare interfaces because there is no way a programmer can forsee every possible checked exception anyone might ever want to throw in an implementation class. Were all of this not true, why would Sun have officially enshrined swallowed exceptions in the JDK libraries with the "cause" method?
No other mainstream programming language has checked exceptions, and even languages that exist primarly to duplicate the good features of Java aren't adopting them. Why? Because they are a bad idea. It's that simple.
Not all those who wander are lost.
Religion: Which is the One True Faith?
(Stolen from snpp.com)
"I want C# on my *N*X/Window box"
http://www.go-mono.com/
"I want Windows.Forms support on my Mac/*N*X/Windows box"
http://www.dotgnu.org
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)
The thread is hardly over. Visual Studio is one of the few applications Microsoft has released that I actually like. I still use VS6 at home, and I use VS.net at work. As another poster said, the debugging in Visual Studio is awesome. The two debuggers I use are visual studio in windows and gdb in linux. Gdb is powerful but, being text-based, isn't nearly as pleasant to use as visual studio's GUI debugger. Visual Studio's intellisense and auto-formatting also do what I want them to do, and I have yet to find an IDE in linux that "just works" the way visual studio does.
Microsoft IS evil, but Visual Studio is nice, and it is being developed by some very smart people.
That's what I'm saying.
VS Express _Beta_ is free. The released product will cost money. Microsoft has said that it will be cheap, but VS Express 2005 _will_ cost money.
The Internet is full. Go Away!!!
So if you're doing C# and your foundations in OOP are rock-solid, there really isn't any difference whether you're coding C# or Java."
.NET API or vice versa than to learn a few simple language syntax differences.
Yeah, except the entire API!
At least for me, it takes far longer time to learn and adapt to Microsoft's
Beware: In C++, your friends can see your privates!
I'm still faithful to C++ (just upgraded to Microsoft Visual C++ .Net 2003 Standard Edition) and I'm wondering what the differenes between C++, C++ .Net and C# are?
No, he's wrong. The Java 1.5 compiler stores the generic type attributes in the class file in what are called "Signature attributes". Generic types are perfectly safe across compilation boundaries. Where they aren't safe is when they are combined with raw types. That behavior is by design, and it is the tradeoff paid for having mostly seamless compatibility with an existing codebase. Whether that was an appropriate decision is an entirely different discussion.
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>
You mean, I have to buy it first before I can even try it?
I can get JSDK 1.5 and J2EE and a great IDE in Eclipse all for free. Heck, I can even download a free version of JBuilder. Why should I pay for C# when I don't even know if I like it yet?
Sam
One thing that makes me nuts in C# is its lack of compile-time enforcment of Exception handling. When I made the switch from C++ to Java, I fell in love with Java's compile-time checks for appropriate try/catch blocks.
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.
I too would love a Java 2.0 (no, not Java2 1.2) where we break backwards compatibility and toss out the old crap. It should probably come with a 1.x jvm to mkae the transition easier but it would at least provide a path to a scaled down API. I think after 4 years of 1.x and 2.x the 1.x could be dropped with little ill effects (even today's x86 aren't compatible with the 8088). And yes I do know what deprecated code is and how that works.
Your CPU is not doing anything else, at least do something.
This, BTW, is why you don't want your language to be controled by a company which in turn has a marketing-driven bottom-line.
I can't decide if you are talking about C# (true if so) or Java.
If Java, then your argument has no merit - as Sun does not control what goes in the language, and has not for some time. That is decided by the JCP, Java Community Process - a board of people from LOTS of different companies (like IBM).
If Sun controlled Java Generics would have been in 1.4 already. They have been around in the wings for a LONG time now.
"There is more worth loving than we have strength to love." - Brian Jay Stanley
My facts are perfectly accurate; what you wrote does not contradict what I wrote.
Your original post proclaimed Java must declare exceptions, which is false. How is it not false?
I agree that unechecked exceptions are the way to go for projects of any size, and have been using them in Java for years now.
"There is more worth loving than we have strength to love." - Brian Jay Stanley
Care to name that 1.3 only IDE and those numerous API changes?
As other posters have said, I don't think that C# is meant for big enterprise apps, but littler 'toy' apps. Still, you'd be surprised how many of such apps are in use right now. The biggest strengths of C# are:
.NET, so that a user can program to a higher level library. Documentation is all there. It also provides all of the tools and files needed in one tidy install, without the need for combining different packages. It all comes from one vendor, and it's easy to get your mind around.
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.
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++.
Programmers can and often do declare "throws Exception" which completely defeats the purpose.
So you shouldn't have checked exceptions because people might be dumb? Programmers can and often do totally ignore the possibility of exceptions (for example, in a lot of Microsoft example code) which can cause complete system failure. I could use the "people are dumb" argument to say that you should have checked exceptions as well.
An automated documentation tool like javadoc can and should enumerate the possible exceptions each method might throw.
Uh-huh. I haven't seen one that does this automatically for C#, it relies on the programmer to list them. Microsoft's own libraries have some documented exceptions that can be thrown but not all of them.
They are a tedious obstacle to rapid prototyping, where a programmer cannot really know what exceptions are likely to be thrown and shouldn't be asked to enumerate them.
Use a rapid prototyping language if that's what you want. By the same argument, maybe C# should get rid of strict type checking too - that's a tedious obstacle as well, right?
Checked exceptions make it impossible to correctly declare interfaces because there is no way a programmer can forsee every possible checked exception anyone might ever want to throw in an implementation class.
Sure. But as a client of the interface, if the new implementation you dropped in throws some random exception that I don't catch because I didn't know you could throw it, it's impossible for me to catch the exceptions I cared about and pass up the ones I didn't. So then it makes it impossible to correctly write a client class, since I can't forsee every possible exception anyone might want to throw in an implementation class.
How about Double Duh? For...Each goes back to when Visual Basic still had version numbers, as opposed to .NET release years and product names, and C# wasn't even a gleam in Bill's eye.
"It's the height of ridiculousness to say for those 9 lines you get hundreds of millions."
http://blogs.msdn.com/cyrusn/archive/2004/10/11/24 0673.aspx
Then tell me how much you want to push C# to production.
What really sucks is people who write [Java|C#|C++|Lisp|...] programs that run slower than shell scripts because they get lost in a twisty maze of inherited methods and end up with their view object having a method that forces a refresh of a list of objects in a box that ends up calling that method on the original object unless the object's position hasn't changed, so every time you resize the box it does a very slow and painful iterative balancing act to get the layout right... but they never notice because they're developing it on a 3 GHz Pentium IV...
Not that I'm bitter or anything, I just want an object system that includes a mandatory test on a Pentium 100 before the packaging tool will link it in with the production runtime. If it also involves painful but not dangerous voltages applied to sensitive organs if they try to skip this step it'd be a bonus.
The included libraries will make/break a language, and right now, the .NET libraries are much easier to use. Partly because they were designed "as a whole" and don't have a lot of cruft in them (yet). And partly because the MS on-line help is vastly superior to JDoc (does Sun not believe in code samples?).
.NET framework is that 90% of it uses concrete implementations. Because they didn't use an Interface-driven design, they now have to fall back on the Win32 style of appending "-ex" to class names when they want to improve them, rather than letting a dynamic loader find the class the developer needs.
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# is just one option for .NET eh?
Hmm... if only there were some other languages that could be compiled to JVM bytecode.
Anyone?
Rob Pike has done some really cool stuff, but he's also kind of a weirdo. He doesn't believe in putting any "#include" directives in ".h" files. He says you should figure out what the dependencies are and put all the includes in your ".c" file.
Rob Pike's Notes on Programming in C (go to the bottom of the page).
import java.lang.reflect.*;
End the FUD
Looking at your other posts, kfg, I figure this post is actually on topic.
:D
:)
What he means is that out of Java and C# he cares for neither of them and cares even less about what happens to them. That explains his little analogy
Am I right, do I win a prize?
I suppose this is better. Or this, for the JDK 5 documentation...
End the FUD
DISCLAIMER: I develop heavily in both C# and Java, more C# than Java, about 80% C#, 20% Java, not by choice but based on client demands.
.NET, though, is that the libraries seem to be more consistent, whereas the Java APIs have evloved and been added to by different developers using diffferent programming styles and approaches to patterns, each package seems to implement different programming styles and constructs, but you get used to it after a while. Plus, Java has so much deprecated code, they need to clean those out once and for all and clean up the APIs, see this for more details of what I'm talking about.
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 that I was excited to buy ReSharper, bringing some of IDEA's cool features to VS.NET.
One of the main things I like about
I thing this is good for the coders out there who can take advantage of these improvments in both the languages.
Anyone who has heard of Glenn Rowe, thats his opinion too and he doesn't hide it :P
All spelling mistakes are due to solar flares...honest
you read it wrong
.c
:
:
:
:
Simple rule: include files should never include include files.
it means that if one has
#include "plan9.h";
then plan9.h shouldn't have any #includes
*not* that you push them into the
then when you include plan9.h in *your* program you can choose which libs plan9.h & plan9.c can have access to.
main.h
#include "9p.h";
#include "plan9.h";
you can then plug in your *another* implementation of 9p.h
main2000.h
#include "9p2000.h";
#include "plan9.h";
thus plan9.h doesn't bind you to an implementation
in your plan (as I am reading it) you would suggest
main.h
#include "plan9.h";
plan9.h
#include "9p.h";
then how to write main2000.h ?
There are places where the networks are not touching,and there are places where they are-Boeing's Lori Gunter
"The point of checked exceptions is to force you to think about the error cases"
Any language feature that is intended to force a programmer to think about what the language designers thought was important will fail. Checked exceptions are no exception to this.
The hammer shouldn't be selecting the nail.
where do I find the "don't suck" feature?
Found it!
From hell's heart I fstab at /dev/hdc
Well, typically you want senior development staff to write the standards. If you pick senior staff (sucha s your architects or what not) to write the standard it works much better. You get people who code day in and day out to pick what works best for a particular project (with perhaps some company standard that each projects starts out with and modifies as is needed, if the firm is big enough to warrant it).
:)
;)
I don't know of a programming language out there that you can't abuse and torture and write unreadable code. Its simple, in any environment where more power is put in the hand of developers the more care must be taken. With assembly you can do ANYTHING, and fast, but its hard to write structured code. The point is that you can still write a program that can do just about anything your mind can conceive (that can be executed by todays computers). With the ability to write any program comes an inherent degree of complexity. If you don't manage the complexity your project will fail.
So, any one language that is "just" right for one project may not be "just" right for another project. As it is Java does not give a lot of latitutde in how you can do a great many things. For the rest there are coding standards. If standards are not followed them Team 1 may not understand Team 2's code as easily. It is managements job to educate and get everyone happy with the idea of a standard (perhaps someone doesn't like THIS standard, but they must at least be made to agree upon it regardless). Thats why programmers who work for money are paid, they are supposed to do what they are told
For the record I have never had any trouble (ultimately) getting my coding standards followed. It may take some discussion and tweaking to get everyone happy, but thats what being a senior staff developer is all about: mentoring, educating, and writing good code
Jeremy
Say Amen!
Just because operator overloading can be used for evil is no reason to throw the baby out with the bathwater.
Java lacks a Currency class, so I wrote a Money class some time ago that I use for common financial calculations, and it takes care of the pesky problem (and newbie mistake) of using floating point types for money.
BUT, in Java, you have to have add(), sub(), mult(), and div() methods. Reading RPN style caclulations consisting of sequenced and nested method calls instead of algebraic operators is painful. Operator overloading is wonderful in those cases.
Operator overloading certainly can be evil: What does it mean to increment an Employee? Do I really want to know? But for new types that you can actually do algebra with, it is quite helpful.
And there are other cases.
In my C++ days I wrote a FileHash class that kept an index of offsets to the start of each text line in a text file. Then I overloaded the array subscript operator so that a text file could used like an array of char pointers (or a String class if you liked). That was a perfectly good use of overloading.
Moreover I think overloading the array subscript on ordered collections also makes perfect sense.
I often wish Java had this feature. I agree with every simplifying choice they made except this one.
Am I right. . .
.do I win a prize?
Yes. I guess I need to start using Zen tags or something.
. .
Absolutely. You win an hour, all expenses paid by you, in beautiful, downtown Troy, NY.
Second prize is two hours in Troy.
KFG
While offtopic. . .
.this is easily the most interesting comment in this story. Thank you.
See above.
. .
You're welcome. That entitles you to second prize, as per above. My condolences.
KFG
OK, and what I'm saying is that you don't NEED VS Express to write C# 2.0 code (you only need it for now because that's the only thing shipping with a C# 2.0 compiler at the moment). Soon enough, C# 2.0 proper will be released FOR FREE, including its own compiler.
Hence, it doesn't matter if VS Express someday costs money. You can still code C# 2.0 for free.
C is too low
Java too slow
Fortran is... well, Fortan
C# has mono
Perl has gono(rrhea)
None can do what C++ can!
SexyFingers: So if you're doing C# and your foundations in OOP are rock-solid, there really isn't any difference whether you're coding C# or Java.
GCP (122438): And I was a member of one of the JCP expert groups that brought you Java 5.
The single biggest disadvantage of Java is that it is inherently 32-bit in nature, and is utterly unsuited for use in the emerging 64-bit marketplace [x86-64, anyone?].
For instance, the following code will NOT compile [or "javac", or whatever you want to call it] in Java 1.5:
Java is a language designed to run on the hardware of the 1980's. C# is a language designed to run on the hardware of the next two decades.For this reason alone, I cannot recommend that any new project start from the ground up with an obsolete 32-bit language like Java. [Obviously existing projects may need to remain mired in an obsolete language, owing to the inertia of legacy code.]
Shouldn't this be under "Developers" not IT. Believe it or not, more then just it people use these two languages. Well, im not sure about C#, but I am certian about java.
I'm a good cook. I'm a fantastic eater. - Steven Brust
I like both Java and C# from a language perspective, however, working for a large company, I would recommend Java over MS's .Net. Java has been _very_ stable and _SECURE_ while the .Net security holes have already started at only version 1.1. We also appreciated the fact that we were able to switch our Java server apps to Linux over Solaris, we could even use MS Windows if we wanted to for our Java app servers; we don't have that same choice or luxury with MS .Net.
If Tyranny and Oppression come to this land,
it will be in the guise of fighting a foreign enemy. -James Madison
this guy wrote an interesting list.
read the 101 reasons
here
Since the two languages have striking similarities, one wonders when people will begin to develop source code translators to shield problem-oriented developers from the idiosyncrac differences between the two languages.
For instance, ISI's STELLA is a LISP dialect which compiles to Common LISP, C++ and Java(R). Along the same line, it would be nice to have a compiler for a "JaC#" language that compiles to both, utilising tons of Java APIs and C#'s ability to do native compilation (I am aware there are portability limits, but I'd much rather be able to be confined to a common subset while able to easily move between the C++/Java/C# worlds than using obscure language features that others can't decipher anyway).
--
Try Nuggets , our mobile answer search engine. We answer your questions via SMS, across the UK.
I'm still praying that Java survives.
In C++ the decision whether or not to make use of exceptions is hard to make. If you don't use exceptions, the results of many function calls have to be checks, which is considerably more of a hassle than Java. If exceptions are used, writing exception-safe code is really quite limiting (It often means significantly more little objects when "new" can't be used freely, and much of the existing code have to be rewritten, and I hate comments like "func() can't throw, so this is safe"). Seems that an garbage-collecting language like Java/C# is very helpful if one want to use exceptions.
BTW, the article says something like "Then it doesn't matter if you code in C# or Java."
When did they port C# to Linux, BSD, OSX, VxWorks, Symbian, etc, etc?
Pure and utter FUD
m icrosoft-deliver-64-bin-dotnet/view
.NET for 64-bit Windows 2003. Infoworld in a recent analysis explains:
.Net Framework means that the hard work many Windows developers have put into migrating to the .Net development model is for naught on Windows on Itanium.
from http://www.manageability.org/blog/stuff/why-cant-
Despite having a research and development budget that is almost 7 billion dollars a year, Microsoft apparently can't deliver
The lack of a 64-bit implementation of the
In the meantime, IT shops that wish to employ 64-bit Windows as an application server or Web services platform will be forced to revert to the older, Windows DNA (Distributed Internet Applications) environment.
In stark contrast, BEA Systems and Sun have been shipping JRockit and J2SE with Itanium support ever since JDK 1.4.1 was released. Furthermore, according to the reports 64-bit Opteron support is expected at the same time JDK 1.5 is released.
So exactly like add*Listener and remove*Listener methods, just with different syntax.
Karma: It's all a bunch of tree-huggin' hippy crap!
Those certifications do not prevent it being patent encumbered.
There is a VIM Emulator Plugin for IntelliJ IDEA.
There is also a Vi Plugin for Eclipse.
Also, KDevelop has happily embedded KVim for ages now.
Is that enough?
Karma: It's all a bunch of tree-huggin' hippy crap!
Java vs C# wars is like watching two fleas fight over who owns the dogs back. Or for the immature /. readers, Its watching two script kiddies fighting ownership over the same honeypot
I forget which movie thats from, but props to the person who wrote it.
Neither language is right or wrong. Both are subject to the whims of MS and Sun. Neither is ANSI so you will never see different vendors (Borland, Watcom, Lattice etc) compete. Neither language grows outside of the CPU scope of the chosen VM platform.
Answer one question to yourself. Will the language grow with me as the hardware changes? Will I have a job twenty years from now?
Enjoy
It's just the normal noises in here.
There is not enough innovation either in C# nor in Java, and what is there is often not implemented in the best possible way.
Generics (C# 2.0 already supports this)
Both Java and C# generic are quite limited, compared to C++ templates. And they are easier to use with expression reduction, since you can give them a nice-to-use form.
Enhanced For-Loop (the foreach construct in C# 1.0, duh!)
It is much better if you can define your own for loops, as in XL.
Autoboxing/Unboxing (C# 1.0 already has this, everything is an object, even the primitives - not really, but they do it so well...)
Autoboxing means you have boxing in the first place, which means your language doesn't support stack object. Nothing to be proud of. And _auto_boxing is only a form of implicit conversion. In XL, any implicit conversion can be implemented using expression reduction.
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)
Ooooh! Enums! Innovation!
Varargs (C# 1.0's params construct, ellipsis construct in C++)
Still no type-safe, instantiation based varargs.
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)
Yes. (XL had import aliasing for a while, see examples above...)
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)
What you really want is metaprogramming, to actually enhance the language as you go.
-- Did you try Tao3D? http://tao3d.sourceforge.net
Well, that is an API issue, not a language issue.
If you wish to address it as an issue with the Java API, the problem there is that it ignores the question of: if exceptions could be just ignored, what other changes to the Java API would be necessary in order to accommodate this? The API designers could no longer assume exceptions thrown by API methods would be caught. This would certainly have a serious impact on how the APIs are constructed and interfaced with.
Irritable, left-wing and possibly humorous bumper stickers and t-shirts
That's a neat way of swapping around pluggable modules. However, there is still the problem of forcing the client programmer to be aware of the specific implementation dependencies in cases where things weren't designed to be modularly swapped out.
Not that any of that is relevant because Rob Pike's note on include files doesn't mention any of that stuff. He says that the problem is repeated inclusion of files. He also explicitly mentions that he is aware of include guards and his only stated objection is that they make the compilation take longer (which is not even neccessarily true; GCC uses a clever trick to detect the include guard pattern and avoid redundantly tokenizing files).
The C include system is fundamentally flawed and so even include guards have problems. But Rob Pike seemed to dismiss the technique outright, which is why he came off as a little bit of a weirdo.
Folks, this really isn't that hard. If an exception is supposed to be impossible to trigger, then just propagate it to the caller like this:
try
{
doSomething();
}
catch (ImpossibleCheckedException ex)
{
throw new RuntimeException("This is impossible", ex);
}
Note the ",ex". That was added in JDK 1.4. It allows you to later retrieve the original exception from the "wrapping" exception.
With the above code, if the impossible exception actually occurs for some reason (because you made a coding error), the exception gets propagated up the call stack encased in a RuntimeException, which is unchecked. At the top of the call stack, you can, if you like, catch all the RuntimeExceptions, call their 'getCause()' methods to retrieve any possible ImpossibleExceptions or others stored within it, and do whatever you like with them (including rethrowing them). Or just print them out and exit, which is what is most commonly done.
In any case, please don't just catch and ignore an exception that you weren't expecting. This hides errors, and makes programs REALLY hard to debug later. If it's not supposed to ever happen, and it can't be propagated to the caller because it's a checked exception, then please catch it and throw a RuntimeException, AssertionError, UnsupportedOperationException, IllegalStateException, IllegalArgumentException, or whatever (all of which are unchecked) rather than silently hiding the error and pretending that nothing bad happened.
I think perhaps the modularity argument fell out of the new view of working with includes.
I don't think it add's much burden on the programmer in return for simplicity.
If you ship a new library you will list the dependencies in the docs / example file.
I've done quite a bit of programming in plan9 c which uses this particular method of inclusion and not run into any problems with it (not that my programming is a significant sample size).
In plan9 top level includes make porting to different architectures much simpler. Instead of a bunch of #ifdefs in the included files to decide what to do for each architecture, they use architecture appropriate headers. (at least I think I remember it that way, I don't have the source handy to check
Clever tricks, hmm. There's *always* a "cleverer" programmer.
I'm in the section that distrusts clever things
Debugging is twice as hard as writing the code in the first place. Therefore,if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
-- Brian W. Kernighan
There are places where the networks are not touching,and there are places where they are-Boeing's Lori Gunter
And that word is "DataGrid".
For web applications, it's a godsend. I know it's a horrible mung (look at the source it creates on a web page), but for ease of use and speed of development, it knocks JSP into a cocked hat.
They will never know the simple pleasure of a monkey knife fight
Crap.
C is the most successful language in history, and vendor support for it was fragmented at best. If you've got a good compiler, you understand the language and you have all the tools you need, who cares if the vendor goes under? Your assertion that the "longevity" of the vendor counts in the slightest has no substantive argument or evidence backing it up. Defend your position! Just because the store that sold me my deluxe high-powered all-in-one combo jigsaw/drill/planing tool has gone out of business doesn't mean that the tool is worthless, and that I should therefore use a hammer.
My position is this: when you're starting a project, you have several goals, with different relative importances. Often the primary goal is to get the job done quickly, in which case a so-called "scripting" [emotive and inaccurate term] language is your best choice. At other times interoperability with certain other products is more important, and that drives the choice of language. Sometimes speed counts. Choose your tools to fit the job!
Most of the time what I see in reality is programmers choosing languages not because of their technical merits, nor even necessarily because they're popular, but because they've had a lot of press. What kind of a criterion is that? How many of you (programmers) can honestly say you've mastered more than three languages? Speak up now. No? Then wouldn't it be fair to say that your toolbox is a little empty? And if that's the case, isn't it just maybe possible that you don't always use the best tool for the job?
In a word - no.
XMLEncoder will never be useful for example for taking an existing XML schema and writing code to read/write to it. C#'s XML serialization/deserialization on the other hand is.
I'm also not referring to XPath - also nice but very limited as soon as you want to handle heirarchical data.
Wow. Either you're a MS zealot, or greatly misinformed. Or both.
At my former company, we switched to JDK 1.4 and tried to run with the 64 bit JVM. Not one line of code (out of millions) had to change for the entire application to run as smooth as ever on the 64 bit JVM (Sun's one at least).
This is true because Java doesn't provide a way to mess with pointers. Pointers are an abstract concept and they don't convert to numbers as in C/C++. Hence the total transparency of switching to 64 bits.
The code you provided doesn't compile because arrays do define their length in integers, not in long. Hence, Java arrays are 32 bits.
Not a very big limitation, by any means, except of course for some very specific niche purposes. But most of them can be worked around trivially anyways.
And I am not even mentionning the fact that C# has yet to see its first 64 bits implementation.
Write boring code, not shiny code!
This is best refactoring IDE out there. Nuf said.
And I must concure, VS is about as functional as textpad, dono what the fuss is about, no clue for the clueless.
Ohh yeah, try IDEA!
http://www.jetbrains.com/idea/
Still not convinced?
http://home.iprimus.com.au/trinexus/idea.html
GPLv2: I want my rights, I want my phone call! DRM: What use is a phone call, if you are unable to speak?
This is why marketing and eng's shouldn't mix :)
GPLv2: I want my rights, I want my phone call! DRM: What use is a phone call, if you are unable to speak?
It's too easy to give C# an advantage about what it adds to Java and forgetting it's a 95% Java clone.
Don't forget It took 7 years of Java and a Borland expert to produce C# !
During this time, Java did conquer most of the enterprise application development market and defined a technology model based on application servers handling component lifecycles.
C# as a language,has taken most of java state of the art paradigms and added some new features which are neat but, despite its huge base library is far from Java versatility and degree of maturity.
Java 1.5 advantages
Java 1.5 Drawbacks
- Client Side:
- Swing (but SWT / Eclipse rocks)
C# advantages- Management aspects
- Still time to have plenty of Microsoft support if you have a interesting project.
C# drawbacksSo, my conclusion is that by now, both technologies are interesting but Java is the most versatile.
I would prefer C# for:Windows Programming ,Attractive Web based interfaces (if an acceptable target platform is Mono or Windows),
Porting existing windows applications to Web,
Simple Self-Contained Web Services
I Would prefer Java for developing:Enterprise Applications,Complex Web Services,Highly interactive web interfaces (through applets),Multi OS client application.
For me, both languages are relevant, it's only a matter of what work has to be done and what resources are available to make it.Most of the time, technology is chosen based on a company resources capabilities!
What has providing runtimes to do with being open? Quite a few commercial, closed applications are available for linux (Oracle anyone?), does that make them open?
Rating my post as flamebait when it is just praise for posting the article? I guess people didn't like that article much then did they? Why take your dislike of the article out on me? I was only stating that I thought it was fair!
Courage is not rewarded here, but squashed like a stinkbug into the carpet of unwantedness!
I am not able to rightly apprehend the kind of confusion of ideas that could provoke such an article!
Ceterum censeo subscriptionem esse delendam.
I just had a Post Grad Flash Back 20 years ago of a class in the Tuple Calculas. At the time, for me, it would have been better named, "Set Theroy, Gone Bad".
I'm thinking there are several languages that can return a Tuple. "C" programmmers call it a "Structure". Object Oriented programmers refer to the rules of a "Object Returned", or "Get, and Set". My personal favorite is PERL's "my ( x, y, z ) = someFunctionResult;"
I see a time when there will only be one language that will be used. This new language will not come from the ones who give tribute to Redmond; Because it is not the way of the dwellers of Redmond. But from the morphing of our existing languages to a syntax that will be more easily understandable by both man, and machine.
Your original post proclaimed Java must declare exceptions, which is false.
No, it didn't even proclaim that. But, just for the sake of argument, let's say it did: if you tell me that you eat cookies, does that mean that you eat every cookie in existence?
Sorry, you implied it with the line:
C# does not force you to declare exceptions
What am I supposed to think you are saying?
If I am talking about Jim and Mary, and state "I like Jim and Mary, but Jim hates cookies" would you not at least assume that Mary has tolerance for them?
The problem with Java's declared exceptions is that libraries are full of exceptions you do have to declare, and those cause problems. That is, the existence of an exception declaration mechanism in the language is the problem.
An additional problem is that Java doesn't even type-check the declared exceptions it has correctly: something can throw java.io.IOException even though it doesn't declare it.
Let me correct you once more:
* Libraries full of exceptions you have to declare - false. Some libraries have exceptions (though not all) and they do not FORCE you to declare them. they force you to DEAL with them, which usually means catching and re-throwing, or catching and ignoring. In my case library exceptions are converted to runtime exceptions so I don't have to declare them at all. And that's what you should be doing anyway, as the points that are dealing with things like files are also the points where it's best to handle error conditions and convert the IO errors into some more semantically meaningful exception - which can be unchecked.
Note that some libraries do take an elightened approach to exceptions and use unchecked exceptions instead of checked (the Collections API, which C# has a weak copy of). As Collections are some of the most used classes, this reduces the burden for the common case.
* Something can throw java.io.IOException even though it doesn't declare it.
How would that happen? Give me some Java code that will compile and do exactly that.
If you say "throws" then you have to declare it throws that exception, unless of course its a runtime exception. So you get the best of both worlds in that you can use hard exceptions if you like, or use soft ones for larger systems where it makes sense (though I do think there is a place for checked exceptions at some API boundaries).
"There is more worth loving than we have strength to love." - Brian Jay Stanley
Well, I was being a little pedantic but you're right we were generally in the same area.
.Net has it's own form of that in operator overloading support, from experience of what people do when they discover overloading I would say that prefer a little abuse of checked exceptions, which I can at least wrap and toss.
.Net has the luxury of ditching when moving forward. Myself I think it's quite handy that I cen develop code using generics and send the bytecode off to a device that has never even seen generics. I would like the reflective capabilities .Net offers, but I can see a pretty sound reason for choosing the path they have and the benefits are still pretty good.
I will say that the compiling against a class that does not throw an exception and linking against a version that does strikes me as unlikley!
You're right that checked exceptions are a tool that can be easily misused, especially since for a while so many people seemed fond of them. But I feat that
Java does have a few technical quirks but that's what comes of being a widley used platform! At some point you have to consider the benefit of helping support older platforms, which
"There is more worth loving than we have strength to love." - Brian Jay Stanley
So you shouldn't have checked exceptions because people might be dumb? [...] I could use the "people are dumb" argument to say that you should have checked exceptions as well.
No, one shouldn't have them because they complicate programming and provide no useful benefit in exchange. Someone *did* use the "people are dumb" argument to say checked exceptions are good. I was answering the claim that one could rely on throws clauses to document the exceptions a method might raise by pointing out that in practice those dumb people are too clever. Checked exceptions don't solve the problem. In context your reply is irrelevant.
Uh-huh. I haven't seen one that does this automatically for C#, it relies on the programmer to list them. Microsoft's own libraries have some documented exceptions that can be thrown but not all of them.
So? I made no claims about C# or any language other than Java. I said that the right way to ensure that exceptions get documented is to use an automated tool to collect that information without burdening programmers with busywork. Your comment does not address that.
Use a rapid prototyping language if that's what you want.
Rapid prototyping is important in any language. Sun agrees: see http://java.sun.com/docs/white/langenv/Intro.doc2. html for example. Nevertheless, I was not claiming that this is the only criteria by which a language should be judged. I was giving an example of one ways in which checked exceptions cause problems. Strict typechecking has disadvantages, but unlike checked exceptions it has advantages too.
if the new implementation you dropped in throws some random exception that I don't catch because I didn't know you could throw it,
Client code can use "catch (Exception e)" and have some default behavior for dealing with unanticipated exception types. This is the correct thing to do, because it gives library implementations maximum flexibility while still permitting exceptions to be caught and handled specially where necessary. Many times the interface implementation is effectively a callback mechanism for the client code, so they belong to the same codebase and there is no question about what exceptions can be thrown.
Nothing you've said can obscure the fact that checked exceptions offer no benefits but do impose substantial costs.
Not all those who wander are lost.
I've been using Java for five years and forcing checks on exceptions is my number 1 most favorite feature of Java.
All that proves is that you have bad taste. I expressed clear reasons why checked exceptions are a bad idea and all you can come back with is, "yeah, well I like them"? Whatever.
I currently monitor sixty developers, fyi.
I'm glad I'm not one of them. You don't seem terribly bright.
Not all those who wander are lost.
That's what documentation is for. You do document your code, right? Besides, most of the API's I write tend to handle errors internally, or they're runtime errors. I find declared errors to be a pain for all involved and generally unnecessary. I do not seem to be alone in this viewpoint.
As for IntelliJ, I'm sure it's a good IDE, but I prefer Eclipse by far. (last time I used IntelliJ it was pretty clunky, although Eclipse 2.0 wasn't great either at that time....
The cesspool just got a check and balance.
In what way is using undeclared exceptions even slightly similar to checking for nulls? One is design, the other is a naive or unskilled programmer's error.
C#'s "override" is a language construct necessary for C#, much like adding "final" to any java class you do not wish overridden. What exactly is your point? Neither of your topics relate in even the smallest way to "reliable" coding in my book, at least not as presented. (hint: it's not my job to make your point for you.)
The cesspool just got a check and balance.
This is a laugh. I work with Java.
... (Not that I believe using unchecked exceptions automatically forces coders to learn what they're coding, but at least it'll be easier to weed out the smarter ones from those that should be sent elsewhere)
Checked exceptions are a compiler time check. Exactly how does using checked exceptions result in higher quality code than unchecked exceptions? I'll readily admit there's a lot more cruft in there, and god help you if you have to change the exception thrown, or add one, through all the layers.
I think this point has been relatively belabored by others. In short, checked exceptions look good in theory by immediately letting you know that there's an exception. The above statement about maintenance is a major negative.
I also feel checked exceptions actually hurts the novice/intermediate programmer in that now they'll never have to think, or read the actual documentation, because things are spelled out for them. It reminds me of using a calculator in first grade. What's 1 + 1?
The cesspool just got a check and balance.
Um, why ? Either the exception is caught at some level, in which case the application does something predictable (handles the error), or it goes all the way up, in which case the application does something predictable (it exits). You can already do this just by declaring every method in every class as throwing "Exception" (or maybe even "Throwable" :). All you'd need to do was make this the default case, just like extending "Object" is the default case.
Forget magic. Any technology distinguishable from divine power is insufficiently advanced.
The API designers have special obligations that other programmers don't. The program exiting may be something that developers would consider "predictable", but the end users would NOT.
Irritable, left-wing and possibly humorous bumper stickers and t-shirts
Or, you could populate it using models.
Most have abstract implementations that only require that you specify the data; providing event support for you.