News for hackers. Stuff that matters.
Re:.NET Culture Shock by zandorg on Friday June 25, 2010 @06:00PM (#1462314)
I just started learning .NET and C#. My first impression is that it makes using all the Windows API really easy. So, you can get the time without fiddling with C time structs, and use DLL's without allocating memory.

Here's the main distinction: Whereas Java has underlying it more Java, .NET has underlying it 30 years of carefully-optimised Windows C/C++ code. It's basically a layer turning Java-like code into very fast Windows code.

And it's clear to me that Microsoft spent a lot of money writing this layer over Windows that makes writing Windows programs so easy. People don't give them credit for that.

Re:.NET Culture Shock by StrawberryFrog on Friday June 25, 2010 @07:07PM (#1462509)
.NET has underlying it 30 years of carefully-optimised Windows C/C++ code. it makes using all the Windows API really easy.

Do you tell people that "an elephant is like a tree", much?

I think you are talking about WinForms there. There's a lot more to .Net than targeting the "30 years of Windows C/C++ code" that makes up WinForms.

There's WPF on the desktop, and WPF's little brother, silverlight. The's serving web pages via ASP.Net WebForms and MVC variants, And serving data over web services. One could spend several careers using .Net without using as a wrapper for Windows' C Dlls.

Re:.NET Culture Shock by mkramlich on Friday June 25, 2010 @11:47PM (#1463045)
Unfortunately when he said "30 years of carefully-optimised Windows C/C++ code" what he did not know at the time was that the phrase leaked through a wormhole into an alternate dimension and was then overheard just as the commanders of two massive battle fleets were making a last minute effort at diplomacy to forestall what would otherwise surely be an imminent major galactic war. More unfortunately, the sound of describing the underpinnings of .NET as being "30 years of carefully-optimized Windows C/C++ code" is almost exactly not quite entirely unlike the sound produced in the Ferhfxian language of the insult, "Your mother is very nice. And tasty." and so, unfortunately, a great galactic war broke out, that lasted for thousands and thousands of years, until nothing but two dead lifeless planets were left, and it was all clearly the fault of Microsoft, once again.

(with apologies to Zandorg and Douglas Adams)

Re:.NET Culture Shock by StrawberryFrog on Saturday June 26, 2010 @10:06AM (#1463682)
Whereas Java has underlying it more Java,

Is it' Java all the way down? No. All virtual machines and runtimes are wrappers over the OS's abilities. How is Java different here?

Re:.NET Culture Shock by rbanffy on Friday June 25, 2010 @06:10PM (#1462347)
> So, you can get the time without fiddling with C time structs

You know it's not more a compliment to .NET than a harsh critique on the (utterly detestable) Win32 API.

> Whereas Java has underlying it more Java, .NET has underlying it 30 years of carefully-optimised Windows C/C++ code

Your faith in humanity impresses me.

Re:.NET Culture Shock by zandorg on Friday June 25, 2010 @06:51PM (#1462460)
I once decompiled a Windows Microsoft DLL imported function, and it clearly had a lot of optimisations such as quitting if the 1st character is 'n', etc.

So I've seen this optimisation with my own eyes.

Re:.NET Culture Shock by rbanffy on Friday June 25, 2010 @07:10PM (#1462520)
I believe some places have very tightly optimized code. What I question is the risky assumption that under every .NET class you have carefully optimized code, refined for over 30 years. What did I use 30 years ago? Oh... A 6502. I had an Apple II+.

I also believe the Java stack has some very carefully optimized code too. It certainly has the performance to back up that affirmation. Besides that, it was designed to be easily portable to other OSs and architectures, a feature that's more important, IMHO, than speed under Windows.

Finally, you should only optimize for speed the code your profiler says has big impact on your performance. The rest you should optimize for readability and correctness. There is a lot of very subtle bugs we introduce when trying to optimize stuff and it's much easier to optimize correct code than to fix blazingly fast, heavily optimized buggy code.

Re:.NET Culture Shock by mkramlich on Friday June 25, 2010 @11:54PM (#1463054)
I was doing hand-optimizing of 6502 on the Apple ][+ back then. Well, a little bit, admittedly. The thing to do seemed to be a mix of BASIC and machine language. CALL-151 for the win!
Re:.NET Culture Shock by zandorg on Friday June 25, 2010 @07:26PM (#1462577)
I admit I was way off - Windows has only been around since 1985 or so, and in usable form since 1990. And Java does have some very fast code. And I agree about optimisations too. It's easy to go overboard to get more speed.