Live data from Hacker News

I can only think that modern front end development has failed

twitter.com

411–420 of 521 posts

Re: I can only think that modern front end development has failed

#411

Earlier quoted context omitted.

I am going to :+1: the UK census site - built on code developed by the gov.UK digital service, it has been apparently bulletproof at taking 20 million plus individual households through a moderately complex survey. sometimes it can be done right. And it uses a framework :-)

Not quite bulletproof. I found a couple of bugs while using it. At the end, just before submission it showed the completed sections, and you could look at each section to see a tidy summary of the answers provided. Except for the section 1, where doing that jumped to the last of the section's questions instead. I wanted to see one of the answers I had given in the section 1 to check before committing, and due to the…

Consider filing a bug report: https://census.gov.uk/en/web-form/

Re: I can only think that modern front end development has failed

#412
post #305

Earlier quoted context omitted.

Yeah what's weird is that there's is an entire generation of developers who think of SPA as the default. They think that server side is slower because you have to send down more data, or you have to wait for the server to generate HTML. Quite the contrary, it's slower to send down 1 MB or 10 MB of JavaScript to render a page, than to simply send down a 100 KB HTML page. Even if you need some JS also, browsers know ho…

Take away React, Vue, Angular, or similar away from most current front end developers and there is panic. When I say panic I mean full insanity panic like abandoning the profession or completely going postal. —— A simple checklist to provide superior front end applications: * Don’t use this . You (general hypothetical you) probably don’t realize how easily you can live without it only because you have never tried. Do…

I think a bit of context about `this` is important.

Using `this` in a callback -- where you expect your caller to provide your local binding -- is straight-up bad juju. Pass arguments instead.

Using `this` in an object instance to namespace is just fine. The entire point of having an object is that you get these nice encapsulated namespaces which can send messages to each other.

One suggestion, and a related ask: rather than just saying "Don't do FOO", provide alternatives as well; e.g., "Don't use `addEventListener`, use `superFooBarBazzer`".

Bonus points awarded for runnable examples. :)

Perhaps my biggest gripe about the entire Javascript ecosystem is finding libraries that provide documentation that looks like this:

    // See how easy my library is to use!
    myLibrary.doTheThing(fooBar, bazBang);
Without ever showing you what a `fooBar` or `bazBang` are, and perhaps where and/or how an enterprising developer might obtain one.

Re: I can only think that modern front end development has failed

#413
post #400

Earlier quoted context omitted.

Take away React, Vue, Angular, or similar away from most current front end developers and there is panic. When I say panic I mean full insanity panic like abandoning the profession or completely going postal. —— A simple checklist to provide superior front end applications: * Don’t use this . You (general hypothetical you) probably don’t realize how easily you can live without it only because you have never tried. Do…

What do you use instead of these constructs?

[deleted]

Re: I can only think that modern front end development has failed

#414

Earlier quoted context omitted.

Instead of this I use explicitly named variables and functions. Instead of addEventListener I assign event handlers directly to the event property of the DOM: button.onclick = whatever . This forces simplicity and cleaner code management because only one function can be assigned to any given property. Instead of querySelectors I use other standard DOM methods.

Other standard DOM methods like what? getElementById and getElementsByClassName?

I also want to know this.

Re: I can only think that modern front end development has failed

#415
post #305

Earlier quoted context omitted.

Yeah what's weird is that there's is an entire generation of developers who think of SPA as the default. They think that server side is slower because you have to send down more data, or you have to wait for the server to generate HTML. Quite the contrary, it's slower to send down 1 MB or 10 MB of JavaScript to render a page, than to simply send down a 100 KB HTML page. Even if you need some JS also, browsers know ho…

Take away React, Vue, Angular, or similar away from most current front end developers and there is panic. When I say panic I mean full insanity panic like abandoning the profession or completely going postal. —— A simple checklist to provide superior front end applications: * Don’t use this . You (general hypothetical you) probably don’t realize how easily you can live without it only because you have never tried. Do…

This is a silly list. What? You really think document.getElementById is going to be faster than querySelector("#foo")? You really think there is a meaningful difference between other methods of adding event handlers, other than it being way hackier to add more than one with the other methods?

