5 ms·
As a C# developer I remember the first time I developed a GUI java application. In C# you have a code-behind file with your own code and event handlers, and a "
by sebazzz 5y ago
As a C# developer I remember the first time I developed a GUI java application. In C# you have a code-behind file with your own code and event handlers, and a "designer file" with the generated code to set-up the GUI itself.
Then I used Netbeans for a Java app, and the code file contained weird sections of artificially not editable code, and event handlers were so much more complex and cumbersome - with inner classes etc. Felt really like a step back.
- panzagl 5y agoThat's more NetBeans than Java- the GUI builder really didn't want you messing with it's generated code directly.
- TacticalCoder 5y agoSure but for those who remember history C# was Microsoft's answer to the incredible success that Java was clearly becoming. Being years late to the party and basically creating a (back then) Windows-only copy of Java, it's quite normal that they managed to do a few things better. Regarding UI editors: back in the days IntelliJ was already amazing and allowed to hide all that boilerplate Java code. This boilerplate code was still there, but hidden by the IDE.
- saurik 5y agoI mean, C# only got created because Microsoft wasn't allowed to add native GUI features to Java. I feel like you might have missed all the critical history with J++ and the lawsuit from Sun.
- mdasen 5y agoYea, it's kinda hard to say how things would have shaken out. I think Sun was reasonably wary about J++. Microsoft's way of operating at the time was "embrace, extend, extinguish." Microsoft brought out Internet Explore (embrace), added ActiveX (extend), and pretty much extinguished Netscape. All websites could run in IE, but not Netscape - and users are going to use the browser that works for all sites. Sun's lawsuit against Microsoft wasn't quite about adding native GUI features to Java as much as Microsoft breaking Java compatibility. Microsoft removed JNI (Java Native Interface) and replaced it with J/Direct. Microsoft wanted Java programs to be platform-specific with Java being "just the latest, best way to write Windows applications" (according to documents from the trial). It's not like Microsoft was trying to create MAUI back in 2000 (the new C#/.NET multi-platform app UI). Microsoft was trying to make it so that Java apps wouldn't be cross-platform by both breaking Java programs that used JNI and making sure that new programs would be made with J/Direct and their Windows-only GUI. Today, we see a much friendlier Microsoft. It's wonderful. They're happy to coexist with lots of people and ecosystems, lots of Microsoft employees use MacBooks, and Azure is one of the largest operator of Linux servers in the world - and they've made a wonderful business out of this coexistence. Back then, Microsoft would kill everything it could find to keep its dominance. There was no friendly help. There was no "oh, we're just trying to make the GUI better." It was "if we make the UX better via a proprietary native UI, we can get developers using our UI toolkit from Java which means that users are still locked into Windows, it means that the Mac will still be starved for applications, and it means that new operating systems like BeOS won't get a library of applications to bootstrap from if they just add Java support." It can be hard to remember how much Microsoft tried to break your toys - especially when today they seem like the company that's trying to make cool toys for me and make my current toys better. Proprietary Microsoft Office formats to keep people locked in, telling PC makers that if they offered alternative operating systems as an option they'd lose access to Windows, and taking anything that showed promise and adding something to it to break compatibility with cross-platform implementations (Java, the web, etc) C# got created because Microsoft got locked out of their embrace, extend, extinguish strategy with Java. Their Java license mandated that they maintain compatibility and they didn't - and to be frank, it seems that they didn't break compatibility with good intentions.
- pjmlp 5y agoNow Google is doing the same with Kotlin, creating their own version of ".NET" on Android.
- jcelerier 5y ago> Today, we see a much friendlier Microsoft. It's wonderful > It's not like Microsoft was trying to create MAUI back in 2000 Today, in 2022, Microsoft still tries to uses the MAUI name even though it is directly the name of a pre-existing unrelated GUI toolkit (https://mauikit.org/ https://mauikit.org/). Much friendlier my arse.
- shannah78 5y agoI started from the other side of that fence, and I remember feeling jealous of how smooth the GUI editor was in Visual Studio. Even in 2022, I still don't think I've seen any Java GUI builders that are as easy to use as Visual Studio circa 2001/2. SceneBuilder is nice though.
- hermitdev 5y agoEarly C# didn't have partial classes and had the generated code in the same file as all of the rest of your code, as well. They put it in regions that VS would automatically collapse for you, but it was still directly there. I think it was C# 2.0 that added partial class support and they started moving the designer generated code into separate files which was truly helpful. I don't think C# was ever as bad as MFC was with true magic generated code that you had better not change lest you inadvertently broke everything beyond repair (unless you really understood cryptic C++ error messages & preprocessor usage). MFC of the same era was not beginner friendly, even C# 1.0 was. I've never had the (dis)pleasure of doing java UI work, though, so I can't really comment on the state of things there.
- coliveira 5y agoWhile Java was designed to be multi-platform, C# was designed specifically to create software that could run only on Microsoft platforms. Any advantage provided by C# is negated by tying your work to a platform that could be abandoned by MS as they did to Visual Basic.
- ChrisLomont 5y agoFrom the start C# was designed to run on any platform, which is why it compiled to IL and didn't use Win32 as the basis for the library. It didn't take long for JIT compilers to exist for other platforms.
- coliveira 5y agoYou're just believing in MS propaganda. Yes, people created compilers and virtual machines for other platforms, but MS never considered this important. Their goal is to have only Windows as first class citizen in the .net world. If you write C# code you're tying yourself to a closed product that is restricted to a single platform.
- sebazzz 5y agoNo, he is right though. .NET was not only on Windows, but Windows CE as well. Later also via Silverlight. You think of cross-platform as cross-vendor.
- coliveira 5y agoNot really. A single vender can be multi platform, for example Oracle. MS wants to propel their Windows platform. Windows can run on several types of hardware, but these are variations of the same thing.
- ChrisLomont 5y ago>If you write C# code you're tying yourself to a closed product that is restricted to a single platform. I've been using C# on Linux for well over a decade. And on embedded systems. Mono has shipped on various Linuxes for well over 15 years at this point. I've been able to write a single binary that runs on windows and on Linux, no recompile needed, for this long. >You're just believing in MS propaganda. Yes, one of us certainly has drank the koolaid.