Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Electron seems to be the preferred approach these days (much disliked by people who appreciate native apps). That said most Qt apps don't look native all the time either (it comes close enough)


For a beginner (that knows C++) I would think Electron is way more difficult than Qt. With Qt you just: 1. Download the Qt SDK, 2. Start Qt Creator, 3. Open an example, 4. Click Run.

I wouldn't even begin to know where to start with Electron. There are so many web frameworks and they're all badly documented... whenever I have to make a website I usually start off thinking "Right, I'll do it the 'modern' way this time - with React or Vue... and Typescript.. and and do I need webpack? and...??" but there's so much badly-documented half-finished stuff out there I usually end up giving up and doing plain Javascript. Doesn't help that the modern web stack is a total hacky mess.


This is definitely the state of things. It's funny how people talk as if writing a web application is somehow inherently easier and more efficient than native applications. It's most certainly not the case. You have know at least 3 mediocre languages: HTML, CSS, and JavaScript. And then a separate server-side language if you're not a JavaScript fanboy, most likely a templating language server-side, and maybe even a client-side templating language if you're into that sort of thing.

I'd gladly take Qt with C++ any day even though I only know enough C++ to shoot myself in the foot with.


For a long time I thought that C++ was somehow a bad language (because that's the developer-talk-consensus, much like Java), but after I've written a decent amount (something like 100k loc or so as of now) in C++ I reversed my "opinion". C++ allows people to write code that requires intense study to understand (template magic etc.), but writing that code and getting it to work is very hard too, so there is actually very little of that around. Apart from that C++ is a good language which works well for developing applications (and Qt is a very good partner for it). And that's what really matters.

(Another thing that comes to mind is that there is a huge amount of software for testing, analysing, introspecting and debugging C++ applications - I would say that most other ecosystems are lagging behind in that aspect)


I think a lot of the broad criticism of C++ is from people who don't use it professionally and have a superficial understanding of it. Professionals usually have specific criticisms of C++ (based on actual problems) which non-professionals interpret as "everyone hates C++". I use C++ professionally and I'm rarely frustrated by it. The language is getting better over time, which is nice too.


I have the opposite impression. The people I've seen be the most critical of C++ are C++ compiler engineers.


Guess Qt gets more performance?

But more often than not Electron is good enough and there are even approaches to get JS on the desktop with less memory consumption than Electron.

https://github.com/pojala/electrino

https://www.nidium.com/


Why would you even want to use JS on desktop if you have other options available? JS is the choice on the Web, because it's the only choice. It's the choice on Electron, because you can share the code base with Web version or make stuff like editors targeted to JS developers, so they can hack them while using them. But otherwise, it seems like the only worse option you could use for desktop apps is PHP. Why are people doing it to themselves?

Since we're in a submission about Qt: if you really don't want to touch C++ (which is kinda understandable, although C++ with Qt actually isn't that bad), Qt is very well supported in Python. Using them together is a breeze, and if you really do miss the craziness of JavaScript, you can still use it in QML :P

And if QML is what you only care about, you can even wrap it with Rust.


JS is a pretty good option in many cases, easier to support in many platforms and arguably easier to develop and debug. What is not, though, is bundling a whole browser. A JS engine is a couple orders of magnitude smaller than a browser.


I've been a professional JS developer for a few years, doing both in-browser and node-based automation stuff (never desktop apps in JS though, thankfully). What I mean is that while new JS revisions are trying to catch up and become somewhat pleasant to write in, there's still tons of baggage of bad decisions from the past that make this language simply awful when compared to basically any other popular language - and those aren't stagnating either.

Just in order to retain your sanity, you need to use several layers above JS to transpile your code - like JSX when you do UI or TypeScript when you do... well, anything.

I believe that JS is considered easy only because you can get your first impressive results very quickly when combined with HTML and CSS, which makes it easy to not lose your focus when learning. That might make it a good language to learn in, say, primary school on IT lessons - of course, only if there weren't other, better suited stuff available targeting these cases specifically already. Anything else actually makes JS harder than, say, Python. Or Go. Or C#. Or Java. Or even C++ with Qt (although C++ is easily second worse). Or Rust. There's just so much stuff you have to keep in your head while writing JS, it's not worth it. But you have to let go of "I know it, so I'll use it, no matter how well suited it is" mentality, and that can be challenging.


> Anything else actually makes JS harder than, say, Python.

It depends on the setup. I use CoffeeScript 2 which gives me most of what I miss from Python (which was my favorite language for years). And when I go back to Python I miss having a debugger as good as Chrome's, as well as some CS2/ES6 features.

> There's just so much stuff you have to keep in your head while writing JS, it's not worth it.

Can you give me some examples?


C++ is packed with undefined behaviour, complexity and cruft. I find JavaScript and extensions like TypeScript much more pleasant to work with.


> C++ is packed with undefined behaviour

This alone clearly states that you known nothing abou C++ beyond tired old, meaningless clichés about irrelevant stuff you've heard somewhere and are complaining about something you know nothing about.


How? Has C++ eliminated undefined behaviour recently? Yes, you can avoid it but it requires years of experience, a significant cognitive load as you work, linting/testing tools and you have to hope all the libraries you're using plus your team members have the same high standard that you're trying to follow yourself. I used C++ for years and knowing there are other languages out there I have no interest in making life hard for myself.


> How?

Because you're repeatedly showing profound ignorance on very basic aspects of using a programming language.

> Has C++ eliminated undefined behaviour recently?

You are aware that you're parroting on and on about an entirely irrelevant issue, don't you? I mean, any behaviour which has been left undefined in the international standard only means that there is a chance that two implementations may not implement the same obscure aspect exactly alike. And that's perfectly fine because these obscure corner cases shouldn't be used to begin with. That's what undefined behaviour does mean in practice.

But even if you for some obscure and irrational reason care enough to rely on behaviour left undefined then you also go another standard approach: adopt a specific implementation and check how the behavior was implemented.

Additionally, rust and go and python and other programming languages are not defined at all and somehow programmers don't get bothered by the fact that these programming languages are entirely undefined. But somehow you feel differently about a language you clearly know nothing about.


> But even if you for some obscure and irrational reason care enough to rely on behaviour left undefined then you also go another standard approach: adopt a specific implementation and check how the behavior was implemented.

By undefined behaviour, I mean things like null dereferences, buffer overflows, memory leaks etc. that are done by accident and result in serious issues at runtime. I'd rather use a safer language where I can be more productive where possible.

Sounds like you're talking about implementation defined behaviour or unspecified behaviour which are different from undefined behaviour (these three terms are defined in the C++ standard document).

> But somehow you feel differently about a language you clearly know nothing about.

You're not even trying to understand the point you're leaping to attack. You clearly have a chip on your shoulder about something.


Here's 1,605 pages of defined behavior. What language are you comparing it to with more completely-defined behavior that can be translated to efficient native binary code for as many different architectures?

https://www.iso.org/standard/68564.html


C is for sure. You can avoid most of this in C++ by using the standard library and some of the newer language features.


JavaScript has many features that have nothing to do with the language, that make it nice.

Big community, with many learning resources.

Nice package managers, with libraries for basically everything.

Since many people already know JavaScript from working as a web developer, they also have a faster start.


I didn't know about nidium... Thanks!

Is there any project similar to those two, for Windows?


The windows version of nidium is actually on his way :

- Repo : https://github.com/nidium/Nidium/tree/windows-x86

- Screenshot : https://i.stack.imgur.com/5hTqR.png


Microsoft created ReactXP on top of React-Native, never tried it but seemingly it builds for Windows too.

https://microsoft.github.io/reactxp/


Windows 10 only, though... On the other side it allows you to build a web version of your apps (in addition to mobile), which is nice.


The anti-Electron people's complaint isn't really the look as much as performance and mostly start up time. To me I sue several electron apps all day and they have held up well.

RStudio VS Code Discord / Slack (Well slack has not been rock steady)


How's memory usage? I suspect many of us are anti-memory-guzzling rather than anti-Electron.


Well I have 16gb of RAM so it doesn't effect me.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: