Comment by wg0
14 hours ago
Java wanted to run your code everywhere so they basically wrote a byte code compiler and then wrote one vm per OS/architecture
I never understood.NET's purpose. What problem it exactly went out to solve? Did Microsoft want developers to be able to run their applications everywhere too? Absolutely not.
Sidenote - MFC is the ugliest thing you'll see. Yet they didn't mention another piece of work called ATL. Active Template Library.
WinForms were really decent and that was enough. Keep Win32 API and a managed wrapper around it as WinForms and that would have been more than enough.
.
FWIW, x86 has always been a pretty moving target with many instruction set extensions, especially for various SIMD features. But even something fundamental like `popcnt` has a separate CPUID flag, even though Intel considers it part of SSE4.2.
Targeting the broadest possible variant of x86-64 limits you to SSE2, which is really not very capable outside of fairly basic float32 linear algebra. Great for video games, but not much else.
Also keep in mind that .NET originated right at the cusp of x86-64, which again is a whole different architecture from its 32-bit predecessor. Most native apps used to ship separate binaries for years.
And of course, I think Microsoft was aware of their intrinsic dependency on other companies, especially Intel. I can see how the promise of independence was and is enticing. They also weren't interested in another dependency on Sun/Oracle/whoever maintains Java at the moment. While Windows on ARM64 is still in a weird spot, things like .NET are useful in that transition.
Lastly, the CLR is different from the JVM in a number of interesting ways. The desktop experience with the JVM is not great, and Java is a very bad language. It makes sense to do your own thing if you're Microsoft or Apple.
I doubt that .NET was meant to solve the problem of underlying variation in instruction set of Intel processors because that concern does not exists for 98% of the applications anyway they rarely have to look for the compiler settings and for the rest of the 2%, the compiler flags are huge set of options and that kind of tweaks are NOT available for .NET anyway.
Additionally, such applications that want to exploit certain underlying processor's instruction set have no way to do so without detecting CPUID and landing into so called "unmanaged code" because .NET is all about very high level IR that even has object oriented features as well.
The .NET JIT compiler absolutely does query CPUID flags and generates different optimized code depending on available features, as well as the performance profile of each CPU model. This is similar to always passing `-march=native` to GCC.
This can have a huge effect on a wide range of applications, not just those using particular CPU features. For example, each libc implementation typically has a separate implementation `memcpy()` for each set of CPU features.
2 replies →
> What problem it exactly went out to solve? Did Microsoft want developers to be able to run their applications everywhere too? Absolutely not.
So .. initially it was "Microsoft Java", a managed language with tight integration into the Windows APIs, and non-portable. That was .NET Framework. A while ago they realized that even Microsoft didn't want to be tied to one platform, and moved to the cross-platform ".NET Core". It now occupies a similar role to Java but is IMO nicer.
> I never understood.NET's purpose. What problem it exactly went out to solve?
Java. Java is the problem .NET attempted to solve.
Is MFC that bad? I'm inclined to learn it now and see it with my eyes. I dabbed into Win32 programming for a bit (really just a bit, like a few days) and it was tedious, but not really anything bad.
in its beginning .NET was a wrapper around ActiveX and Com-objects and it tried with C# to replace Java (disregarding the Virtual J++ attempt). as their own JVM did not meet the license agreement they made with Sun. so there were several reasons and not every reason being one a developer would care about
I think the answer is simple - they wanted to Sherlock Java.
For others like me that didn't know the term Sherlock:
It means "To obsolete a unique feature in third-party software by introducing a similar or identical feature to the OS or a first-party program/app." The term stems from Apple's 2002 release of Sherlock 3, which made a popular third-party app named "Watson" irrelevant.
https://en.wiktionary.org/wiki/Sherlock#Verb
WinForms still exist, still supported, still getting new features. And it's open sourced. https://github.com/dotnet/winforms
> Active Template Library
Ugh that brings back bad memories. I remember it was supposed to be the answer to MFC. I did an internship where my boss wanted me to use it. It was very painful because it had basically no documentation at all.