Revisting the gui.cs framework

(tirania.org)

121 points | by atesti 1800 days ago

7 comments

  • mikekchar 1800 days ago
    I don't know why, but I find it amusing to see Miguel de Icaza say: " Hopefully I will beat my previous record of two users." It makes me feel a lot better about my catalogue of completely unknown software ;-)
  • vaylian 1800 days ago
    I still don't understand what C#/.NET brings to the table that the Linux ecosystem is lacking. All these years it seemed to me that MdI was understanding something that I don't know about. I really appreciate all the efforts that MdI has put into Mono and I appreciate the fact that we have .NET core for Linux but I completely fail to understand what the practical benefits are. C# seems to be a more flexible version of Java that is suffering from feature creep. I have not seen any notable .NET libraries that I want to take advantage of.

    Maybe I am too deep in my Linux filter bubble. Can someone give me some examples of where .NET on Linux really shines?

    • caseymarquis 1800 days ago
      You may be looking at it from the wrong perspective. .NET is the platform of choice for nearly all Windows applications. A large number of developers/companies are heavily invested in the platform. Many of us like and use Linux, but wish we could leverage our experience with .NET from our day jobs on Linux. This isn't about bringing .NET to Linux for me, it's about bringing Linux to .NET. Now I can deploy with containers. Now I can better contribute to the Linux ecosystem. Now I can push for Linux deployments at work. I'm very happy with this development, but I doubt it will affect many existing Linux developers who aren't already using .NET.

      That said, having heavily used Java (6 or 7?), C# was a breath of fresh air (without going back to the headaches of C++). Java didn't even have proper anonymous functions at the time, so getting basic type inference, expression trees, a powerful reflection capability, and avoiding type erasure was a great improvement.

      • vaylian 1800 days ago
        Thanks! That's the type of answer I was hoping to get! So it is a lot less about the language itself but rather about the infrastructure and developer pool.

        Yes, I have used Java 6 and 7 and yes, I found them limiting compared to other languages. I only used Java when I had to. I mean, even right now I would only pick it if the problem that I want to solve fits the "everything has to be part of a class" mindset.

    • nizmow 1800 days ago
      I still don't understand why, in every thread about C#, someone has to start a thread about "why does anyone even use C#". Do you have the same attitude towards every programming language, or only some? Which programming languages are "blessed" by you?
      • vaylian 1800 days ago
        A programming language is a tool. And every tool has different strengths and weaknesses. I have worked with C# before and I have learned that it integrates well with WPF and other Windows infrastructure. But I have not seen any good applications on Linux yet (note: WPF does unfortunately not run under Linux and it likely never will[1]).

        Do I consider C# to be a bad language? No, it is decent. But I do not see it shine outside of the Windows ecosystem. This might be a chicken-egg problem.

        My main point is: MdI has supported .NET on Linux for so long. But I cannot grasp why. I admire his efforts and it would be beneficial to understand his motives so that I would know how I can use .NET on Linux for my own advantage. My post is really not meant to negatively criticise C#/.NET. Learning a language is often a multi-step process. The syntax is usually the first thing you learn. But the deeper you dive into the language the more you understand the design decisions. For example, it took me several attempts to understand Clojure and Lisps in general. And I assume that there are some important things about C# that I haven't understood yet.

        [1] https://stackoverflow.com/questions/53954047/does-wpf-applic...

        • eropple 1800 days ago
          > But I do not see it shine outside of the Windows ecosystem.

          A very large chunk of the games market on Mac and Linux either runs C# as the scripting host that's the primary developer interface (Unity, etc.) or runs directly on Mono or .NET Core (games made with XNA are almost drop-in-portable to FNA, there's also MonoGame, and Ultraviolet is new but pretty compelling--I'm currently fooling around with it for a project).

          Today C# is a thoroughly okay language. It was a huge step forward compared to Java when it was younger and more nimble but now they have real trouble pushing new features (for reasons that are not technical). But it isn't about the language--it's that it's what people know.

          And, if I'm being fair, JetBrains Rider is a really pleasant way to write C# these days.

        • alkonaut 1800 days ago
          Graphical applications aside, I think C# on Linux for web backend code using .NET Core is one of the best and most ergonomic platforms to use at the moment. Tooling (Roslyn, vscode, NuGet, ...) is second to none in my opinion.
          • eropple 1799 days ago
            YMMV, of course, but to me this is a surprising take. I quite like C#, but EF Core is awful (it is literally not possible to create in your schema a non-nullable boolean/integer with a default value of 'true'/not-zero without making the member property of your object nullable) and ASP.NET Core is not fully baked.

            Compared to something like Nest.js and TypeScript, or even Kotlin and Spring Boot, I wouldn't call it good, let alone "best".

            • alkonaut 1798 days ago
              To be VERY clear: I would never go near EF.
              • eropple 1798 days ago
                Gotcha. I find Dapper (the only other option I've ever seen used in anger?) really frustrating, too, though--boilerplate and SQL statements for simple stuff really grinds me these days.
        • GoblinSlayer 1800 days ago
          WCF has a well designed serialization that doesn't have deserialization vulnerability like in Java.
    • WorldMaker 1800 days ago
      C# has some at least some slight advantages to Java for the Linux ecosystem when building complex applications where you want a garbage collected and at-least semi-portable application.

      1) C#'s interface to C/C++ (P/Invoke or Platform Invoke) is generally easier than the Java equivalent (JNI or Java Native Interfaces).

      2) C#'s interface to COM and COM-like systems (Bonobo and Gnome/Gtk's GObject world, for instance) is a little bit stronger and again somewhat easier than the Java equivalent.

      Admittedly, some of that "easier" is subjective, depending on one's background and training, but C# coming from working with complex platform combinations of Win32 and COM has had to have some focus on making platform and object system interop work well, whereas Java always felt like (to me, at least) platform interop was more often a "bug" to eventually work around with a "pure" Java library given the chance.

      Semi-related aside: It's still something of a shame that anti-.NET sentiment several years back damaged so much of the reputations of so many of the best C# Linux applications. There was briefly a time where there were several very strong Gnome-environment C# applications in-box in Ubuntu, and I still think it was a mistake they were dropped. A lot of the arguments from that period somewhat soured me on running Ubuntu as a daily driver and some of my opinion of the larger Linux open source community. It was exciting seeing apps that I could so easily contribute to (as someone's whose day job efforts typically were C# at the time) in the box, it was angering seeing them denigrated not on their own merits but by indirect association with Microsoft (despite Mono's distance at the time, open patent promises, etc).

      • GordonS 1800 days ago
        There has also been a big push on performance and minimising heap allocations in .NET recently, and it's really been paying dividends.

        .NET also makes it relatively simple to work with memory on the stack (especially via `stackalloc`), as well as unmanaged memory on the heap. Of course, many developers never have optimisation problems that require these tools, but they are fantastic when you do need them.

        • WorldMaker 1800 days ago
          Yeah, I've been very impressed with .NET Core's efforts in performance lately. Span<T>, the stack allocation support, and greater "semi-managed" heap memory support, are a major performance breakthrough taken together. It gives the garbage-collected "safe" C# code most of the performance characteristics of pointer-heavy "unsafe" code.

          It's maybe still too early to make predictions of long-term impact, but it really does seem like it puts C# into a good position to take on even more "performance critical" work day-to-day, possibly keeping C# competitive with (and even mentionable in the same sentence as) languages such as Rust and Go. (Especially when combined with AOT/.NET Native compilation.)

          It is definitely something I'm keeping an eye on.

          • GordonS 1799 days ago
            Oh, I forgot about intrinsics too! Those will be in .NET Core 3.0, so you'll be able to use SSE, AVX, BMI etc instructions!
    • vnorilo 1800 days ago
      Not that it would be a game changer, but F# is a pretty nice language. https://fsharp.org/use/linux/
      • vaylian 1800 days ago
        True. Caml-like languages are nice (hello Rust!). One of the benefits of the CLR is that it can support virtually any programming language that can compile to bytecode. But I do not see that being a major thing. Yes, there are various Iron$language implementations and Clojure is also available on the CLR. But from my perspective most projects are C# and then there are just very few F# projects.
        • nestorD 1800 days ago
          F# has been open source from the start and runs on Mono but having dotnetCore on Linux gives us a faster and more reliable platform which is great.

          You can easily call C# code from F# so the fact that most of the .net librairies have been developed in C# has little consequences.

          Now we just need Microsoft to realize they have a great language and to invest properly in its marketing...

        • marmaduke 1800 days ago
          Yep. I initially was pretty excited by F# feature list (type providers?!) but saw how small teh ecosystem was, and couldn’t really get into it.
          • WorldMaker 1800 days ago
            CLR interop between languages is great, so if you count all the C# world as a part of the ecosystem of F#, F# has a relatively huge ecosystem.
      • holtalanm 1800 days ago
        I was going to say this. while i may not care much for C# because of its java-likeness, F# is a solid functional language that is definitely worth learning.
    • naasking 1800 days ago
      > I still don't understand what C#/.NET brings to the table that the Linux ecosystem is lacking.

      Did Python or Ruby bring something that the Linux ecosystem was lacking at the time? Do you see how this is a fairly irrelevant question?

      But to answer it anyway, the .NET VM has quite a few advantages over the JVM, and the libraries and semantics of C# provide a superior experience to Java on the JVM. Of course, no language or VM is perfect.

      • sametmax 1800 days ago
        Yes. Python, when it started to get some steam, brought a readable competitor to Perl, and Ruby, a clean alternative to PHP once RoR got out.
        • naasking 1800 days ago
          > Yes. Python, when it started to get some steam, brought a readable competitor to Perl

          So C# is a more readable and writable version of Java.

          > and Ruby, a clean alternative to PHP once RoR got out

          That was 10 years after Ruby was first released. Assuming "justification" is needed, what justified Ruby prior to that?

          • jhbadger 1800 days ago
            The fact that is was, and is, an incredibly clean and consistent scripting language with many of the best features of Smalltalk and Lisp that competing scripting languages like Perl and Python ignored. I started with Ruby circa 2001 thanks to the Pragmatic Programmer himself, Dave Thomas' "Pickaxe" book, and have yet to write even a single Web app (not my thing; I'm a computational biologist).
          • sametmax 1800 days ago
            Nobody used Ruby before that.
            • naasking 1800 days ago
              Well that's false because I used it, and there was quite a vibrant community around it already.
              • sametmax 1800 days ago
                Yes ? Point me to a popular open source project that is written in Ruby that is not web based ? Even today where we just passed peak ruby.

                And I mean "yum" popular. Blender popular. QGIS popular. Not "that script that sort my ssh connection is in Ruby" popular.

                • naasking 1800 days ago
                  > Point me to a popular open source project that is written in Ruby that is not web based ?

                  How is that relevant? The question was what justified Ruby at the time.

                  If "Ruby on Rails" was the only justification, why did people use it for the 10 years prior to that? Were they not justified in using it? That's just nonsense.

                • michaeldwan 1800 days ago
                  homebrew, fastlane, fluentd, vagrant, gitlab, cocoapods...
                • zem 1800 days ago
                  chef and puppet are very popular
    • Riverheart 1800 days ago
      There are a lot of people that are tied to C#/.Net that would never consider Linux as a target if not for the cross platform nature of core. It's the same reason Electron apps are on Linux. They'd be Windows/Mac only if not for the ease of being cross platform.
      • vaylian 1800 days ago
        So your point is that MdI wanted Linux to be not left out while .NET was on the rise? That seems plausible.
        • Riverheart 1800 days ago
          It's also a benefit to existing Microsoft customers because it let's them utilize their existing personnel to expand their audience without costly training or hiring on people who develop exclusively for the target platform. That's the benefit that Xamarin puts forth regarding mobile development.

          With the rise of Azure, Microsoft cares less about Windows being the dominant server ecosystem than being the choice for server hosting and having a competitive ecosystem of tooling.

        • jacobush 1800 days ago
          Now you are thinking about Miguels motivations. That may something different entirely from the market forces which propelled his projects to success.
    • qznc 1800 days ago
      Like Java and unlike C++, you have platform independent packages. Like C++ and unlike Java, you have features like value types (struct).
      • MaxBarraclough 1800 days ago
        There was a project to add structs (record types without heap allocation) to OpenJDK, but it seems to be dead. [0]

        There's also this less dead looking project, with goals that seem pretty similar. [1] Perhaps some day Java will finally gain this feature that obviously should have been there in the beginning. There's a reason .Net has them.

        [0] http://openjdk.java.net/jeps/169

        [1] https://cr.openjdk.java.net/~briangoetz/amber/datum.html

      • vaylian 1800 days ago
        True. Java makes it trivial to write cross-plattform code. But we are no longer in the 90s. There are plenty of cross-plattform C++ libraries available that make it easy to write cross-plattform programs. I do not think that this is such a major argument any longer.

        And yes, Java is very feature-conservative.

        • jayd16 1800 days ago
          You might not think it's a valid argument but the thing that you're missing is that others do not want to write cross platform C++. They want to write nicer Java and that's C#.
        • pjmlp 1800 days ago
          Try to compile those C++ libs on Windows and run them on Linux, without recompiling them.

          As strange as it may seem to you, that is how a large set of corporations work.

          • DannyB2 1800 days ago
            Also I would point out that your compiled Java binary apps might run just fine on a platform not existing at the time it was compiled.

            Example: I wrote a Mandelbrot program compiled as a double-clickable JAR.

            Nearly a decade later I find that it runs just fine, albeit more slowly, on . . . a Raspberry Pi.

    • marmaduke 1800 days ago
      It seems like .NET resolves some of the limitations of the JVM (around generics, lowering of float point code, I’m sure there are others). So if you want a managed language VM but some of the magic of C++, .NET might be a nice place to be.
      • pjmlp 1800 days ago
        .NET took the right options from languages like Modula-3 and Delphi, even better now after the Midori improvements.

        Just a bad decision, which was not to bet that strongly into AOT (NGEN was only for faster startups).

        While UWP (and its former incarnation on Windows 8.x) do use AOT, that is still a couple of releases away to join standard .NET tooling.

        Naturally there is also Xamarin and Unity IL2CPP/Bust stacks, but they are special cases.

      • bobbyi_settv 1800 days ago
        > lowering of float point code

        What does this refer to and how is it handled better in .net than in java?

        • marmaduke 1798 days ago
          I read (while considering both for numerical routines) that the CLR could more effectively generate efficient instructions for arithemtically dense code and value types, including for generics, where the JVM uses simpler approach involving type erasure and treats built in types distinctly from user objects. JVM originated for Java which came earlier, so it’s not a fair comparison. And I’m not an expert here.. I stuck to C, CUDA and Oython in the end.
    • cmiles74 1800 days ago
      In my opinion it presents an alternative to Java. The licensing also seems easier to explain; Oracle has really worked hard to make Java licensing confusing.
    • gameswithgo 1800 days ago
      Java with value types and way more control over memory layout, and unsigned integers, and simd intrinsics? Performance is a little better these days even without the simd intrinsics too.
      • dvlsg 1800 days ago
        dotnet core is a pleasure to work with, too. I really appreciate the effort that went into making the CLI nice to use. Things like project init, package management, building, testing, etc.
    • GoblinSlayer 1800 days ago
      Java developers specifically asked for .net to work on linux.
    • GordonS 1800 days ago
      Aside from the numerous reasons already given in this thread, I think the rise of the cloud has an impact - it's never been easier to spin up Linux servers (even for Microsoft shops!), and Windows people having their familiar toolset available has surely led to greater uptake of Linux.
    • zem 1800 days ago
      cross-platform desktop apps
    • bitwize 1800 days ago
      Miguel has always wanted Linux to be open-source Windows. If there's a problem in software engineering or integration, you can rely on him to support and champion whatever approach Microsoft took to solve it. It's telling that his white paper in which he proposes Bonobo, and even more bloated and crufty version of COM for GNOME 1.x, was "Let's Make Unix Not Suck".
  • pjmlp 1800 days ago
    Turbo Vision is back! :) (yes I know, old joke)
    • homarp 1800 days ago
      • cmroanirgo 1800 days ago
        Nice. It makes me reminisce about my first accounting package written in Turbo Pascal (which I might add, survived y2k without a line of code being changed).
    • soapdog 1800 days ago
      I still miss it...
      • copperx 1800 days ago
        I do too. It was incredibly amazing (IDEs were built on top of it!) and ncurses falls short as a replacement.
  • nizmow 1800 days ago
    I wonder if it would be possible to extend this API to have a "GTK" or "Qt" backend, for simple GUI apps.
    • pjmlp 1800 days ago
      Miguel demoed a Xamarin.Forms implementation using it, which is kind of the other way around.
    • jacobush 1800 days ago
      Must be... in fact, it may be a great idea! This API must be simpler, so it must be much more doable than the other way around.
      • nizmow 1800 days ago
        I think I'll take a look at it, my guess is the layouts might be tricky to translate but with some sensible hard coding perhaps not too bad. Sadly the state of C#'s Qt and GTK libraries weren't great last I looked.
        • devbat8712 1799 days ago
          Gtk# is... OK. I've used it a little bit and for the most part it implements everything the C/C++ version does.
  • asveikau 1800 days ago
    curses/ncurses is a really fun library, simple to get going and can produce some good results. I think it's underutilized these days.
  • josephn 1800 days ago
    I have a project idea and I've been trying to find the best way to implement ncurses user interface/experience for mobile screens. If anybody is interested or can offer help/advice them please get in touch. https://gitlab.com/swipe2e
  • starik36 1800 days ago
    This library needs a Forms Designer like in Visual Basic for DOS asap!