My foray into C# - Part III
Listen to this article
Something I forgot to mention that was very cool about all this was the fact that I developed everything under Linux and the binaries run ASIS, under windows. That, to me, speaks volumes. It's a credit to the guys on the mono project.
I also feel compelled to answer some of the suggestions that I'm biased. Me? Never! Nor am I opinionated, loud, prone to ranting....hehehehe
I too found the process to be very smooth and very easy. In no way did I try and suggest otherwise. At the end of both blogs I clearly stated how easy it was.
I was really trying to give an accurate account of what it was like to start from knowing nothing, along with all the annoyances and frustrations that comes with it. Some comparisons may not be valid from the perspective of a born and bred C#/Microsoft developer but you have to remember that it's only natural to make comparisons. That's how we learn. We try and compare it with something we already know to give it some context, some meaning.
I hear from a mate that C# version 2 will have generics and Iterators and a few things other things.
Regarding string versus String, you can't (at least using mono) use any of the System classes without "using" the System namespace. This was the thing that seemed ridiculous to me. Unfortunately String (big S) lives in the System namespace. I only found this out after I had converted lots of code so I kept on with the string (little s) convention. This was how I had seen examples written up on the 'net that I was using as a guide.
As for performance, again, in no way did I try and make out that .Net was necessarily slower. All I reported was what I had found running under mono on gentoo linux. As stated in the blog, hardly a reasonable comparison hehehe.
The only thing I really can't get used to are the libraries. I really do find them awkward. I used to be a C++ developer before I moved to Java and I really don't see the C# libraries as a step forwards. Oh and unchecked exceptions.
In no way do I despise C#. Okay so the quip about compsci students may have been a little harsh... I got over all the extra keywords, maybe you can forgive me in return hehehe. C# and .Net may not be my cup of tea but they no longer appear too different and too scary to at least try out.
Thank-you linesmen. Thank-you ball boys. It's back to watching the Australian Open...
Comments
Fair enough. Hey, that's what happens when you get ServerSided...
I hope you don't get slashdotted ;)
Posted by: Bertrand Le Roy | January 20, 2004 06:18 PM
Hahahaha. Wow. I've never been slashdotted. Might be kinda fun LOL.
Posted by: Simon Harris | January 20, 2004 06:23 PM
Yes, pathetic iterator would be there in C# 2.0 and hopefully we don't see anymore out of synch problems with removing an element from the collections. Wait till you see how broken enum is in C# ...
Posted by: Hsue-Shen Tham | January 20, 2004 09:29 PM
"Wait till you see how broken enum is in C#"
Do you mean that enum is a type of their own and not really the underlying type? So in order to get the underlying type in a enum you have to cast.
Example:
enum Range :long {Max = 2147483648L, Min = 255L};
long x = (long) Range.Max;
Of course purest would argue you would never have to use enum in a OOP language.
Posted by: Chuck | January 21, 2004 09:12 AM
What I meant with the enum :
http://cgi.skizz.plus.com/blog/dev/archives/000167.html
Posted by: Hsue-Shen Tham | January 21, 2004 09:36 PM
Just curious, did you get a chance to test it on a Windows to compare performance there?
KLR8
Posted by: Erwin Vervaet | January 21, 2004 11:33 PM
Not yet but I'm just about too. I will post the results when I get them. Though again I stress that it won't be a rigourous test in any way.
-- Cheers, Simon
Posted by: Simon Harris | January 22, 2004 05:05 AM
Hi Simon,
I found the "My furay into C#" very entertaining particularly b/c I shared similar experiences when I jumped from Delphi to Java. Anders Hejlsberg brought along many of the simplexity concepts from Delphi into C# (see http://www.artima.com/intv/simplexity.html ).
Anyway, whilst reading your series I made the following observations.
I'm going head-first into the unchecked exceptions debate here and state outright that it is plain broken and wrong that the only way I can find out what exceptions can be thrown is to pray and hope that they were documented.
1. Reactive v's proactive mindset
About 6 years ago I meet with Glenn Maughan who attempted to explain how Java encourages one to program with a reactive mindset, where as Eiffel demands a proactive mindset. Glenn had been fortunate enough to work with Betrand Meyer and exercised DbC (see http://www.self.com.au/aid/visit/self/book/java-mentor/methods/DesignByContract) daily while working on Eiffel studio. I have to admit for a long time I didn't get the reactive/proactive issue until I realised that when I did program in Eiffel (many moons ago), I never caught any exceptions. There is no need to! Instead, developers negotiate the contracts/collaboration between client and suppliers objects such that the system does not enter into a volatile/invalid state, hence "proactive". In contrast, the Java libraries and developers will try and have clients call supplier services and react with different behavior if an exception was raised.
These proactive/reactive approaches are language idioms. Whilst 1.4 have introduced nearly all elements of DbC except class invariants & defining/inheriting contract specifications, I doubt the Java community will chg their mindset - too much legacy with the current exception system.
My god! Not only that, but the I/O exceptions don't seem to extend any sensible base class. So now instead of hoping I've caught all the necessary exceptions, I'm forced to catch Exception.
2. Exception class hierarchies
In Eiffel, if a client cannot catch any supplier raised exceptions, there is little benefit in having an inheritance lattice of exceptions.
I've never programmined in C# but I suspect it has been moderately influenced by DbC but with a few backdoors built in (ie. reactive idiom).
I summary, think your comments above are a result of the friction caused by a hybrid proactive/reactive idiom.
-- ash
Posted by: ashin wima | January 25, 2004 05:23 PM