11 ms·
Wt – C++ Web Toolkit
- doteka 6y agoWhile certainly impressive, the Hello World example in their documentation is in no way preferable to writing JavaScript.
- cbsmith 6y agoI always liked Wt. I haven't used it in quite a while. What's it like these days?
- cocoa19 6y agoIt's hard to compete with Open Source Libre libraries and lower C++ interest in new developers, not to mention developing in C++ is harder than many other languages. My employer still struggles to this day finding good recent grads remotely interested in C++. In contrast, Java and Javascript skills are easy to find in the market. Edit: Added "Libre"
- rch 6y ago> Wt is licensed under the GNU GPL Version 2 That excludes it from my use, but I believe that license is what is implied by 'Libre' generally.
- cocoa19 6y agoI think you are right, what I wanted to say is free for commercial uses without restrictions like LGPL's dynamic linking requirement. I'm thinking something like MIT or BSD licenses. Not sure if there's a term for this, "permissive" license maybe.
- rch 6y agoYes, that's correct. The term 'permissive' is exactly what you're looking for.
- mehrzad 6y agoI am a recent grad interested in C++ but from my perspective, very few employers want to hire recent grads for C++.
- jonwalch 6y agoInvestment banks and trading shops are always looking for new grads for C++.
- wojtczyk 6y agoAgreed. Also, robotics & controls
- dgfitz 6y agoI can vouch for that.
- ncmncm 6y agoThey can afford to demand competence, and they need it. But they don't always get it. They are the reason it can be hard to hire qualified C++ programmers elsewhere. You compete for the rest who find Wall Street and monopolists both morally repugnant.
- beached_whale 6y agoI would say programming is really difficult and it is hard to find competent(pick an arbitrary line in the sand) for any skill let alone programming. Pick a field, and the web is stuffed full of people with battle stories of cleaning up after other people. This is actually a point or two against C++ as the breadth of it is so large. The trick, as in any practice, is to find motivated people willing to learn that are not stubborn in their set ways.
- einpoklum 6y agoSure, if you have an anti-social bent and want to profit almost directly from usury, arbitrage and speculation.
- zelly 6y agoC++ people don't do CRUD webshit. C++ is for compilers, HFT, machine learning, browsers, search engines, robotics. When C++ touches "the web" it's in the form of something like Envoy or HAProxy, not exactly application layer. For CRUD webshit, there are literally hundreds of options out there that largely automate the entire process (Rails/Django/Spring). There is no reason to use C++ for it not just because of the timesink but because the lack of safety makes it an aggressively bad idea. You would get all kinds of "I thought that wasn't a problem in the 21st century anymore" type of problems.
- giancarlostoro 6y agoYou are better served using D and Vibe.d or other D web frameworks if you really want a compiled web stack. Also the other obvious choice is Go and probably Rust but I havent found a web framework for Rust that doesnt annoy me to no end yet.
- fbmac 6y agoThat's the illusion that got me into C. Reality I found is, where I live at least, C is for legacy code and code that runs in very bad hardware.
- zelly 6y agoWhat illusion are you talking about?
- smt1 6y agoPeople do need to write UIs in C++ though (sometimes as frontends for some of the purposes you mentioned), and Qt is probably the most used UI toolkit for C++. Wt is basically Qt for the web. I've used a lot of UI toolkits across many languages, and Qt with modern-ish C++ is fairly productive, doubly so if you're slapping something together for an existing C++ codebase you have.
- roywiggins 6y agoThis is the exact use-case where I've used Wt. Existing C++ codebase, needs an admin interface, needs to be accessible over the corporate intranet. Wt is perfect for that.
- varbhat 6y agoWhat's the real advantage of using this over HTML template rendering?
- rsecora 6y agoI will try to be brief and go to the point. Wt is different to templating. It's server side rendering and the widgets communication is transparent, based on slots and receivers in the server side. If you came from java it has similarities to Vaadin. It has more goodies, websockets, DB...
- roywiggins 6y agoYou don't have to write JavaScript, and it generates a page that acts like an SPA and does all the AJAXy stuff for you in the background. So you can just say "I want a button that does this server action on click" and it manages all the communication between the browser and the back end. It even gracefully degrades to full page reloads if the user doesn't have JavaScript turned on.
- Jeaye 6y agoI tried using Wt for a site almost a decade ago, it seems. The layout managers would make the site so terribly jittery that it could cause motion sickness. My use case for Wt at the time as "I know C++ well and I don't want to learn anything else." I don't think I'll ever have a better use case for it and I don't think that one was very good to begin with. The best use case I can imagine is something like "We have a lot of existing C++ code which we need to turn into a web app." But even then, why does the C++ code need to manage the DOM? It almost certainly doesn't.
- afranchuk 6y agoI used Wt about a year ago for an application at work. I was able to write a GUI program that could be accessed at a web address or with a native Qt application, and Wt was equivalent enough (API-wise) that I was able to template between the two. Really neat actually. There was one place where the GUI was defined and you could choose whether you wanted web, native, or both! Only stumbling block was when I needed some opengl (webgl), but with a fairly minimal abstraction I was and to get that working in both two. Wt felt very polished and worked exactly as I expected.
- InfiniteRand 6y agoA lot of the comments question the use case but I think your story captures the ideal use case, a hybrid C++ / web app where you want to or need to share some of the functionality between web / c++ sides
- roywiggins 6y agoIt's not a bad way to build a web interface for a C++ application that needs to be configured over an intranet. It makes tying "click on a button on a web site" to "run an administrator action on my application" very easy, and you can use your Qt muscle memory to lay out a simple admin interface with relatively little mucking about. You can do all that with CGI scripts or whatever, but if you already have a bunch of C++ running on the server it isn't nuts to use Wt to build your CRUDy admin interface.
- beached_whale 6y agoIn addition, I have used the templating in the library and it works really well. Let the UI/UX people do their thing and get the best performing back end.
- guruz 6y agoA propos Qt. There is Qt for Web Assembly. https://www.qt.io/qt-examples-for-webassembly https://www.qt.io/qt-examples-for-webassembly And WebGL streaming https://www.qt.io/blog/2018/11/23/qt-quick-webgl-release-512#what-is-webgl-streaming https://www.qt.io/blog/2018/11/23/qt-quick-webgl-release-512...
- marta_morena_25 6y agoI find it irritating that even after reading their front-page and the "How you can use WT" I still have no clue what it is supposed to be. Is this an embedded browser? Is it a C++ app GUI that allows you to use HTML like construction? Is it an emscripten application? How can it work without JS enabled? Is it compiled into pure WebASM? What the heck do they mean by connection? What connection? What does have PDF and DB to do with all that? Etc. Very poor marketing imo. After reading all this I have even less clue what it is supposed to do.
- roywiggins 6y agoIt works without JavaScript because it can render everything server-side. If the user has JavaScript it uses websockets or Ajax to fetch updates from the server, but if it doesn't have those it can just reload the whole page like you would with a CGI application. "Qt, but for web applications" would be a short and basically accurate descriptor. You slot together widgets in C++ and it works out how to lay them out and connect actions taken by the user to your event-handling code, which lives on the server. The PDF thing is for rendering reports to PDF, instead of HTML. Not useful unless you're in a corporate sort of space, but when you want a PDF report you do want something like that. The DB thing is an ORM that makes basic CRUD operations on your database easier.
- hellofunk 6y agoOh strange, I completely assumed from the start that it was referring to front end C++ using Webassembly, similar to how some rust libraries do it. Never occurred to me this is server side.
- chrismorgan 6y agoWt comes from many years before WebAssembly.
- marta_morena_25 6y agoYeah it dawned on me the moment I hit sent... That this is probably something like ASP.NET for C++. Probably some people still need that :). Legit use case, just I think they need to work a lot on their messaging.
- shayas 6y agoWhy some people can't liberate themselves from C++?
- PaulDavisThe1st 6y agoBecause we're already free.
- znpy 6y agoBest comment
- vikinghckr 6y agoBecause: a) Modern C++ is amazing. b) The highest paying software jobs require C++.
- imafish 6y agoa) it really isn't. b) yes, COBOL developers are also highly paid. does not make the language amazing.
- vikinghckr 6y agoa) It really is. b) I didn't say point (a) is why modern C++ is amazing. But it is one of the motivations for learning modern C++.
- mister_hn 6y agoBecause the alternatives aren't better
- pjmlp 6y agoBecause right now there is no better companion for my Java/.NET/Node tooling and I am not touching C unless obliged to do so. When NVidia, Microsoft, Oracle, Apple and Google put other native languages on their toolbox I will consider them for production code.
- jokoon 6y agoWait, is this using http/html, or something else? I'm not sure I understand the "web" part in this.
- nephanth 6y agoIt is. But it is abstracting over http/HTML/JavaScript/rpc(ajax) with c++ classes
- c-smile 6y agoAm I right that this is close to ASP.NET thing <asp:textbox text="hello world" runat=server /> In particular to that runat=server part? So widget gets rendered to HTML on server side with events sent to it from client? That may work for logical events like click but not for mousemove (too expensive) ...
- stjo 6y agoMaking a front end library/framework/toolkit without screenshots and example code should be made punishable by law.
- Jaxan 6y agoThere is a link to the gallery. That suffices, right?
- beached_whale 6y agoThe whole site is run on it, and your working examples are there just had to click on documentation https://www.webtoolkit.eu/wt/documentation https://www.webtoolkit.eu/wt/documentation
- stjo 6y agoOooh, that's nice
- ssutch3 6y agohttps://www.webtoolkit.eu/widgets https://www.webtoolkit.eu/widgets
- mjs33 6y agoIs this just CGI?
- pgquiles 6y agoKind-of, but you write webapps as if you were writing desktop apps: widgets, layouts, etc. Wt can be compiled to its own webserver (which you would use directy if on an embedded device oruse behind a reverse-proxy for other cases), or you can compile it to a FastCGI module you can run with Apache.
- briandilley 6y agopainful
- dang 6y agoIf curious see also 2013 https://news.ycombinator.com/item?id=5997034 https://news.ycombinator.com/item?id=5997034 2010 https://news.ycombinator.com/item?id=1098282 https://news.ycombinator.com/item?id=1098282 2009 https://news.ycombinator.com/item?id=886900 https://news.ycombinator.com/item?id=886900
- nikki93 6y agoWith 'modern C++' you can make APIs way nicer than the Java-like API going on here. Lambdas really help, along with RAII which has already been around. I have an API going where the following syntax creates a div with a 'toolbar' class and a toggle button with the 'edit' class and updates the DOM (C++ running in WASM, using IncrementalDOM for the DOM access): ui.div()("toolbar")([&]() { ui.button()("edit")("selected", editing)("click", [&](emscripten::val target) { editing = !editing; }); }); This works by having `.div()` etc. return an `Elem` type whose constructor opens an HTML element and destructor closes it, with various overloads of `operator()` letting you set attributes, bind events or add child elements. Here's a video of some results with C++ and CSS: https://twitter.com/snikhilesh/status/1279913032471031809 https://twitter.com/snikhilesh/status/1279913032471031809 I should do a writeup about this soon...
- jordigh 6y agoSo what do the compiler errors look like when you mess this up? Say, you use the wrong argument passing for one of the lambdas.
- suls 6y agoExactly what I came here to say. The error messages produced by g++ for anything template related are a really difficult hurdle to overcome as a beginner. I am sure once you mastered it, it does make sense -- but right now it's a source of frustration for me.
- nikki93 6y agoI haven't used GCC in a while, but clang's template error msgs are way better than MSVC's in my experience. Still not like--good--haha. Like not Elm-level.
- pjmlp 6y agoconcepts will fix that. For the time being, any library writer can improve their own error messages using a mix of constexpr if, static_assert and enable_if.
- einpoklum 6y agoSo, Wt is about having the server do a bunch of computational work for rendering the UI. Now, I'm not a web developer, so I may be talking nonsense, but I don't see how that's reasonable: 1. It doesn't scale, or if you're rich - it's annoying to scale. 2. It interferes with the client/user's ability (albeit theoretical) to decide how they want to present the information 3. It seems to go against what are, or used to be, the principles of the web: Interlinked, clear-text, markup which the client renders as it sees fit.
- pgquiles 6y agoDo you realize what Wt does is exactly the same thing PHP, Rails and others do and have been doing for decades? So: 1. It does scale and it's easy to scale. In fact, one of the use cases of Wt is massive applications (e. g. Facebook apps) 2. No, it does no interfere with client's ability to decide how they want to present the information. What Wt does is the same thing any other web toolkit is doing: gracefully degradation, fallback, etc depending on your browser, browser version, and whether you have JavaScript enabled or not 3. How is Wt's output not interlinked, clear-text, markup which the client renders? It seems you only know Angular, React and other client-side toolkits. The server-side approach has been (an is still) working for decades, do not disregard it.
- roywiggins 6y agoThe Wt backend spits out HTML/JS (or sometimes PDF or svg for charts), like any other server-side framework. It's not replacing the browser's renderer.
- einpoklum 6y ago<html> <body> <img src="/path/to/my/rendered_output.png"> </body> </html> This is also spitting out HTML...
- piyush_soni 6y agoIsn't this like C# with ASP.Net? Or is there any other benefit to it?
- pjmlp 6y agoASP.NET doesn't run everywhere where there is a C++ compiler, including embedded devices.
- juangburgos 6y agoWrDesigner author here. I started the QtDesigner-like tool for Wt because I had a project where I needed to expose some existing C++ code on to the web. In the end I never used it. As I learnt web technologies, I found much flecible and easier to expose an API to the web using QWebChannel and then do the frontend with one of the existing frameworks (Vue, React, etc).