Richard Mitchell

Software Engineer - Red Gate Software
Engine programmer and factotum.

The good life

Published Monday, December 11, 2006 7:16 AM

It's amazing just how easy programming is nowadays. For the past 2 years-ish I've been working almost exclusively in C# and I forgot quite how much of a pain it can be when you have to code in C++ for a while. You have to remember all these little things like include paths, linking options, DLLHell (although I must admit the embedded manifest for requesting a version of the runtime is pretty neat) and compiler options.

You have to drop back a few steps to realise how far you have progressed. OK when I moved from C++ to C# there were a few features I missed like multiple inheritance and templates. OK you can work around multiple inheritance and you can argue that it's poor design if you need to use it, but I liked it and missed it on occasion. Templates however were a serious shortcoming and Microsoft at least recognised that and (praise appropriate deity of your choice) they fixed that with C# 2.

As I was saying though when you go back you realise what a painful world you used to live in. I'm having to look up compiler options, cross-compiling, even resorting to various shades of assembler when I really want things to work exactly as I need them to. This is what programming should do, make your life easier and you can tell that Microsoft have succeeded in that effort with C#, so bravo Microsoft. It's a brave new world and just pray you never have to go back to C++ ever again.

P.S. Does anybody have any idea why the op code pushad doesn't seem to work in my __asm block?

Comments

 

James said:

Richard,

I think I have to agree, I used to program in C and PHP at lot. I always found C fun although slow to program in - making sure you didn't have memory leaks was always a major part of the debugging job although this was partially offset by some of the Pointer stuff allowing you to do some pretty cool things quickly.

PHP was very quick to write in but it pales massively in comparison to the constructs in C# - well its not typed for one..

Microsoft have done a great job in creating a language with a nice syntax (I prefer it to Java) and a good selection of constructs - personally I think that one of the CLR's strongest things is combining meta data with the program itself - no more .h files and attributes to embed extra meta information makes life pretty good.

- James
December 11, 2006 2:04 AM
 

Bart Read said:

I think I'd largely agree too, although like Richard I have to say occasionally I miss multiple inheritance. There are times when it would be extremely useful. I'm not saying it isn't possible to perpetrate grave evils with it, and in the wrong hands its clearly a bit of a programming WMD, however you can also do some very beautiful, clever and good things with it, and using some sort of delegation or visitor just feels a bit clunky by comparison.

I certainly prefer C# to Java in general, although the lack of checked exceptions still irks me a little, especially when the arguments in favour of no checked exceptions basically boil down to, "well you can't have them because we couldn't be arsed to have a superclass called Throwable and then distinguish between Exceptions and Errors the way Sun do." I'd also like namespace level access analagous to Java's package level access, although in .NET 2.0 friend assemblies address this issue quite satisfactorily. Probably my biggest gripe though is the FCL and WinForms: although it's considerably better organised, it has a long way to go before it comes close to the breadth and depth of functionality offered by the libraries that come bundled with Java. Also OSS support for .NET is much sparser. As an example, there's nothing really comparable to the Jakarta Commons project for .NET.

Having said all of that, I really do prefer C# as a language, and I'm not too anxious to go back to Java. Overall very well done to Microsoft, and keep up the great work!
December 11, 2006 8:02 AM
 

James said:

In response to Barts:

"although the lack of checked exceptions still irks me a little, especially when the arguments in favour of no checked exceptions basically boil down to, "well you can't have them because we couldn't be arsed to have a superclass called Throwable and then distinguish between Exceptions and Errors the way Sun do.""

I think the reason for this was to allow more than one language to run on the CLR (something which I think is very nice as languages such as F# make for some very clear code in certain situations and C++/CLR has certainly not harmed .NET's take up - ie choose your own poison). However I can understand that coming from a checked exception background that its frustrating that you cannot tell the exceptions which might come out of a method but less frustrating than having "throws exception" everywhere as that tells us nothing.

- James
December 14, 2006 2:58 PM
 

Bart Read said:

Agreed: "throws Exception" is very wrong indeed, and it always used to annoy the living daylights out of me that people did that. I spent about three weeks removing every instance of that from a very large application once, and replacing them all with more specific exception types which in many cases I was able to handle or wrap more appropriately in a domain specific exception. I also ended up rewriting virtually all the error messages to make them more comprehensible. Unsurprisingly it made the application an awful lot more stable.

OTOH, with .NET it's kind of like every method has an implicit "throws Exception" tacked on after its signature declaration. ;)

(Sorry I just couldn't resist.)
January 2, 2007 8:46 AM
You need to sign in to comment on this blog

















<December 2006>
SuMoTuWeThFrSa
262728293012
3456789
10111213141516
17181920212223
24252627282930
31123456
Encouraging .NET Reflector Add-ins
 Jason Haley is well-known for the resources he's provided to developers who wish to extend Reflector's... Read more...

Using .NET Reflector Add-ins
 .NET Reflector by itself is great, but it really comes into its own with the help of some add-ins. Here... Read more...

Unique Experiences!
 You'd have thought that a unique constraint was an easy concept - Not a bit of it; it can cause a lot... Read more...

Dynamic Data Templates in ASP.NET 3.5
 Gayani gives an introduction to Dynamic Data Templates in ASP.NET 3.5 and explains how one can save a... Read more...

First Steps with .NET Reflector
 If you are new to using .NET Reflector, or you are wondering whether it would be useful to you, you'll... Read more...