DEV Community

[Comment from a deleted post]
Collapse
 
jochemstoel profile image
Jochem Stoel

If you follow me on DEV, you know that for the past month or so I've been on a pilgrimage looking for that language that would allow me to build applications that my end users can just run with a simple click.

Sergio, dude. Look at Electron. Electron is a Chromium window with Node APIs. It does everything you describe and more. It is already platform agnostic, no need to port things anymore. 1 click builds with support for native binaries/modules. Has outstanding well documented I/O and electron apps come as small as a few kb. (all the system needs is 1 single electron executable that runs any app) That's about 2% size of your Hello World application. You can also build all your apps separately (ship electron with them) to make them portable and it will automatically create a trusted installer for you with support for updates.

Just npm install electron.

If you really insist on C# or .NET then you can npm install clr for native dotnet bindings which you can also get to work with .NET Core and mono! You can use this to write and debug .NET code in your devtools as well as load .DLL files at runtime.

Instanciating a Chromium window is optional. If you are writing things that do not require a GUI all the time then simply use electron for all the other reasons.

Dude.

Collapse
 
rhymes profile image
rhymes • Edited

Electron doesn't come without its drawbacks to the end user (though here we're talking more about developer experience than everything else):

  • every app shipping a web browser (big size)
  • a lot of RAM usage

We keep using VS Code as an example of a poster child for great usage of Electron but that's not an app for "regular" users (and has Microsoft's budget behind it).

Most desktop apps are not written by thousands of engineers and most users don't have 16 GB of RAM.

I'm not saying "bad Electron, bad" but I think that in context we should take into consideration both aspects seriously. Slack, which is famously a resource hog, it's an app that non developers might use and complain about.

I don't have hard numbers on this but I think it's likely that not caring about lowering resources occupation also drives the hardware industry (at least for people who can afford upgrading a computer because software developers give up optimizing).

In a sense it's like web programming: we create apps on shiny computers with fast networks and then comes the disadvantaged regular user that's going to curse us because they have a 700$ computer with a slow network.

I think we just do a disservice to everyone by plugging our favorite tool of the day all the time without considering their impact.

On the other side of the argument there's developer velocity and time to market, which are definitely important. I'm just saying everything should be weighed.

Collapse
 
jochemstoel profile image
Jochem Stoel

You don't have to ship Electron in every app. That was the point. Also it is still smaller than his Hello world.

 
rhymes profile image
rhymes

You're not giving me any information that you didn't write before so I'm not sure how to answer this comment but I might have misunderstood it so my bad.

You don't have to ship Electron in every app.

How can you not ship Electron in an app that's based off Electron? You mentioned the possibility of sharing an Electron installation among multiple apps, but how can you be sure the end user already has at least one app? And what happens if the end user uninstalls the app that shipped with Chrome inside of it? Do the others stop working?

 
jochemstoel profile image
Jochem Stoel

Yeah you're right but at least if you have multiple applications, it only requires one electron just like you don't have to install the .net framework for every application that uses it. Basically a global npm install.

And if you delete the.net framework and your application requires a minimum version it will stop working too.

Anyway long discussion, I was only recommending something I like to someone who seemed to be looking for it.

 
rhymes profile image
rhymes

Yeah you're right but at least if you have multiple applications, it only requires one electron just like you don't have to install the .net framework for every application that uses it. Basically a global npm install.

Ok I understand. There's a slight difference though. .NET is guaranteed to be present in every modern Windows installation (setting aside various versions compatibility for a sec), so you might be guaranteed a minimum functionality (and maybe you can then install a powered up .NET version separately and wait for the next restart?).

If you look closely though there's not much to be shown for cross platform desktop apps written on .NET and I think one of the reasons is exactly because .NET on MacOS and Linux doesn't come prepackaged. Another possible reason is that Windows is a big enough market for smaller software vendors to prioritise.

Which, in a sense, it's the reason why Electron apps ship with their own Chrome. Yes, it might be technically possible to use the "shared Chrome", but you risk shrinking the user base to "only users with Chrome version xyz and onwards".

There's no easy answer here, which makes me think that's also one of the reason why people ship web apps instead of desktop apps. They don't want to deal with all of this hassle. The fact that Electron helps bringing "web screens" to the desktop is great by the way, at least for developer velocity and visual coherence for the end user.

I'm sure there's room for innovation in the space of cross platform UI runtimes, for example:

Flutter is also another space where Google is trying alternative approaches to desktop development.

The status quo doesn't appeal to me :D

 
jochemstoel profile image
Jochem Stoel

You are right there is no simple answer but in my experience (my personal opinion) when you want to develop a platform agnostic application you are better off using Electron than trying .NET core to run smoothly on each os. Also, .net core is great and all but not everything you do with .net on windows works on Linux or MacOS.
The System.Speech.Synthesis namespace for instance which is one I use a lot. Electron is a lot more consistent.

 
jochemstoel profile image
Jochem Stoel

This attempt to popularize .Net and C# for this is cute but ultimately going to fail.

 
rhymes profile image
rhymes

This attempt to popularize .Net and C# for this is cute but ultimately going to fail.

I don't think we're discussing to proclaim winners or losers, just to understand more about each platform's and approach's limitations.

I don't use either so I'm definitely learning new things :)

Collapse
 
jochemstoel profile image
Jochem Stoel

Ithink we just do a disservice to everyone by plugging our favorite tool of the day all the time without considering their impact.

I recognize that (I feel this way about React and Angular) When I suggest Electron it is not because it is a 'favorite tool' that I want to insist on.

Collapse
 
yaser profile image
Yaser Al-Najjar • Edited

Let's not compare apples to oranges, .NET apps can be wrapped inside an Electron app too:

github.com/ElectronNET/Electron.NET

Collapse
 
Sloan, the sloth mascot
Comment deleted
 
yaser profile image
Yaser Al-Najjar

My bad, harshass.