I have no idea what your objection to "this" is. Object Oriented code can be bad sometimes but so can procedural code.

Re: I can only think that modern front end development has failed

#416
post #305

Earlier quoted context omitted.

Yeah what's weird is that there's is an entire generation of developers who think of SPA as the default. They think that server side is slower because you have to send down more data, or you have to wait for the server to generate HTML. Quite the contrary, it's slower to send down 1 MB or 10 MB of JavaScript to render a page, than to simply send down a 100 KB HTML page. Even if you need some JS also, browsers know ho…

Take away React, Vue, Angular, or similar away from most current front end developers and there is panic. When I say panic I mean full insanity panic like abandoning the profession or completely going postal. —— A simple checklist to provide superior front end applications: * Don’t use this . You (general hypothetical you) probably don’t realize how easily you can live without it only because you have never tried. Do…

Your opening sentence is weirdly derogatory...

And I think these are all pretty far from the main performance issues with common apps FWIW. These are more low level coding issues, whereas the real slowness (e.g. 10x or 100x issues) comes from architecture, dependencies, network usage, data structures, reflows, etc.

Re: I can only think that modern front end development has failed

#417

Earlier quoted context omitted.

Take away React, Vue, Angular, or similar away from most current front end developers and there is panic. When I say panic I mean full insanity panic like abandoning the profession or completely going postal. —— A simple checklist to provide superior front end applications: * Don’t use this . You (general hypothetical you) probably don’t realize how easily you can live without it only because you have never tried. Do…

This is a silly list. What? You really think document.getElementById is going to be faster than querySelector("#foo")? You really think there is a meaningful difference between other methods of adding event handlers, other than it being way hackier to add more than one with the other methods? I have no idea what your objection to "this" is. Object Oriented code can be bad sometimes but so can procedural code.

This person has a weird unjustified objection to querySelector.

I remembered this same conversation from 8 months ago where I pointed out that parsing something like '#foo' is NOT slow, he argued against it, 5 people pointed out the same thing, and he was not receptive to that feedback, etc.

https://news.ycombinator.com/item?id=24054745

Performance is hard; optimizing the wrong thing is also a problem ...

Re: I can only think that modern front end development has failed

#419
I'm amused by certain "big names" coming in and responding with arguments about how front-end wasn't that great back when either.

This idea that modern front-end has failed is not some absolute statement that means that all that came before was a success. In fact, it's a statement that with all our modern technology and idea's, we're still in a situation where we haven't improved on front-end tooling and development.

Also, just because front-end has exploded and created a huge amount of jobs, doesn't mean we're doing it right or well. There is just as much evidence to suggest that we need so many front-end developers because our current tooling and methods have made front-end development a massive job requiring many people.

Re: I can only think that modern front end development has failed

#420
One thing not mentioned often enough about SPAs is how complicated they make simple operations. In this component - https://gist.github.com/polydevuk/96d89642f114707b2f1a0cc316... - I have a select box for tzdata Regions (Europe, America etc.) and when a region is selected it populates a Locations menu beneath it (London, Paris etc.). Simple in jQuery or pure JS. In React, however, once a region and location has been chosen it caches some kind of hidden index value for the selected option such that a subsequent region choice (without a page refresh) selects the item in the new Locations menu with the same hidden index value as the previous selection instead of the default header option. What was initially simple HTML + minimal JS becomes a complex attempt to manipulate React-specific magic. Using react-form? Fine .... until you need to mix it with react-select or material-ui then you're in for a world of pain deciding how to mix controlled and uncontrolled components. Add Redux into the mix and you're adding orders of magnitude more complexity. Frankly, I don't have the time. I would much rather be using that time to add features to my Rails back-end and spend time with my family. Back in the late 1990s and early 2000s CSS browser compatibility and DHTML was the big time-sink. Now it's SPAs. Back then we dreamt of a day when web standards were fully supported. Today that dream is a reality but you wouldn't know it because we've just made everything even more complex.

The only development which I can see saving us from this mess is Stimulus/Hotwire from the Rails team and implemented in other frameworks such as Djano, Laravel and Phoenix.

Post reply on HN