Tuesday, January 19, 2010

Why .NET Heralds the End of Intelligent Software Developers

These are sentiments I have felt for quite sometime, but have never written down, at least not in such length or breadth.

I believe that exclusive use of .NET is really causing the dumbing down of programmers. It's astounding how few people recently finishing their undergraduate degree know nothing at all about what is going on inside a computer or how their poor code or sloppy algorithms are thrashing the TLB, or D-cache, or harddisk or even have the slightest clue how to implement some code ouside of .NET. Don't even bother them with any kind of pointer math, algorithms, or data structures. I also feel that Microsoft's flagship language for the CLR, C#, is just a copy of Java that came 5 or 6 years later. Just compare the language rules, package framework, garbage collection, dynamic recompilation and bytecode (not exactly unique to Java either), and syntax of C# 1.0 and Java. It was basically Java with C++'s ":" operator for inheritance instead of Java's extends/implements keywords. Also, Generics were added in C# 2.0 which are just a rip-off, both syntactically and conceptually, of C++ templates except not as powerful (template methods and partial specialization not supported in 2.0 as far as I know for starters) and again 15+ years late to the game.

What do you get for all of the complexity? The most common pro I hear for C# v. C++ is garbage collection... if that's what you're looking for use RAII and stack allocated wrappers to clean up for you (e.g. auto_ptr, boost::shared_ptr, etc...). Have you ever seen a correctly written C# or for that matter Java loop exhaust the memory? Do you hate inserting artificial scopes (is that even possible in C#) or slow function calls in a loop to work around these issues? Don't you wish you could manage the allocation yourself sometimes? Too bad. The second most common is that you don't end up with NULL pointer dereferences... well you still end up with a similar number of "reference not set to instance of an object" errors which are exactly congruent and harder to guard against. In fact it's probably even worse because you cant check for equality with NULL first before dereferencing, except for the rarely-used "nullable types" which can then have the NULL pointer dereference issue again.

To draw an analogy, the creation of C# is kind of like the automatic transmission: most real auto racing is still done with some variant of a clutched manual transmission (except for some drag racing where shifting has to be really fast). Also I find that driving a manual transmission makes me more attentive, have more control over the vehicle, have a safer and easier merge onto the freeway (since I can choose when my transmission downshifts), and have a better chance and more responsiveness in the case of a crisis. In fact, if I had access to some accident statistics, we might find that drivers of manual transmission cars have fewer at-fault accidents per-capita (just speculating here, but would not be surprised). Thus, it's my personal experience that many more people knew at least something about cars and how they work in the past, versus now. In fact, if that manual shifting behavior was undesirable, you wouldn't see so many Manumatic systems in AT cars. You can argue that the car is "more accessible" now, but I argue that it is less flexible and it's users more lethargic or ignorant. That might boost sales, but I wager there would be few people still riding a horse if there were only MTs or if ATs were a special order options for those with a physical handicap preventing the use of MTs. Sorry to take so long to draw a parallel, but I think this is directly analogous to .NET. It's "a way" to do things, but it should not be "the way", is seldom if ever "the right way", and often is not even "a good way".

If you think that my disdain for .NET is an indication that I am some bitter old engineer from the '60s or '70s, I am actually in my 20s and thankfully just missed the fine line between when they stopped teaching "real" programming in school. And by the way, I used to work at Microsoft (full disclosure) and I left of my own accord, but not because of .NET :)

I originally posted this here, but I thought that I liked the response enough to post it on my personal blog.

No comments: