News for hackers. Stuff that matters.
Re:Modern Javascript: Everything you missed over the last 10... by BrissyCoder on Saturday May 15, 2021 @10:28PM (#27170719)
> simplicity of the web technologies in general

Are we looking at the same web technologies here or are you from an alternative universe?

Re:Modern Javascript: Everything you missed over the last 10... by rtpg on Sunday May 16, 2021 @03:12AM (#27171845)
Try writing a GUI with other toolkits. Hours of tweaking random XML to try and figure out why some constraint solving thing just isn't working...

Despite all the mess, I have an easier time getting buttons on a screen and doing things sanely (once all the fuss is set up) compared to trying to get the ball rolling in Qt/GTK/etc (especially if you're not using Java or C++)

Re:Modern Javascript: Everything you missed over the last 10... by kaba0 on Sunday May 16, 2021 @04:07AM (#27172042)
Absolutely not true. Windows forms, WPF, JavaFX, Swing all are much more productive than the vanilla web. Like, how many lines of code does the most basic vbox/hbox thing requires in web technology? Many of them even have dragndrop ui creations, and this XML hatred is downright stupid at this point. How about criticizing the technology and not a random medium for that? Is writing something stupid in JSON inherently better?

HTML is simply a terrible GUI base, JS is quite great nowadays and CSS would be great, but has to provide way too much of what HTML should be doing. But the web ui frameworks are just barely getting at the level of where native frameworks have been in a decade.

Re:Modern Javascript: Everything you missed over the last 10... by ath92 on Sunday May 16, 2021 @04:13AM (#27172071)
That example you mentioned would be just a couple of lines of html with css (which you could inline if you wanted), and there are plenty of drag and drop tools for the web (WebFlow is a modern example, but they have been around for decades).
Re:Modern Javascript: Everything you missed over the last 10... by kaba0 on Sunday May 16, 2021 @04:50AM (#27172257)
Why would it need any sort of CSS? Isn’t HTML supposed to be responsible for the structure of a webpage? And of course it can be done, but if we do something like hbox inside a vbox inside a vbox, the resulting code will be ugly as hell (perhaps Webcomponents will help a bit here?). Like, what is the point of HTML at that point? To spam divs (pun sort of intended)?

And there are plenty of other “layouting primitives”, all of which are quite cumbersome. And due to HTML encoding some form of semantic meaning only (though seldom used even for that), drag n drop tools can’t generate easy to read/modify output. Also, without js frameworks, you can’t really just embed another component into it trivially.

And I’m not trying to shit on web tech, JS has absolutely overcome its shitty past, and is quite a likable language nowadays, and CSS is an extremely powerful and expressive system (though this latter is due in part to how shitty html is). My only gripe is with HTML that is simply not fit for the task (as it was never meant for that).

Re:Modern Javascript: Everything you missed over the last 10... by yoz-y on Sunday May 16, 2021 @04:55AM (#27172282)
> Isn’t HTML supposed to be responsible for the structure of a webpage?

If by structure you mean things like hbox/vbox then no, html is not supposed to do that. HTML should only represent the semantic structure.

Re:Modern Javascript: Everything you missed over the last 10... by kaba0 on Sunday May 16, 2021 @04:59AM (#27172301)
Yeah I know, but that is because it was meant for documents. It is not a great fit for web applications.
Re:Modern Javascript: Everything you missed over the last 10... by danShumway on Sunday May 16, 2021 @01:03PM (#27175090)
Applications aren't special.

There are a couple of exceptions for interfaces that are genuinely unconventional, or that deal with multiple spacial dimensions, or that are primarily representing graphs and visual/audio data. But most interfaces should be representable in pure text.

This argument that "the web is only for documents" is missing the point that most applications are just interactive documents when you really break down their UI. A labeled tree is a fine way to represent user-facing state for most apps, and most apps would benefit from exposing a more semantic interface to users that was easier for them to manipulate and read programmatically.

Re:Modern Javascript: Everything you missed over the last 10... by eurasiantiger on Sunday May 16, 2021 @05:50AM (#27172507)
What is a better fit for web applications?
Re:Modern Javascript: Everything you missed over the last 10... by kaba0 on Sunday May 16, 2021 @06:12AM (#27172592)
Nothing, because web applications are by definition html css js. Though canvas-based solutions can circumvent the layouting problem, but at the price of reinventing everything in a non-standard way.
Re:Modern Javascript: Everything you missed over the last 10... by onethought on Sunday May 16, 2021 @06:55AM (#27172774)
The layout problem isn’t css... it’s the user platform is anything from a tiny vertical screen to a giant horizontal one.

Swing, Qt, et al do not have great answers to this problem, and definitely not superior ones than css.

Re:Modern Javascript: Everything you missed over the last 10... by mpfundstein on Sunday May 16, 2021 @12:23PM (#27174721)
qml is quite awesome. hands down! its a joy to work with.

but I agree in general with your statement.

Re:Modern Javascript: Everything you missed over the last 10... by rtpg on Sunday May 16, 2021 @08:13PM (#27178596)
Drag n drop UIs don't really help when you have too much dynamism (like "oh only have this button appear in these conditions", "do this here", etc). And I would say that box layout offered by CSS is much nicer than the constraint layout system _when you have a lot of dynamism_.

Like I wouldn't want to have to deal with an interfrace like facebook in native stuff. I don't think it's impossible, but I feel like it would require a lot more up-front design and correct engineering.

You're right about XML being a medium, just kinda my memories of working with this stuff.

Re:Modern Javascript: Everything you missed over the last 10... by kaba0 on Monday May 17, 2021 @10:47AM (#27184056)
> Drag n drop UIs don't really help when you have too much dynamism

Yeah, its true — though you can leave an area empty where you will dynamically load one from a set of already drag’n’drop created layouts.

Re:Modern Javascript: Everything you missed over the last 10... by hnbad on Monday May 17, 2021 @07:13AM (#27182185)
> Like, how many lines of code does the most basic vbox/hbox thing requires in web technology?

CSS:

    .vbox, .hbox { display: flex }
    .vbox { flex-direction: column }
    .vbox > *, .hbox > * { flex-grow: 1 }
HTML:

    <div class="hbox">
      <div class="vbox">
        <button>Top left</button>
        <button>Bottom left</button>
      </div>
      <div class="vbox">
        <button>Top right</button>
        <button>Bottom right</button>
      </div>
    </div>
Or was that a rhetorical question?
Re:Modern Javascript: Everything you missed over the last 10... by noduerme on Sunday May 16, 2021 @07:16AM (#27172864)
Such a great point. HTML is a terrific way to write documents and TERRIBLE way to lay out applications - especially for lots of different screen sizes. It's not surprising at all to see Google embracing Canvas now to underpin Docs; basically they are admitting that it would have been better to write the whole program in a Java VM or in Flash than to rely on the browser for layout. This is patently obvious to anyone who builds large web applications. Ten years ago we had ASWing, JSwing and plenty of other actual frameworks where you didn't have to diddle around with tons of logic embedded in templates which were embedded in other logic; but thanks to Apple we're still saddled with this wretched Javascript/HTML paradigm that was never meant to do much more than inline some animated GIFs back in the 90s. Yes, it's gotten better (I've been doing this since the 90s, so I know). But it's so inelegant. To some degree this is just a problem with open web standards. It would be better if any one company actually had dominated to the point where they could write a closed standard, because at least it would be coherent and cross-platform. It was a lot easier to write a web app in 2010 than it is now, and it pains me to think how many hours I could have avoided reinventing the wheel if Flash had been allowed to stick around. Any app written entirely now on canvas is just replicating a VM that already existed a decade ago in what was by then a much more mature ecosystem - and was faster then than canvas or WebGL is now.

If I had to pick a stack to do a new web app entirely in canvas, I'd probably choose to port a ton of interface components from AS3 into PixiJS... but the point is, where have we gotten? Ten years from now we'll be writing apps the way they were written in 2010 -- inside a black box in a canvas or VM. The HTML5/JS revolution has been a sham from the start, just a way for one corporation to dismantle another with the side benefit of forcing all of us to rewrite our code from scratch in a crappier language.

Re:Modern Javascript: Everything you missed over the last 10... by friend-monoid on Sunday May 16, 2021 @07:43AM (#27172984)
I'm not sure I buy the idea that "efficient and easy tooling around a technology makes the technology". We all went through the same Dreamweaver pains.
Re:Modern Javascript: Everything you missed over the last 10... by kaba0 on Sunday May 16, 2021 @07:59AM (#27173068)
How come the minuscule userbase of native frameworks have better tooling than the numero uno popular web? It may mean that there is a technical reason in the background.
Re:Modern Javascript: Everything you missed over the last 10... by goto11 on Sunday May 16, 2021 @09:33AM (#27173597)
They solve a simpler and more constrained problem which makes it easier to make tools. Something like Windows Forms are basically WYSIWYG - you drop some controls on a canvas and now you have a GUI. But the GUI will not gracefully adapt to different screen dimension from large monitors to mobile.
Re:Modern Javascript: Everything you missed over the last 10... by pseudalopex on Sunday May 16, 2021 @04:59PM (#27176969)
Native frameworks support flexible and resolution dependent layouts too.
Re:Modern Javascript: Everything you missed over the last 10... by kaba0 on Sunday May 16, 2021 @06:25PM (#27177602)
Responsive layouting is an orthogonal problem.
Re:Modern Javascript: Everything you missed over the last 10... by goto11 on Monday May 17, 2021 @05:54AM (#27181681)
Orthogonal to what?
Re:Modern Javascript: Everything you missed over the last 10... by pmontra on Monday May 17, 2021 @04:28AM (#27181210)
30+ years of history?
Re:Modern Javascript: Everything you missed over the last 10... by kaba0 on Monday May 17, 2021 @10:51AM (#27184112)
Interestingly enough JavaFX is much younger than the web, and is quite niche, yet it has SceneBuilder.
Re:Modern Javascript: Everything you missed over the last 10... by pmontra on Monday May 17, 2021 @03:07PM (#27187049)
It's younger than the web but much older than the current bunch of frontend technologies. JavaFx is from 2008 [1]

Anyway, that's not very important.

What web apps never had is a visual app builder as popular as the first Visual Basic for Windows 3. We had some tools like that (example Jwt [2]) but none of them got a critical mass of users. Maybe it's difficult to match Visual Basic's success because Microsoft controlled the tool, the operating system and the language. If this is the case the only current candidate is Google, because of Chrome. They are investing on Flutter and Dart now but making them prosper on the web looks like a uphill battle. Much easier on Android.

[1] https://en.wikipedia.org/wiki/JavaFX

[2] https://en.wikipedia.org/wiki/JWt_(Java_web_toolkit)

Re:Modern Javascript: Everything you missed over the last 10... by jcelerier on Sunday May 16, 2021 @02:39PM (#27175942)
> I have an easier time getting buttons on a screen and doing things sanely (once all the fuss is set up) compared to trying to get the ball rolling in Qt/GTK/etc (especially if you're not using Java or C++)

ah, yes, the famous difficulty of getting buttons on a screen in Qt https://streamable.com/bs5fxk

Re:Modern Javascript: Everything you missed over the last 10... by einpoklum on Sunday May 16, 2021 @04:02PM (#27176553)
I agree that it's pretty simple to get a button on screen in Qt, but your linked video presents it as horribly complicated. And requiring an IDE to do it is pre-admitting it's complicated.

By the way - Qt and GTK are super-outdated ways to do GUI in C++. Popular, but outdated.

Re:Modern Javascript: Everything you missed over the last 10... by jcelerier on Sunday May 16, 2021 @05:33PM (#27177200)
> but your linked video presents it as horribly complicated.

... could you precise that more ? I'm literally just making "new project" > design view > search for the button component > drag'n'drop it ? How can it get more simple ?

(opening a text file and writing "Button {}" is definitely more complicated if we're talking about teaching to beginners)

Re:Modern Javascript: Everything you missed over the last 10... by bryanrasmussen on Monday May 17, 2021 @03:02AM (#27180741)
>(opening a text file and writing "Button {}" is definitely more complicated if we're talking about teaching to beginners)

if teaching beginners to programming sure, if teaching a programmer beginning QT development no.

Re:Modern Javascript: Everything you missed over the last 10... by jcelerier on Monday May 17, 2021 @04:28AM (#27181206)
I disagree, the first case is discoverable, the second isn't at all. But apparently no one cares about discoverability of tools in 2021..
Re:Modern Javascript: Everything you missed over the last 10... by bryanrasmussen on Monday May 17, 2021 @06:12AM (#27181832)
I mean the second case is generally discoverable for a programmer because there will documentation of a language or API. I believe people are generally aware of discoverability of documentation in 2021.
Re:Modern Javascript: Everything you missed over the last 10... by jcelerier on Monday May 17, 2021 @08:17AM (#27182593)
> I believe people are generally aware of discoverability of documentation in 2021.

as someone who teaches programming in university, that's definitely not true, less than 1 in 20 students has the reflex of looking for any kind of documentation (even after showing it to them)

Re:Modern Javascript: Everything you missed over the last 10... by bryanrasmussen on Monday May 17, 2021 @08:36AM (#27182734)
well I'm discussing what is easiest for working programmers, although it's true I do hear about there being a bunch of really bad ones out there so maybe I am just assuming too much.
Re:Modern Javascript: Everything you missed over the last 10... by presentation on Monday May 17, 2021 @08:17AM (#27182589)
Just that starting modal with 6 steps to choose various configuration stuff would probably throw a beginner into a loop for a while, even if you could just skip it all. Maybe if this IDE wanted to be beginner friendly, they ought to consider just having reasonable defaults and letting power users change them later - like how web tools tend to be designed these days.
Re:Modern Javascript: Everything you missed over the last 10... by hnbad on Monday May 17, 2021 @07:01AM (#27182116)
There are visual editors for React. Pretending QT is easier than web technologies because it's easier to drag a component in a visual editor than type text in a code editor is comparing editors, not UI technologies.
Re:Modern Javascript: Everything you missed over the last 10... by jcelerier on Monday May 17, 2021 @09:23AM (#27183089)
Are you saying that React is easier than this purely code-wise: https://qmlonline.kde.org/
Re:Modern Javascript: Everything you missed over the last 10... by hnbad on Monday May 17, 2021 @11:51AM (#27184838)
It's about the same but you can do this with minimal HTML and CSS using a basic CSS keyframe animation.
Re:Modern Javascript: Everything you missed over the last 10... by indigo945 on Sunday May 16, 2021 @04:16PM (#27176663)
What do you feel is a more "modern" way to do a GUI in C++?

As an aside, do "modern" developers still write GUI applications at all, since everything is on the web anyway these days?

Re:Modern Javascript: Everything you missed over the last 10... by krapht on Monday May 17, 2021 @02:46AM (#27180667)
Is this a joke? There's a whole world of software out there that isn't web based. Anybody who hasn't switched to a Chromebook uses them every day.

I even write terminal user interfaces sometimes to interact with servers that don't have a desktop environment installed.

Re:Modern Javascript: Everything you missed over the last 10... by cat199 on Monday May 17, 2021 @08:56AM (#27182871)
if you reread, this is what the parent is asking of the grandparent, in less nice terms.
Re:Modern Javascript: Everything you missed over the last 10... by einpoklum on Monday May 17, 2021 @01:26PM (#27185869)
Well, the question of what's "modern" in C++ is both deep and contentions. But I won't shirk the question...

You want to be utilizing the features C++11, C++14 and maybe even newer versions of the standard allow you to use, to avoid unnecessary boilerplate, repetition, and arcane-ness of syntax and semantics.

Similarly, the GUI toolkit should not be based on C-like or C++98-like design patterns, when newer versions of the standard allow replacing them with more convenient patterns.

Here's one example, from the Nana C++ GUI toolkit:

  #include <nana/gui.hpp>
  #include <nana/gui/widgets/label.hpp>
  #include <nana/gui/widgets/button.hpp>

  int main() {
      nana::form form;

      nana::label label{form, "Hello, <bold blue size=16>Nana C++ Library</>"};
      label.format(true);

      nana::button button{form, "Quit"};
      button.events().click( [&form]{ form.close(); } );

      form.div("vert <><<><weight=80% text><>><><weight=24<><button><>><>");
      form["text"] << label;
      form["button"] << button;
      form.collocate();
 
      form.show();
 
      //Start to event loop process, it blocks until the form is closed.
      nana::exec();
  }

This is not perfect IMHO; for example, I don't really like the confusing div string with the many < and > signs. But you can put this in a text editor, build it with `g++ -I/path/to/nana/includes -L/path/to/nana/libs -lnana` - and it will just work, on various platforms. No secret sauce, no need for a bunch of IDE dialogs or any special configuration or action.
Re:Modern Javascript: Everything you missed over the last 10... by jcelerier on Monday May 17, 2021 @02:31PM (#27186536)
Here's a quick port to Qt (except for the <> thing which I did not really understand after a cursory reading of its docs)

    #include <QtWidgets>

    int main(int argc, char **argv) {
      QApplication app{argc, argv};
      QWidget widg;
      QVBoxLayout form{&widg};

      QLabel label{
          R"(Hello, <span style="font-weight: 600; font-size: 16pt; color: blue;">Qt C++ Library</span>)"};

      QPushButton button{"Quit"};
      button.connect(&button, &QPushButton::clicked, [&widg] { widg.close(); });

      form.addStretch(0.1);
      form.addWidget(&label);
      form.addStretch(0.7);
      form.addWidget(&button);
      form.addStretch(0.2);

      widg.show();

      app.exec();
    }
Builds with

    g++ example.cpp -I/usr/include/qt/ -I/usr/include/qt/QtWidgets -fPIC -lQt5Widgets -lQt5Core
Here's also how the two programs behave in practice: https://streamable.com/brltmc

tl;ds: now that I saw it in action, I know I can instantly ignore anyone who says that nana is a suitable replacement for Qt.

Re:Modern Javascript: Everything you missed over the last 10... by alibarber on Monday May 17, 2021 @05:50AM (#27181650)
There is a wide world of applications and development that don't have anything to do with the web.

The films you watch on TV or at the cinema were not created (edited, VFX) using a web browser for a start, and the User Interfaces to those applications are pretty Graphical by anyone's definition...

Re:Modern Javascript: Everything you missed over the last 10... by hnbad on Monday May 17, 2021 @07:06AM (#27182135)
As a counter point: plenty of desktop software embeds web technologies these days and even AAA games occasionally use them. I think Battlefield was a prominent example for React being used in AAA games for UIs. The Horizon TV streaming box also had a UI written in React (rendering to canvas for performance using their custom Chromium build I think, but they wrote it so the UI could also be rendered to the DOM so they could use it in their web version).

Not disagreeing with what you said, but "not having anything to do with the web" isn't as clear cut as it used to be and web technologies are increasingly showing up in unexpected places.

Re:Modern Javascript: Everything you missed over the last 10... by jcelerier on Monday May 17, 2021 @05:58AM (#27181719)
> The films you watch on TV or at the cinema were not created (edited, VFX) using a web browser for a start

to add on this, the reference UI toolkit for building VFX tools is Qt. Maya, DaVinci, Lightworks, Nuke... are all Qt-based.

https://vfxplatform.com/

Re:Modern Javascript: Everything you missed over the last 10... by cies on Sunday May 16, 2021 @03:46AM (#27171965)
If not using C++ with Qt, Qt is a bit harder to get going. But I honestly dont think that building a UI with JS/HTML/CSS is easier than in C++/Qt.

But then the Qt UI:

* needs to be (re)compiled for each platform

* needs to be re-shipped on each change

* is not a client-server application (all runs on the client)

* has "desktop styling" by default

Re:Modern Javascript: Everything you missed over the last 10... by klausjensen on Sunday May 16, 2021 @03:57AM (#27172003)
Agreed wrt other GUI toolkits.

I think of it like democracy. It is ugly and terrible, but still better than all the other options.

Re:Modern Javascript: Everything you missed over the last 10... by kwanbix on Sunday May 16, 2021 @06:00AM (#27172556)
I imagine you never used Delphi, VB, or even Lazarus?
Re:Modern Javascript: Everything you missed over the last 10... by kodah on Sunday May 16, 2021 @10:29AM (#27173950)
Having worked on both desktop and web UIs the problem you're describing occurs in both worlds. Usually with web you run into it when you're dealing with a more sizeable app, or fancier things you want to do with your framework.
Re:Modern Javascript: Everything you missed over the last 10... by 1vuio0pswjnm7 on Sunday May 16, 2021 @03:58PM (#27176529)
Sounds like "developer productivity" could be increased by not having to create GUIs. As an end user, I will happpily accept and in fact prefer text-based, keyboard-driven interfaces.
Re:Modern Javascript: Everything you missed over the last 10... by zodiakzz on Saturday May 15, 2021 @11:30PM (#27170961)
I am a senior web developer with 12 years of experience, also perplexed by that statement.

Edit: The React repo is 3 million+ lines of code, written in its own niche language...

Re:Modern Javascript: Everything you missed over the last 10... by brundolf on Sunday May 16, 2021 @03:24AM (#27171888)
There are different definitions of "simplicity". The entire stack top to bottom may not be simple, but if the developer experience is simple (which it can often be on the web- that's a major driver of the web's prevalence as a platform), that can be what matters.

I have a theory that the people who go on about how the web ecosystem is too complicated are either 1) web developers who are nostalgic for the jQuery days (and have selective memories about those days), or 2) non-GUI developers who enjoy the theoretical virtues of a QT or a GTK but have never actually had to work on a complex GUI, and so can't appreciate the incredible benefits the web has over those other platforms.

Re:Modern Javascript: Everything you missed over the last 10... by kwanbix on Monday May 17, 2021 @01:57AM (#27180455)
Maybe you are too young, but there was a time were we used RADs (Rapid Application Development) environments like Delphi, VisualBasic, Visual C++, etc. Those solutions which are from 1990s, are still years ahead in simplicity vs what you need to do to build a full web solution today (front-end and backend). Of course the web has many other benefits, like 0 install, runs everywhere, always updated, etc., but calling web development simple is just crazy in my humble opinion.
Re:Modern Javascript: Everything you missed over the last 10... by kaba0 on Sunday May 16, 2021 @04:08AM (#27172047)
What are the incredible benefits of the web? Have you worked on a complex QT app?
Re:Modern Javascript: Everything you missed over the last 10... by subw00f on Sunday May 16, 2021 @11:13AM (#27174238)
I have worked with both, including Widgets and Quick. I wonder why you think Qtcom is focusing development on Quick, which uses QML (JSON-like syntax) and JavaScript (ES6), while declaring Widgets "feature complete", mostly releasing minor fixes, in other words, keeping it stagnated. The obvious answer for me without getting into Mobile vs Desktop development is: it's easier to get new professionals to use technology as popular as JS (or any other web related stuff), and definitely cheaper for companies to hire said professionals, therefore making it a easier pick for new projects. To summarize the benefits: easier for junior devs to use and because of that overall cheaper/faster deliveries. Note that I'm not saying anything about quality.
Re:Modern Javascript: Everything you missed over the last 10... by pseudalopex on Sunday May 16, 2021 @04:29PM (#27176760)
Junior developer doesn't mean a developer who just knows JavaScript. Cheaper developers doesn't mean faster or cheaper delivery in the long run. And I don't think brundolf meant cheaper developers.
Re:Modern Javascript: Everything you missed over the last 10... by eurasiantiger on Sunday May 16, 2021 @05:51AM (#27172514)
I have seen a LOT of Qt apps and 100% of them had worse UI than your average web app.
Re:Modern Javascript: Everything you missed over the last 10... by pseudalopex on Sunday May 16, 2021 @04:32PM (#27176785)
I've seen lots of Qt apps. Most of them have been much better than the average web app.
Re:Modern Javascript: Everything you missed over the last 10... by ramchip on Sunday May 16, 2021 @03:37AM (#27171938)
Where do you get that figure from? I'm looking at the add/delete statistics for instance:

https://github.com/facebook/react/graphs/contributors

It doesn't seem possible for this to add up to 3M lines of code?

Re:Modern Javascript: Everything you missed over the last 10... by shakow on Sunday May 16, 2021 @07:03AM (#27172803)
Indeed, tokei gives me ~400 000 lines, including ~310 000 LoC.
Re:Modern Javascript: Everything you missed over the last 10... by spookthesunset on Sunday May 16, 2021 @11:41AM (#27174393)
In my 20 years as a developer I’ve learned that the more polished something looks on the surface, the more complex the codebase under the hood becomes. Things are simple to the end user because of all that complexity.
Re:Modern Javascript: Everything you missed over the last 10... by cryptos on Tuesday May 18, 2021 @02:50AM (#27191891)
That is my experience, too. I worked on a SPA with a more or less simple looking table that presented hierarchical data and made them editable with form elements. Under the hood there were hundred lines of very dense rxjs code and the whole thing was communicating with about 10 HTTP endpoints. But it looked simple.
Re:Modern Javascript: Everything you missed over the last 10... by buchanaf on Sunday May 16, 2021 @03:16PM (#27176182)
It's a monorepo, so the only package you are really interested in is 'packages/react-dom', which I'm guessing is less than 3 million.
Re:Modern Javascript: Everything you missed over the last 10... by uryga on Sunday May 16, 2021 @01:54AM (#27171513)
what niche language?
Re:Modern Javascript: Everything you missed over the last 10... by vgel on Sunday May 16, 2021 @02:06AM (#27171561)
Flow
Re:Modern Javascript: Everything you missed over the last 10... by egeozcan on Sunday May 16, 2021 @06:38AM (#27172694)
I find it interesting (and, a bit funny, tbh) how flow became a niche language. This is the difference investing in tooling makes, folks.
Re:Modern Javascript: Everything you missed over the last 10... by 11235813213455 on Sunday May 16, 2021 @11:07AM (#27174202)
while preact is 3kb and does the same
Re:Modern Javascript: Everything you missed over the last 10... by mpfundstein on Sunday May 16, 2021 @12:24PM (#27174735)
it does not do the same. it does few things that react does and thats it. what an ignorant comment
Re:Modern Javascript: Everything you missed over the last 10... by 11235813213455 on Sunday May 16, 2021 @02:28PM (#27175871)
There's preact/compat sub-module for the remaining react features, please inform yourself before inappropriately flaming someone. There some very slight differences https://preactjs.com/guide/v8/differences-to-react/#what-s-m... nothing blocking at all
Re:Modern Javascript: Everything you missed over the last 10... by 59nadir on Monday May 17, 2021 @12:29AM (#27180051)
Does it have hooks? Class components are super tedious in comparison.
Re:Modern Javascript: Everything you missed over the last 10... by 11235813213455 on Monday May 17, 2021 @04:48AM (#27181326)
`import { useState } from 'preact/hooks';` yes https://preactjs.com/guide/v10/hooks
Re:Modern Javascript: Everything you missed over the last 10... by irrational on Saturday May 15, 2021 @11:42PM (#27171019)
Seriously. I’ve been doing web development professionally since 1998. I’d love to have OP write a blog post to teach the rest of us about this simplicity.
Re:Modern Javascript: Everything you missed over the last 10... by adventured on Sunday May 16, 2021 @12:52AM (#27171315)
I've also been doing web development on essentially a daily basis since the 1990s.

I got pretty tired of chasing the fad explosion. Here's what I build everything with these days:

HTML, CSS, JavaScript, Go or PHP, Redis, MySQL or Postgres, Ubuntu & Nginx. Occasionally I'll make use of an ancient version of Sphinx for easy, fast search. I also sometimes mess with Vue for fun, as I happen to be fond of it, but I never find that I need it.

No frameworks. No containers. It's all mostly boring and ancient. I use DigitalOcean for about 95% of everything hosting wise (and rarely AWS). Works beautifully, everything is simple, blazing fast, light on bloat and rock solid.

The simplicity is still out there, if you don't have to care about what anybody else thinks, if you're not trying to earn a living doing web development (everything I work on is self-determined). That's a big if unfortunately. If you are trying to earn a living doing web development it's understood that chasing the latest thing isn't optional, as you can't afford to miss an inflection.

Re:Modern Javascript: Everything you missed over the last 10... by taotau on Sunday May 16, 2021 @02:04AM (#27171553)
What sort of systems are you building ? I’m guessing some variation of CMS, shopping cart or simple crud backoffice reporting systems.

I’ve spent 14 years working for a small agency building these sorts of systems. I kept up with all the cool new stuff that’s come out and played with it but all we ever needed was 2 load balanced app servers with a single instance Postgres database and we ran some pretty chunky systems.

I’m now looking for a new position and this attitude has come up to bite me. I’ve always been dismissive of the new dangled complexity but turns out there are systems out there that churn through so much data that mongodb makes sense, and large teams of devs where splitting systems into separate services and writing reusable components is required which is where frameworks and inter process communication tools come in.

Most things exist because there is a need for them.

Re:Modern Javascript: Everything you missed over the last 10... by adventured on Sunday May 16, 2021 @04:31AM (#27172158)
The last thing I built was a CMS structurally (a new non-commercial knowledge service), took about ~18 months to build. I plan to work on it for the rest of this decade approximately.

Currently working on a couple of trading systems (for physical objects, not financial). That's in the ecommerce sphere technically, although they're not monetary transaction based. The first one will hopefully launch in June. I might Show HN it.

Both work perfectly with the setup I described. I build in my wheelhouse though. I can build services like Stack Exchange, Quora, Wikipedia or Reddit (or most things in standard ecommerce, ecommerce platforms). I know what my stack is good at, and what it's not appropriate for. And at this point in my life I know well what I'm good at and what I enjoy, so I look for opportunities there.

Re:Modern Javascript: Everything you missed over the last 10... by egeozcan on Sunday May 16, 2021 @06:41AM (#27172710)
> so much data that mongodb makes sense

I don't want to dismiss this without any arguments but please do the basic research before you choose the db for your next project.

Re:Modern Javascript: Everything you missed over the last 10... by swagasaurus-rex on Monday May 17, 2021 @12:02AM (#27179945)
Parent is probably referring to how MongoDB has consistency issues and isn't recommended by third party testers like Jepsen.

https://www.infoq.com/news/2020/05/Jepsen-MongoDB-4-2-6/

Re:Modern Javascript: Everything you missed over the last 10... by sepin4 on Monday May 17, 2021 @04:35AM (#27181244)
MongoDB IMHO also has resource allocation issues, because for a simple two "node" distribution setup you have ~4 times the demand for resources than a "regular" clustered service like Postgre or Oracle. Added to that the actual promised efficiency relies heavy on the data model and has no real easy way to correct once deployed.
Re:Modern Javascript: Everything you missed over the last 10... by jd_mongodb on Monday May 17, 2021 @09:10AM (#27182972)
How do you get four times the demand for resources from two nodes?

The "promised efficiency" of any system is a complex question. The dynamic schema approach of MongoDB makes it trivial to update schema design on the fly so I am confused by "no real easy way to correct once deployed".

BTW : The recommended production setup is three nodes (one primary, two secondaries). This is what you get by default in MongoDB Atlas (you can't go smaller).

(I work for MongoDB)

Re:Modern Javascript: Everything you missed over the last 10... by sepin4 on Monday May 17, 2021 @04:48PM (#27188259)
I was talking about a two "node" Mongo setup which would mirror the capabilities of a classic two node setup of Oracle RAC for example. Since in Mongo this is not a clear 1:1 match due to a different model of operation, in order to get the same performance/continuity as RAC here is what I mean.

If I want to gain a relative 100% increase in concurrent read/write access and transparent session failover to my application I have to procure two servers(with roughly the same performance lets put it at rawPerf=1.0 for simplicity) and a SAN/NAS with SCSI HBA and that would be it. All the necessary components will be running on those two servers and the application will have access to almost all capabilities of a single instance with a roughly twice the performance and fault tolerance. To do that in Mongo, I would have to procure 2 replica sets with 3 instances each(bare minimum to get the fault tolerance and not use arbiters which according to Mongo University is a bad idea) for the actual data and another RS for the configuration meta-data, which is another 3 instances. I will also need instances where I can run my "mongos" to route/consolidate my requests and to have fault tolerance I will need at least two of those. Now to do a break down of the different instances. From the two replica sets for data, I can use only 2 of the instances for writes and the remaining four only for consistent reads and that is only with the appropriate write concern. And while I have two instances for writes I am not guaranteed to get a consistent increase in write operations unless the data is at least somewhat evenly distributed. I will need six rawPerf 0.5 servers(assuming 0.5 rawPerf is capable to handle roughly half the data), that is a total of 3.0 so far. The configuration RS while not as demanding as the actual data RS will still require resources so I count it as roughly between 0.5-1.0 total for all three instances. And finally I have the "mongos" instances which although will not need disk space will need some CPU and the same amount of RAM as a regular instance in case the queries and not optimized, so I will have to give it 0.5 per instance. And the total amount of resources comes to 3.0+0.5+1.0=4.5. On the other hand with the Oracle RAC I would've needed 2.0.

As for the schema flexibility, from the Mongo documentation I take it that once the shard key is created it can't be changed arbitrarily. It can only be further fine-grained by adding more keys to it, however this is available from version 4.4. In order to change it cardinally, I would have to recreate the collection.

I'm sure you are well aware of all this, however I'm just stating my experience with MongoDB so far.

Re:Modern Javascript: Everything you missed over the last 10... by jd_mongodb on Tuesday May 18, 2021 @08:36AM (#27193757)
AH I see. When we talk about nodes in MongoDB they are the elements of a replica set. That is what confused me. Yes, you are right, to get the equivalent performance of a two node database server you would have to run a sharded cluster with two shards. That is definitely more nodes than the two node design you have outlined for the RAC like design.

I am not familiar with Oracle RAC architecture but casual mention of a SAN fails to recognise the cost and complexity of even the smallest SAN. On the other hand MongoDB can run on dumb disks without a SAN or RAID required (though RAID can help with performance).

With you two node system loss of a node results in a 50% loss in performance whereas with MongoDB loss of a node will result in a secondary taking over the primary role with no loss in performance. You get what you pay for.

Setting up such clusters used to be a PITA until the advent of MongoDB Atlas. Now you can set them up with a few mouse clicks.

As regards shard keys. Yes, they are immutable, but the documents they index are not. So dynamic schema properties are preserved in a sharded cluster.

Re:Modern Javascript: Everything you missed over the last 10... by sepin4 on Wednesday May 19, 2021 @05:26AM (#27206295)
While a SAN/NAS is overall an expensive hardware in both price and manageability, there are entry level devices. You can even get direct SCSI devices in some cloud services(Azure has "shared disks"). For Oracle RAC the data is accessed from same location, it's not distributed/replicated across nodes. It's literally the same disks attached to all nodes. Also ASM works with raw block devices which bypasses the need for file system abstraction and all the latency that comes with it. You could also deploy a cluster on a cluster/network file system, but this would generally not be a good idea since you get a lot of overhead.

Postgre clusters can be configured in similar fashion.

I'm not saying that Mongo doesn't have it's strengths. However using the full potential of your environment requires much more planing and has a lot more pitfalls.

I was particularly discussing the implications on what the relative immutability of the shard key has on the data distribution and that it is not that easy to change.

Re:Modern Javascript: Everything you missed over the last 10... by javajosh on Sunday May 16, 2021 @10:23AM (#27173904)
Taotau my aesthetic is similar to yours, but it's true that we are a minority. Devs are, as a group, perceived as technology maximalists that love new toys, and the truth of the perception is reflected in the software landscape. Libraries like Angular, RxJs, and Webpack are all packed to the gills with features! It's also reflected by all the "slightly better" options we get in our tooling (yarn v npm) and (scss v css) and (ts v js) and even (ts v es)lint. But without exception, all of those incremental improvements still require that you have total mastery of the browser's native runtime, html5 + css3 + ES6 + dom + async, and all the protocols it enables, HTTP, TCP/IP, DNS, and all the infrastructure that's grown around it all (CDNs and load balancers and hypervisors).

Devops is in a similar state! There is growing consensus that "Container orchestration" is something like the right problem to solve, and people seem to like Kubernetes, but tools like Puppet, Ansible, Salt are still in heavy usage, and are still very useful, but they solve a different problem. Even within k8s there is debate about the proper container runtime (Docker has fallen out of favor for containerd). But all of this assumes total mastery of linux, ssh, bash, systemd, vim, sudo, mount, ps, and all the distribution variations.

Java is in a similar state! Widely considered "boring technology", Java (lang) 8 introduced streams and lamdas, which is a very different way to code (and hence, to think), and emphasizes functional style over object-oriented programming. Then you get to pick which Java you want (Oracle, RedHat, ?), and how you want it installed (installer, brew, unzip, docker), and now your build tool (Maven, gradle, play, ?) Then if you're making a "typical" webapp you have to choose your VCS (git, mercurial, svn, cvs), code hosting provider (github, gitlab), your starting point - Spring, Spring Boot, Dropwizard - which assumes you want REST, when in fact you may want to try GraphQL, which may lead you to nodejs, and it's complexity.

Picking system dependencies is similarly complicated. Components we can choose from - message queues (rabbitmq, kafka, activemq, ?), caches, proxies (nginx, httpd), and here we have to balance many considerations, such as "is there a widely trusted image I can configure and use as is?", and your options, and the details used to deploy them, will depend on every other decision you've made. In fact, all of these choices are made in away that affects some or all of the others, in a way that is complex and difficult to articulate. This is certainly why certain combinations get acronyms (LAMP, Jamstack, etc[0]), and why its very hard to have an intuitive picture.

[0] https://en.wikipedia.org/wiki/Solution_stack

Re:Modern Javascript: Everything you missed over the last 10... by einpoklum on Sunday May 16, 2021 @04:12PM (#27176636)
> Devs are, as a group, perceived as technology maximalists that love new toys,

Make that web devs, if at all. In many other places where software is written, it's closer to the opposite: Managers tend to be minimalists, and the more "adventurous" developers lobby for adopting newer libraries, or use a new language for some side-project.

Re:Modern Javascript: Everything you missed over the last 10... by fitpolar on Sunday May 16, 2021 @07:09AM (#27172834)
> HTML, CSS, JavaScript, Go or PHP, Redis, MySQL or Postgres, Ubuntu & Nginx.

Listing a stack of dependencies as a starting requirement is arguably not simple.

Simple to you personally because you’re proficient in each of these. But how long did it take for you to become proficient?

Re:Modern Javascript: Everything you missed over the last 10... by adventured on Sunday May 16, 2021 @03:26PM (#27176267)
The premise isn't that what I'm using will make it easy for somebody with zero knowledge to become good at web development in 24 hours or a week or a month, or any such pitch. It's certainly relative.

The relative simplicity is in that the stack is quite set and restricted, with no unnecessary pieces. I don't add to it just because the industry finds a new flavor of the week or something loses/gains popularity. Each part of the stack has a job to do and I don't add to it constantly or constantly turn over what's in it. That stack could remain entirely unchanged for five or more years easily. Where it can be avoided I don't use unnecessary incrementals that add dependencies or complexity (which will often resurface in the loss of reliability/predictability). I often don't use the latest versions of anything unless there's a very good reason to switch sooner than later. I might stick with Ubuntu 16.04 or 18.04 for the next decade if it were a safe thing to do from a security perspective. In that approach, I can place as much of my energy and focus on what I'm building as possible (since everything I build is mine, that's where my priority and interest is).

Web development was always a means to an end for me. It enables me to build things that I want to see exist. I don't love web development unto itself (I'm rather neutral on it), I love what it enables me to do. I grew up in the middle of nowhere Appalachia. An atheist, social liberal in a typical conservative region that was intellectually unfulfilling, uninspiring, non-ambitious, slow (it was also peaceful, green, and with very little crime). The Internet (and Web) showed up there around 1993-1994 and it was like something from another planet, my teenaged brain could see immediately what could be done with the open canvas and from then forward all I wanted to do was build on it. You're telling me there's this always expanding virtual space, seemingly infinite, and I can just build, and build, and build anything that I can think of? And it connects me up to millions (later billions) of other people? And it's not even very expensive to mess with? Holy shit, let's go.

So what I primarily care about is the thing being constructed, and I want my stack to be very reliable, fast and without many frills or unnecessary complexities. I don't want it to get in the way. I don't want to have to fight with it every time I begin a new project, I want to immediately get to building, with the stack being the 'ol reliable companion that just does its job.

If there's something far better nearby (that is reliable + low on complexity) with minimal learning curve, I'll consider it; I switched to PHP 7 very rapidly for example because the speed increase was such a considerable gain and it required very little time/effort to switch. I started utilizing Go because it was easy to learn, simple and fast (I worked with Java in the 1990s, and never wanted to go through that again); Redis is much the same story, I use it for all sorts of things (from caching to various throttling tasks) and it was pretty ridiculously easy to start using vs the enormous value I derive from it. I'd be happy to keep using my current version of Redis for the rest of this decade. I've been using Photoshop 7 since 2002 because it just works and handles ~95% of everything I need in that space (and they can't do anything to force me to upgrade).

It's also worth noting that I handle every aspect of building and operating a service in the beginning. So this adds emphasis on not shaking the stack unnecessarily, the time costs can become large fast.

Re:Modern Javascript: Everything you missed over the last 10... by theonething on Sunday May 16, 2021 @01:55AM (#27171515)
Do you roll your auth and stuff?
Re:Modern Javascript: Everything you missed over the last 10... by adventured on Sunday May 16, 2021 @04:40AM (#27172205)
I started building my own auth about 20 years ago and I've been learning and rolling (improving it) as I go. I've been using a structure that I've been iterating for about the past 6-8 years or so. Hardly a week has gone by that I haven't worked on something related to auth.

I've experimented with just about every approach. Lately I've dumped all forms of social auth (the past couple of years). I won't allow FB or Twitter login, none of them deserve to be trusted with that.

I'm a big fan of try (the service) before you have to sign up, but I always find that among the most challenging aspects to get right.

I know everyone has a different opinion on auth, but I find it routine to do after all this time. The part I find most annoying is probably throttling / controlling abuse attempts vs legitimate users (balancing it well), it's tedious.

Re:Modern Javascript: Everything you missed over the last 10... by archerx on Sunday May 16, 2021 @02:42AM (#27171706)
I made a custom e-commerce from scratch with PHP and doing the auth system wasn’t hard at all and it is pretty secure. I feel people make auth seem scarier than it really is.
Re:Modern Javascript: Everything you missed over the last 10... by petewailes on Sunday May 16, 2021 @03:10AM (#27171834)
Don't roll your own auth.

I seriously doubt you're going to do a better job at security than the AaaS systems out there. I couldn't, and no-one I know could. It's a ludicrously complex and subtle field.

Re:Modern Javascript: Everything you missed over the last 10... by dvdkon on Monday May 17, 2021 @07:06AM (#27182136)
How did you evaluate the auth implementations? In my experience it's about as hard to poke holes into something as it is to fix it. Besides, a custom auth implementation doesn't need to be best-in-class, it needs to just be good enough.
Re:Modern Javascript: Everything you missed over the last 10... by scrollaway on Monday May 17, 2021 @07:49AM (#27182414)
> the auth system wasn’t hard at all and it is pretty secure

If there ever was a red flag in what you're saying, this is it.

Auth isn't "scary". But it is hard. You need to know what you're doing in order to implement it from scratch. If you think it wasn't hard, odds are you did it wrong.

Re:Modern Javascript: Everything you missed over the last 10... by QuadrupleA on Sunday May 16, 2021 @01:47AM (#27171497)
Definitely agree with this type of approach - and my experience as a freelancer (thankfully in charge of my tech stacks) is that clients are happy to pay for fast, reliable software built like this.
Re:Modern Javascript: Everything you missed over the last 10... by cies on Sunday May 16, 2021 @03:50AM (#27171977)
Software that does not have a one-man-team behind it (with all due risks): that's where bigger companies pay even better.
Re:Modern Javascript: Everything you missed over the last 10... by z3t4 on Sunday May 16, 2021 @06:02AM (#27172566)
Web development, even single page apps, and progressive web apps, can be simple if you skip the web frameworks which solve non-problems and complicate things. The most difficult problem in web development is to make the user interface (UX) work on everything from smart-watches to 40 inch 4k monitors. CSS solves this problem, but it's not an easy problem by itself. The second most difficult thing in web development is automated testing across the stack, testing both back-end and front-end, with different user devices. It's complicated and time consuming to write the code that test every function automatically. Third most difficult thing in web development is optimizations, the browser dev tools doesn't say much about what is going on internally in the JavaScript engine.
Re:Modern Javascript: Everything you missed over the last 10... by pseudalopex on Sunday May 16, 2021 @04:03PM (#27176558)
Show me a user interface that works on anything from smart watches to 40 inch monitors.
Re:Modern Javascript: Everything you missed over the last 10... by einpoklum on Sunday May 16, 2021 @04:15PM (#27176655)
> CSS solves this problem

No, it does not.

CSS allows some mitigation of this problem.

Re:Modern Javascript: Everything you missed over the last 10... by austincheney on Sunday May 16, 2021 @06:07AM (#27172578)
I was able to create an original OS like GUI, including file system interaction, using vanilla JS (TypeScript) in about two weeks. I am still using it. The actual GUI is just a couple files each comprising about a dozen functions, nothing really complicated.
Re:Modern Javascript: Everything you missed over the last 10... by mixmastamyk on Monday May 17, 2021 @02:44AM (#27180652)
Delphi probably would have gotten you there in two hours.
Re:Modern Javascript: Everything you missed over the last 10... by mssundaram on Sunday May 16, 2021 @01:36AM (#27171454)
Probably in contrast to the embedded hardware development the OP does...
Re:Modern Javascript: Everything you missed over the last 10... by XCSme on Sunday May 16, 2021 @04:19PM (#27176678)
The nice part is that you can make web dev as simple or complex as you want. You can write your entire application in a single index.html file with no compilation or build step. You can also use various preprocessors, scaffolds, libraries and frameworks to achieve the same result. The choice is yours.
Re:Modern Javascript: Everything you missed over the last 10... by VWWHFSfQ on Sunday May 16, 2021 @01:14AM (#27171391)
I feel like I'm a freaking alien right now.