Just a bit more

๐ŸŽ™๏ธ Cat7a ยท 8851 points ยท Posted at 19:52:18 on March 26, 2019 ยท (Permalink)


Saved comment

Max-Werner ยท 303 points ยท Posted at 20:18:56 on March 26, 2019 ยท (Permalink)

The bigger question is why?

BytesBeltsBiz ยท 167 points ยท Posted at 21:18:31 on March 26, 2019 ยท (Permalink)

To bravely go where no man has gone before

imiroslavov ยท 1 points ยท Posted at 12:33:24 on March 29, 2019 ยท (Permalink)

...and sleep in your backpack.

matrizx ยท 188 points ยท Posted at 22:24:30 on March 26, 2019 ยท (Permalink)

node_modules

[deleted] ยท 104 points ยท Posted at 02:25:17 on March 27, 2019 ยท (Permalink)*

[deleted]

SheriffBartholomew ยท 4 points ยท Posted at 17:04:16 on March 27, 2019 ยท (Permalink)

Doesn't that just remove packages not listed in the package.json? If so, it isn't going to do much, since they probably used npm install <package> --save or --save-dev when they added the packages to begin with. What we really need is a command that checks for a ref to the packages within the project files and removed whatever isn't imported.

IlonggoProgrammer ยท 95 points ยท Posted at 03:05:11 on March 27, 2019 ยท (Permalink)

rm -rf node_modules

warpedspockclone ยท 83 points ยท Posted at 04:47:14 on March 27, 2019 ยท (Permalink)

Now my hello world app is broken. The package.json thing says I need 212 other things. \s

PM_COFFEE_TO_ME ยท 33 points ยท Posted at 05:45:01 on March 27, 2019 ยท (Permalink)

Why are you trying to make your comment execute silently?

warpedspockclone ยท 28 points ยท Posted at 05:49:11 on March 27, 2019 ยท (Permalink)

Silent but deadly

HDbug ยท 14 points ยท Posted at 07:57:28 on March 27, 2019 ยท (Permalink)

const silent = require('silent');

silent.shhh()

Prawny ยท 4 points ยท Posted at 10:00:13 on March 27, 2019 ยท (Permalink)

Just trying to match any trailing whitespace characters.

PM_ME__ASIAN_BOOBS ยท 19 points ยท Posted at 03:20:57 on March 27, 2019 ยท (Permalink)

because.js

[deleted] ยท 233 points ยท Posted at 22:48:08 on March 26, 2019 ยท (Permalink)

Because modern web developers have no idea what theyโ€™re doing and donโ€™t care about performance at all.

How many times have you seen a web developer say โ€œwho cares about the performance, the IO takes longer than anything elseโ€ (it might as well be their slogan) except that they have never measured the IO. So you get these 800-2000 milliseconds per request events and also popping off 40 of those to load 50 kB of text. Their actual IO is only ~30ms tops, but who cares about the other 1970 ms because IO takes forever anyway.

ponybau5 ยท 147 points ยท Posted at 23:53:39 on March 26, 2019 ยท (Permalink)

They've infected desktop "apps" with the same train of thought. "Fuck the 3000 imported modules it works so it doesn't matter if it's slow"

[deleted] ยท 82 points ยท Posted at 01:50:52 on March 27, 2019 ยท (Permalink)*

I am looking at you electron . I am crying in electron apps

Edit : I like visual studio code too ๐Ÿ˜, make my life much simpler with platform IO for codding bare metal esp8266.

Kazumara ยท 51 points ยท Posted at 04:50:59 on March 27, 2019 ยท (Permalink)

I think the only good electron app is Visual Studio Code.

ComputerMystic ยท 7 points ยท Posted at 16:31:05 on March 27, 2019 ยท (Permalink)

Yep. Still means that Electron is awful.

To quote Linus Torvalds:

C++ is a horrible language. Itโ€™s made more horrible by the fact that a lot of substandard programmers use it, to the point where itโ€™s much much easier to generate total and utter crap with it. Quite frankly, even if the choice of C were to do nothing but keep the C++ programmers out, that in itself would be a huge reason to use C.

It's SO easy to make utter garbage with Electron because SOMEONE decided that their terminal needed to run on Chromium.

TheSpiffySpaceman ยท 4 points ยท Posted at 14:42:33 on March 28, 2019 ยท (Permalink)

Agreed. Used to like Atom, but after using VS Code, Atom just feels so Electron-y.

I think Slack is a good enough Electron app as well.

ispamucry ยท -14 points ยท Posted at 05:31:29 on March 27, 2019 ยท (Permalink)

No love for Discord?

Kazumara ยท 37 points ยท Posted at 05:44:43 on March 27, 2019 ยท (Permalink)

No, Discord loads too slowly, has an interface that goes way overboard on the whitespace and I don't really like the layout for a communications app. I have some friends on Discord and some on Teamspeak and I always think how quick Teamspeak is.

And there is the more fundamental issue that you can't self host discord. When it has server issues, sometimes your instance just lags and there is nothing you can do about it and no way to diagnose it.

ponybau5 ยท 3 points ยท Posted at 09:18:17 on March 27, 2019 ยท (Permalink)

It takes discord almost 30 seconds to load for me on an nvme. So much feature creeping bloat.

zankem ยท 2 points ยท Posted at 16:57:08 on March 27, 2019 ยท (Permalink)

It wants to be your game launcher now.

ponybau5 ยท 1 points ยท Posted at 19:14:33 on March 27, 2019 ยท (Permalink)

I wish there was some centralized 3rd party launcher that incorporated multiple stores.

Kazumara ยท 1 points ยท Posted at 10:57:20 on March 27, 2019 ยท (Permalink)

Yeah I have it on an NVMe SSD as well.

conancat ยท 7 points ยท Posted at 07:30:06 on March 27, 2019 ยท (Permalink)

but those aren't problems with Electron nor Javascript... those are problems with product decisions,.

Kazumara ยท 9 points ยท Posted at 07:41:44 on March 27, 2019 ยท (Permalink)

I didn't say they were, just that the only good electron app I know is visual studio code. Then my opinion of Discord was asked and I listed my issues with it in general.

Visual Studio Code shows that electron apps can be good. Of course I'm not saying it can't work because it's Javascript.

I'm just observing that for some reason most Electron apps are not good. I don't know where the causal link lies, maybe Electron is attractive to the wrong teams / for the wrong projects, or maybe it's hard not to mess up with Electron or maybe the Electron overhead is fundamentally large and VSC managed to reduce it somehow.

In fact maybe there is no causal link, maybe it's just too small of a sample.

Dworgi ยท 3 points ยท Posted at 09:18:09 on March 27, 2019 ยท (Permalink)

But if there's a dozen Electron apps around, and only one is good, then that's at least a very strong correlation.

I would state it like so: Electron requires less effort to slow down than any other desktop application framework, and thus also more discipline to keep running quickly.

[deleted] ยท 1 points ยท Posted at 05:59:50 on March 27, 2019 ยท (Permalink)

[deleted]

xDerJulien ยท 5 points ยท Posted at 06:06:35 on March 27, 2019 ยท (Permalink)

Discord takes like 3 seconds for me to load, ever tried disabling hardware acceleration ?

JasonMan34 ยท 1 points ยท Posted at 06:13:57 on March 27, 2019 ยท (Permalink)

Whenever I load it up it takes literally over a minute to start

Sounds like a personal issue

[deleted] ยท -8 points ยท Posted at 05:33:43 on March 27, 2019 ยท (Permalink)

Oh Yesss I like visual studio code too ๐Ÿ˜, make my life much simpler with platform IO for codding bare metal esp8266.

DatNeverikGuy ยท 4 points ยท Posted at 10:33:55 on March 27, 2019 ยท (Permalink)

Sorry if I'm being stupid here, but I can't tell if this is sarcasm or not.

[deleted] ยท 0 points ยท Posted at 11:59:07 on March 27, 2019 ยท (Permalink)

No not at all ! I like to code bare metal esp8266 in VS Code

MaxxBreak ยท 17 points ยท Posted at 05:42:47 on March 27, 2019 ยท (Permalink)

It is almost always better to not use a framework, or at least not use a lot of frameworks at the same time.

*Uses bootstrap, semantic-ui, angular, react, node and of course jquery

conancat ยท -1 points ยท Posted at 07:32:53 on March 27, 2019 ยท (Permalink)

Uses bootstrap, semantic-ui, angular, react, node and of course jquery

one of those are not like the others...

node, i'm talking about node,

who still uses jquery in 2019 omg

noyurawk ยท 10 points ยท Posted at 09:33:18 on March 27, 2019 ยท (Permalink)

who still uses

Ah yes the oh-so original "who still uses" douchey comment. Yawn.

conancat ยท -3 points ยท Posted at 10:51:07 on March 27, 2019 ยท (Permalink)

$("#me.douche").hide()

cafk ยท 7 points ยท Posted at 09:32:11 on March 27, 2019 ยท (Permalink)

who still uses jquery in 2019 omg

Enterprises targeting developers, because their customers Are still running IE8 and 9 :)

conancat ยท 6 points ยท Posted at 10:44:02 on March 27, 2019 ยท (Permalink)

My heart goes out to the warriors out there still battling IE8.

Microsoft themselves drop support for browsers older than IE11 since 2016, and I encourage everyone to stop supporting them as so they can finally die already.

https://www.microsoft.com/en-us/windowsforbusiness/end-of-ie-support

cafk ยท 3 points ยท Posted at 11:14:56 on March 27, 2019 ยท (Permalink)

Unfortunately, as a contractor, there is no way to challenge enterprise (10000+ users) wide it policies and government regulations that require certified applications and nobody is willing to take up the certification challenge (To certify only Windows 10 it costs around โ‚ฌ2m plus management, engineering and sliding timescales costs, as well as the accreditation fees)

conancat ยท 2 points ยท Posted at 11:27:01 on March 27, 2019 ยท (Permalink)

Usually my strategy is to scare them with the security angle. Every single day they use the unsupported systems they are opening themselves wide for security breaches and hacks, since the system isn't being supported anymore by Microsoft that means there are about 3+ years of possible vulnerabilities flying around out there waiting to land on any of those 10000+ machines to completely breach the system, and the costs may be much, much higher than โ‚ฌ2m to both their clients and themselves when it happens.

I mean it's technically the truth! It is a bomb waiting to be activated, lol. Especially if the system connects to the outside world in any way, shape or form.

cafk ยท 3 points ยท Posted at 12:01:06 on March 27, 2019 ยท (Permalink)

I always have voiced my concerns during the initial phases and if they are not reflected append my contract regarding liability and functionality, but some accreditations are done in a way that they are indefinitely valid, even if the system is not supported anymore.

They don't care the same way that most people don't care that their midrange phone is still running on Android 4, because it works and was a steal at โ‚ฌ99.

The risk and hazard calculation from Fight Club is still valid, especially when they mention it being a closed corporate environment.

The sales can continue screaming "we are certified", even if the company is still only ISO 9001:1987 compliant and no longer valid for modern systems...

Devildude4427 ยท 4 points ยท Posted at 10:21:00 on March 27, 2019 ยท (Permalink)

Doesnโ€™t bootstrap still require jQuery?

budd222 ยท 5 points ยท Posted at 09:30:12 on March 27, 2019 ยท (Permalink)

If you're just building a standard website, then jQuery is quite useful. It's not useful in web applications though.

conancat ยท 3 points ยท Posted at 10:48:29 on March 27, 2019 ยท (Permalink)

http://youmightnotneedjquery.com/

If you really still need them, perhaps it's time to consider picking up React or Vue?

But if you really need it for like really, really small projects, check this out!

https://github.com/kenwheeler/cash

https://github.com/franciscop/umbrella

iv190dmm ยท 3 points ยท Posted at 09:58:07 on March 27, 2019 ยท (Permalink)

What would be a good alternative then? I'm asking because I'm new to web dev, so I use what's common

Hollowplanet ยท 6 points ยท Posted at 10:23:08 on March 27, 2019 ยท (Permalink)

Vue is better.

[deleted] ยท 4 points ยท Posted at 10:38:33 on March 27, 2019 ยท (Permalink)*

[deleted]

conancat ยท 1 points ยท Posted at 11:51:56 on March 27, 2019 ยท (Permalink)

Vue etc basically replaces the entire process of creating widgets and plug-ins with something else entirely. React and Vue are all about creating DOM/faux-HTML elements, it's about having full control over the entire widget and plugin that you create.

If you take out DOM manipulation and interaction binding out of jquery, then what's left are just the Ajax stuff, which can be replaced with something lighter.

Low level language utilities... _.lodash is my go to when the built in ES2015-2018 functional programming methods are not sufficient.

But yeah, completely different approaches. But I'll say the jquery way of doing it is getting old for various reasons. For newbies it might be easier for them to start off with Vue or React directly without being indoctrinated with the old way of doing things, it's like learning a new language, unlearning the old ways is another overhead lol.

Hollowplanet ยท 1 points ยท Posted at 11:59:52 on March 27, 2019 ยท (Permalink)

I've written a lot of jQuery and a lot of Vue. I know them both pretty damn well. You're not telling me anything I don't already know. jQuery and Vue are incompatible. They do not work together. If you want to use Vue you shouldn't have jQuery. Vue will clobber your jQuery DOM changes.

You shouldn't need a DOM lib with Vue. Vue is the DOM lib. Vue should be the only thing modifying the dom and you should be reading the DOM through $refs using native JS. Anything else is unneeded bloat.

Cantremembermyoldnam ยท 1 points ยท Posted at 20:44:03 on March 27, 2019 ยท (Permalink)

I've written a lot of jQuery and a lot of Vue. I know them both pretty damn well. You're not telling me anything I don't already know. jQuery and Vue are incompatible. They do not work together.

What are you talking about? If course they are compatible. You can include both libraries on the same page and work with either of them simultaneously.

If you want to use Vue you shouldn't have jQuery. Vue will clobber your jQuery DOM changes.

Vue isn't only used for SPAs (where, if you'd include jquery, I'd probably club you to death), but can be useful for extending an otherwise difficult to extend legacy app. That's often done in the company I work for.

You shouldn't need a DOM lib with Vue. Vue is the DOM lib. Vue should be the only thing modifying the dom and you should be reading the DOM through $refs using native JS. Anything else is unneeded bloat.

Yes, that's true. Still, there might be legacy components requiring jquery. Bootstrap unfortunately still somewhat requires it, for example.

Devildude4427 ยท 3 points ยท Posted at 10:23:58 on March 27, 2019 ยท (Permalink)

JQuery isnโ€™t really common. The space moved on to SPAโ€™s a few years ago, though thereโ€™s still massive corporate usage of bootstrap and jQuery.

JQueryโ€™s issue is that it has been been made near obsolete. When it started, jQuery did great things that you couldnโ€™t easily otherwise do, especially with css selectors. But now, thatโ€™s all been integrated into normal JS, so you have this massive framework that in reality doesnโ€™t do much. Bootstrap still depends on it though.

iv190dmm ยท 1 points ยท Posted at 10:24:48 on March 27, 2019 ยท (Permalink)

So I should move away from bootstrap too is what I'm hearing?

conancat ยท 3 points ยท Posted at 10:41:02 on March 27, 2019 ยท (Permalink)

Bootstrap is a theming and styling framework, which has since been made obsolete by more modem solutions such as semantic-ui. But they're definitely the OG and will always have a special place in my heart.

There are many things that goes into building a frontend, React or Vue is for creating the components and handling the interactions.

If you're doing frontend, learning React or Vue will pay off bigly.

Remember Bootstrap is just styling, and it's not everything. Check out semantic ui and styled-components for alternatives to Bootstrap.

iv190dmm ยท 2 points ยท Posted at 10:42:14 on March 27, 2019 ยท (Permalink)

Cool, thanks for the great info!

Devildude4427 ยท 1 points ยท Posted at 10:57:20 on March 27, 2019 ยท (Permalink)

Probably. It wouldnโ€™t be bad at all if it didnโ€™t depend on jQuery, but both are gigantic monoliths, with jQuery being a near dead and useless.

There are plenty of other css frameworks out there, for example, Iโ€™ve used Vuetify quite a bit and Iโ€™ve enjoyed it. Semantic-UI is also very popular, and has many inbuilt JS commands too, which are useful.

baldurFromRoom29 ยท 2 points ยท Posted at 10:02:27 on March 27, 2019 ยท (Permalink)

React is good

budd222 ยท 2 points ยท Posted at 11:21:19 on March 27, 2019 ยท (Permalink)

React is not an alternative to jQuery. They are two completely different things

conancat ยท 1 points ยท Posted at 10:45:01 on March 27, 2019 ยท (Permalink)

Team React โœŠ

But honestly though, Vue is easier to understand for those just starting out.

baldurFromRoom29 ยท 3 points ยท Posted at 10:57:04 on March 27, 2019 ยท (Permalink)

will give vue a shot

budd222 ยท 2 points ยท Posted at 11:21:46 on March 27, 2019 ยท (Permalink)

Vue is awesome. I love it

MuskasBackpack ยท 1 points ยท Posted at 12:33:45 on March 27, 2019 ยท (Permalink)

Iโ€™ve been using Vue a lot lately and havenโ€™t used React yet. Do you ever find there are things you can do with React that you canโ€™t do or are much more difficult with Vue?

neotorama ยท 2 points ยท Posted at 11:31:19 on March 27, 2019 ยท (Permalink)

Your mom

Who_GNU ยท 3 points ยท Posted at 05:28:03 on March 27, 2019 ยท (Permalink)

Something, something, Electron

baldurFromRoom29 ยท 3 points ยท Posted at 10:01:02 on March 27, 2019 ยท (Permalink)

we have infected mobile apps too with react native

14u2c ยท 37 points ยท Posted at 04:52:39 on March 27, 2019 ยท (Permalink)

If you want an actual answer, its because these apps can be developed quickly from a large talent pool of developers. Many of these library abstract away the "hard" concepts of web development, but realistically don't do so for free. It's the same reason electron apps have become so popular, because it's faster and cheaper to implement them. Performance matters less to the bottom line. And I can't say I blame managers for that decision. CPU cycles are cheap compared to dev hours.

yacuzo ยท 14 points ยท Posted at 09:20:37 on March 27, 2019 ยท (Permalink)

The users CPU cycles are even completely free. Sadly.

globalcandyamnesia ยท 7 points ยท Posted at 15:09:21 on March 27, 2019 ยท (Permalink)*

Also the adoption of SPAs means you trade an initial longer load for near instantaneous subsequent content loading. I think it's an ok trade. I'd rather wait 1 or 2 seconds on initial load rather than 300ms each click.

deNederlander ยท 0 points ยท Posted at 13:50:44 on March 27, 2019 ยท (Permalink)

"talent"

[deleted] ยท 80 points ยท Posted at 02:12:06 on March 27, 2019 ยท (Permalink)

[deleted]

conancat ยท 2 points ยท Posted at 07:33:38 on March 27, 2019 ยท (Permalink)

me every day lol.

my product person is telling to shut up and stop confusing our devs with new shit every single day hahahhahaha

Dworgi ยท 9 points ยท Posted at 09:20:23 on March 27, 2019 ยท (Permalink)

You're the reason everything is slow now...

Inspector-Space_Time ยท 33 points ยท Posted at 05:59:52 on March 27, 2019 ยท (Permalink)

Imagine throwing an entire group under the bus because of the bad ones. I'm a web developer and you have no idea how much of the industry is centered around just performance. Every technology has shitty developers that make slow programs. Stop being an asshole to a profession you obviously know little about.

How the fuck is this garbage upvoted anyways? Bunch of immature circle jerkers.

Dworgi ยท 8 points ยท Posted at 09:40:48 on March 27, 2019 ยท (Permalink)

If you ask me, web developers have earned their reputation with their fucked up ecosystem. Left-pad comes to mind.

As does Node.js and this blinkered belief that JS is anything but a necessary evil.

Prawny ยท 5 points ยท Posted at 09:56:24 on March 27, 2019 ยท (Permalink)

If you ask me, web developers have earned their reputation with their fucked up ecosystem. Left-pad comes to mind.

I've never used Node to build a website. Why should I be tarred with this brush?

Dworgi ยท -5 points ยท Posted at 10:11:15 on March 27, 2019 ยท (Permalink)

Because apparently you've used Node for something else?

At least the web devs have frontend JS as an excuse. What's yours?

Prawny ยท 1 points ยท Posted at 10:14:55 on March 27, 2019 ยท (Permalink)

I wrote a Discord bot.

Dworgi ยท -3 points ยท Posted at 10:23:11 on March 27, 2019 ยท (Permalink)

Discord = Electron = web

Prawny ยท 2 points ยท Posted at 10:58:09 on March 27, 2019 ยท (Permalink)

The (non web version) of the Discord client is built with Electron, yes. You do realise that when you access services via APIs, you don't connect to client nodes directly, right?

Tenemo ยท 3 points ยท Posted at 09:50:23 on March 27, 2019 ยท (Permalink)

"Fucked up ecosystem" that allows a single dev who knows what he's doing to create full-stack, secure, fast web applications(not just sites) in days or weeks? The ecosystem nowadays is incredible, everything got automated, minification, package updates, polyfilling, CSS pre-processing - and there's TypeScript too! - obviously you can import 100 useless packages and make it awful, but the dev experience is amazing. Try creating a complex web form with validation and user registration 10 years ago that would work on all major browsers, it is incomparable to today.

Devildude4427 ยท 3 points ยท Posted at 10:27:37 on March 27, 2019 ยท (Permalink)

Iโ€™m going to beg to differ with โ€œsecure and fastโ€. NPM has shown potential to have massive vulnerabilities, yet web devs add them to the project like a fat kid with a bag of candy.

Dworgi ยท 1 points ยท Posted at 10:08:19 on March 27, 2019 ยท (Permalink)

Does that single dev understand even 1% of the lines of code he runs? Could he list 1% of the packages in his node-modules?

And if you pored over every line that your web app runs, how many could you eliminate that actually do literally nothing in your use case? What is the bare minimum amount of code that runs your webapp? Would it be faster if written that way, even without all your minification and CSS pre-processing?

Could you have written it from scratch?

If the answer to that last one is no, then I'm pretty worried, because algorithmically websites are simple. The programmers are no longer in control, they're just cargo culting and slapping pieces of things together and hoping it works. In fact, they're no longer even really programmers since they don't understand the code or write most of it, so let's call them something else.

How about... web developers?

not_a_reposted_meme ยท 1 points ยท Posted at 12:42:55 on March 27, 2019 ยท (Permalink)

Yo, I just wrote a jQuery pagination plug-in from scratch. Not sure why but it sounded more fun then importing one of the several libraries that would have done the same thing.

Also, you can build site's with drag n drop and be a 'web developer' but it might be harder to find a new job if that's the extent of your knowledge.

Dworgi ยท 1 points ยท Posted at 12:54:58 on March 27, 2019 ยท (Permalink)

Personally, I think all programmers should implement at least the simple version of everything they use once. It'll teach you where the real problems are, and give you some healthy respect for libraries.

Even things like a list should be implemented once, because it's a great learning experience.

So good for you, next time you can evaluate libraries better, or just decide not to use one.

Hollowplanet ยท 0 points ยท Posted at 10:40:46 on March 27, 2019 ยท (Permalink)

None of that is true. I'm a full stack developer. Frontend, backend, mobile native, desktop, whatever - I've done it. Web development these days is just as hard and complex as other types of developmet.

Dworgi ยท 2 points ยท Posted at 11:00:22 on March 27, 2019 ยท (Permalink)

There's such a thing as unnecessary complexity.

Hollowplanet ยท 0 points ยท Posted at 12:02:59 on March 27, 2019 ยท (Permalink)

Yeah as with most things in life it can be done poorly. I don't think copy and pasting JS files in a big unstructured mess was the pinnacle of web development. What we have now is definitely better.

Tenemo ยท 0 points ยท Posted at 14:29:30 on March 27, 2019 ยท (Permalink)

Node ecosystem with webpack and compilers/minifiers with their plugins allow dynamic removal of unused code and/or even splitting the code to serve the most important parts first, so the page loads using less code (critical CSS, server-rendered first response and other approaches). I'm feeling like you are beating the strawman of webdev that you made, website optimization is a huge field and many complex apps can be brought down to several hundred kilobytes, despite using thousands of packages during build process.

Does that single dev understand even 1% of the lines of code he runs?

If the dev were sit for months and look through all the used packages down to the bone, he sure would "understand", but usually devs never look at most of the code that is run. I don't see how is it much different from other languages using 3rd party libraries, compilers and frameworks, I don't expect a C++ dev to spend half a year reading through the compiler code and "understanding" it. There is a problem with JS "culture" of including more packages than necessary and relying on open-sourced code to be safe, this is something that people are aware of and good devs try to limit the number of 3rd party packages used in live prod code. There are billions of pages on the web and many people developing them aren't incredibly experienced. You don't have tens of millions of new public(!) C programs written each month.

algorithmically websites are simple

I'm not sure what "algorithmically simple" is supposed to mean. Webapps are, as the name suggests, practically full-blown applications that run in the browser, sometimes more complex than the ones you run on desktop. You're telling me a dev could sit down and write a reddit/facebook clone with pure HTML/CSS and JS without modern Node.js tooling and with what, jQuery? Sure they could, but the code would be a mess and it would take weeks and weeks more than it would for a competent React/Angular/Vue dev. A good example would be form cross-validation, where fields depend on each other and errors differ based on what was input where. It used to be incredibly annoying to implement that well (and fast, with validation after every keystroke), nowadays using advanced state management like Redux you can easily save the state of the forms between sessions or sync with the server, it's just amazing how much easier many tasks like that got.

Dworgi ยท 2 points ยท Posted at 14:40:17 on March 27, 2019 ยท (Permalink)

I'm saying that compared to, say, a fluid simulation most websites are just CRUD apps.

But CRUD apps are boring to write, so smart programmers will invent a more interesting problem and attempt to solve that. Hence Angular, React, webpack, Vue, etc.

If those smart programmers had solved just the problem they were assigned, I sometimes wonder if we'd be ahead or behind of where we currently are. There'd certainly be less frameworks, and no Electron. So that'd be positive.

As for third party libraries - sure, not all get read. But a C# project might have 50 libraries at the outside. A C++ project might have 10. How big does a node-modules folder get?

As for the field of website optimization - it's kind of a joke as long as the web runs on JS.

baldurFromRoom29 ยท 3 points ยท Posted at 10:05:16 on March 27, 2019 ยท (Permalink)

thats an asshole comment, nobody is forcing you to use js

Dworgi ยท -4 points ยท Posted at 10:09:56 on March 27, 2019 ยท (Permalink)

I don't.

Nor should anyone else.

Hollowplanet ยท 2 points ยท Posted at 10:41:24 on March 27, 2019 ยท (Permalink)

Evjoy the internet without js.

baldurFromRoom29 ยท 1 points ยท Posted at 10:10:41 on March 27, 2019 ยท (Permalink)

can you tell me why.

Dworgi ยท -2 points ยท Posted at 10:21:29 on March 27, 2019 ยท (Permalink)

It's an inconsistent (0 == []), half-baked (===) abortion of a language. Current best practices for developing in the language explicitly forbid actually writing the language, instead using any one of the better wrapper languages (eg. TypeScript) or transpiling a better language to a tiny subset of predictable JS (ASM.JS).

Less a language, more of an idea graveyard.

AlexWIWA ยท 19 points ยท Posted at 02:51:22 on March 27, 2019 ยท (Permalink)

I blame bootcamps because I'm an old curmudgeon.

[deleted] ยท 29 points ยท Posted at 03:45:41 on March 27, 2019 ยท (Permalink)

[deleted]

AlexWIWA ยท 13 points ยท Posted at 03:50:04 on March 27, 2019 ยท (Permalink)

They do now ๐Ÿคท๐Ÿปโ€โ™€๏ธ

But performance is hard when you're not even taught that nesting for loops is bad.

But like I said, I'm just a curmudgeon.

Allegorithmic ยท 14 points ยท Posted at 05:04:38 on March 27, 2019 ยท (Permalink)

In what language is nested for loops inherently bad?

ccfriden ยท 15 points ยท Posted at 05:18:12 on March 27, 2019 ยท (Permalink)

Itโ€™s inherently O(n)2 at a minimum so they should definitely be avoided when possible.

oklujay ยท 3 points ยท Posted at 08:27:05 on March 27, 2019 ยท (Permalink)

Array methods with lambdas for iteration are also less performant that plain for loops.

Nested for loops are least of your problems.

EMCoupling ยท 4 points ยท Posted at 07:56:09 on March 27, 2019 ยท (Permalink)

Depends on the application. If you're only ever reading 10 items for a given operation then n2 vs n doesn't really matter.

azachiell ยท 3 points ยท Posted at 08:30:08 on March 27, 2019 ยท (Permalink)

Yeah and there are dynamic programming issues which take even longer than O(n2)

EMCoupling ยท 6 points ยท Posted at 08:38:35 on March 27, 2019 ยท (Permalink)

Exactly. O(n2) for matrix math is better than the naive O(n3) implementation. So it's really all about context.

Devildude4427 ยท 2 points ยท Posted at 10:30:16 on March 27, 2019 ยท (Permalink)

And thatโ€™s what leads us here. Node_Modules == a bunch of people saying โ€œperformance doesnโ€™t really matter hereโ€

MuskasBackpack ยท 1 points ยท Posted at 12:43:11 on March 27, 2019 ยท (Permalink)

Are there certain cases where itโ€™s alright? I was working on an application recently and came across a problem where it was the only solution I could come up with. I know in this scenario itโ€™s not going to cause any big performance issues because itโ€™s a an array of 3 items and then an array of 18 within each, but I still keep wondering if itโ€™s something I should never do.

Ramora_ ยท 1 points ยท Posted at 18:20:13 on March 27, 2019 ยท (Permalink)*

There are plenty of problems for which the best known sollution is O( N2 ). Just one example, computing the optimal alignment between two strings of size n. There is nothing fundementally wrong with nesting for loops.

In general, time complexity analysis is overrated. You are probably better off implementing things in the simple, obvious, and easily maintained way first, strongly emphasizing simplicity and correctness over efficiency. You should then profile your code/application and figure out where the bottlenecks are. Once you have done that, feel free to come up with more clever and efficient sollutions that address those performance problems.

Devildude4427 ยท 0 points ยท Posted at 10:29:03 on March 27, 2019 ยท (Permalink)

All. Unless you really need to touch every single element, donโ€™t do it.

[deleted] ยท -9 points ยท Posted at 05:32:37 on March 27, 2019 ยท (Permalink)

Literally anyone who has written more than 5 lines of code knows nested loops are (generally) bad. You donโ€™t need a CS degree for that. Also they barely teach you anything practical in CS courses, not for me nor any of my coworkers, and we all went to great competitive schools

Dworgi ยท 0 points ยท Posted at 09:45:40 on March 27, 2019 ยท (Permalink)

Practical, probably not. Useful, definitely should have.

Registers, caching, pipelining, compiler optimisations (and limits thereof) - all useful low level knowledge for understanding performance.

Data structures, algorithms, operating systems - all useful higher level knowledge.

They didn't teach you to write code, or even what code to write, but they did give you the tools to evaluate code more deeply than any bootcamp would. They taught you the why, not the what.

It's unfortunate that you took up a slot that someone more intelligent might have made more use of.

[deleted] ยท 3 points ยท Posted at 14:36:56 on March 27, 2019 ยท (Permalink)*

I just donโ€™t drink the bullshit cool aid professors are feeding kids, and were feeding me for years. And I donโ€™t buy the condescending bullshit about โ€œjust because youโ€™re too dumb to use it doesnโ€™t mean itโ€™s dumbโ€ most of the issues we run into we go online and learn the specifics of it. Itโ€™s 2019, literally nothing in school canโ€™t be found online or in a book , in greater depth too. That 4 unit course that touches on some of these topics isnโ€™t useful for shit when you truly need to understand a lower level topic in a real life production problem.

Tell any experienced senior like myself about all the data structure and algorithmtm are useful for work and theyโ€™ll laugh you out of the room

Dworgi ยท -1 points ยท Posted at 15:30:15 on March 27, 2019 ยท (Permalink)

Maybe you laugh people out of the room because you're actually in IT, not programming. Copy-paste the same setup scripts and config files, boot your server up and die a little inside as you realize that your job will eventually be replaced by a small setup script as well.

[deleted] ยท 3 points ยท Posted at 15:36:45 on March 27, 2019 ยท (Permalink)

Didnโ€™t know working with data scientists to create the backend for financial software used by many banks and hedge funds is IT and not real programming. You learn something new everyday! Who knew a small script could replace what took a 400 employee company 6 years to make!

Fuck off you gate keeping condescending piece of shit. Go back to maintaining legacy code and writing shit no one cares about in puretm C and make less 100k till the end of time like the salty loser that you are. People like you are a cancer to programming

onan ยท 1 points ยท Posted at 04:11:46 on March 27, 2019 ยท (Permalink)

The question isn't whether it teaches you how to do that. More important is that it teaches you not to do that.

DXMHAF ยท 3 points ยท Posted at 04:36:21 on March 27, 2019 ยท (Permalink)

You mean to not make them single paged?

onan ยท -16 points ยท Posted at 04:40:16 on March 27, 2019 ยท (Permalink)

I mean that if "web app" exists anywhere in your world, you have already set foot on the wrong path.

ReelAwesome ยท 15 points ยท Posted at 04:47:11 on March 27, 2019 ยท (Permalink)
BundleOfJoysticks ยท 9 points ยท Posted at 04:58:24 on March 27, 2019 ยท (Permalink)

In my experience hiring web devs for several years, you're on to something.

This whole thing started with Rails, where you're not allowed to say shit is slow, bandwidth and CPU are free, and precious developers' feefees are more important than anything (it's literally the #1 entry in the Rails doctrine) (also what kind of a demented self-important group of techies has a fucking doctrine)

[deleted] ยท 10 points ยท Posted at 05:36:31 on March 27, 2019 ยท (Permalink)

Find yourself a girl who likes you like that guy likes Ruby

BundleOfJoysticks ยท 1 points ยท Posted at 19:29:09 on March 27, 2019 ยท (Permalink)

Your mom does.

[deleted] ยท 8 points ยท Posted at 05:26:47 on March 27, 2019 ยท (Permalink)

As opposed to CS grads? They literally teach you zero things about practical development in school, if anything bootcampers know way more about clean code than an average CS grad does. blame the seniors (thatโ€™s you) who are teaching kids fresh out of school to develop the way they do

AlexWIWA ยท 2 points ยท Posted at 12:54:35 on March 27, 2019 ยท (Permalink)

When did you go to school? I had to take 40 credits of software development courses that were specific to planning and building large applications on top of the regular CS shit.

There's a much larger emphasis on development now than pure theory.

[deleted] ยท -1 points ยท Posted at 14:28:47 on March 27, 2019 ยท (Permalink)

A top 30 school lets put it at that. Development course are usually electives and rarely taught. Thatโ€™s how all schools are. People learn coding during internships and on the job

AlexWIWA ยท 1 points ยท Posted at 14:41:33 on March 27, 2019 ยท (Permalink)

I said when. That's not how all schools are because mine made me take a lot of these software dev classes as requirements to graduate and it was just a small state university.

Software development 1 and 2 which combined business majors, graphic design majors, IT majors, and CS majors and we had to build something from the ground up for a real client.

I had a class that required me to get an internship or job and hold it for six months. You automatically fail and have to retake it if you get let go for performance reasons.

They also had parts of the program that said choose 3 of these following class options and it was stuff like: web technologies (learning rails, django, etc,) interpersonal and business communications, graphics development, programming languages (learn a bunch of languages), database admin.

If we had this conversation in the 90's or even late 00's you'd be 100% right. But they've recently started requiring less high-level theory and allowing or requiring software dev courses. For instance, I took web tech instead of discrete math (I was too dumb for discrete.)

As a side note, I've only been graduated for three years, so I am by no means the seniors you speak of.

An_Anonymous_Acc ยท 7 points ยท Posted at 02:24:16 on March 27, 2019 ยท (Permalink)

Are you a web developer? How do you personally improve performance?

BundleOfJoysticks ยท 31 points ยท Posted at 05:09:17 on March 27, 2019 ยท (Permalink)

1) measure, don't guess. What's slow? What's using up ram? What's delaying Dom ready? Is your code slow? Where? Why?

2) optimize asset loading and injection into the DOM. Are you loading things you don't need? Are you using parallel download connections? Can you defer or lazy load some of those asset loads until they are needed?

3) Are you taking advantage of caching in your bundles? E.g. can you serve jQuery or React off Google or Facebook CDNs? People probably already have those cached so it may help you.

4) do you need all that shit? Is it really that crucial to update pretty timestamps on 50 items on the page synchronously every second? (Probably not)

5) do you really need all that shit? Share buttons, mixpanel, Google analytics, that referral tracking js marketing wants, that email tracking code sales wants, and a dozen more beacons?

6) do you actually need all that shit?

7) do you need to use react components for everything? Can you render some content server side? Can you inject innerHTML instead?

Measure the impact of all your changes. Keep what helps, toss what doesn't.

That's the basics. Fix that then come back to us.

Edit: measure everything. Don't guess. Programmers SUCK at guessing what's slow. If you're tackling the wrong issue, you're wasting time. Use a profiler.

Prawny ยท 2 points ยท Posted at 09:58:04 on March 27, 2019 ยท (Permalink)

And after all that you move on to server performance!

BundleOfJoysticks ยท 1 points ยท Posted at 19:24:56 on March 27, 2019 ยท (Permalink)

Hopefully the back end team is working on that in parallel.

not_a_reposted_meme ยท 1 points ยท Posted at 12:47:25 on March 27, 2019 ยท (Permalink)

When 5 and 6 are decided with little to none of my input the answer is yes, unfortunately.

BundleOfJoysticks ยท 1 points ยท Posted at 19:23:34 on March 27, 2019 ยท (Permalink)

Aight that leaves all the other bullets :)

Tomnnn ยท 10 points ยท Posted at 03:43:06 on March 27, 2019 ยท (Permalink)*

Well modern hardware takes a lot to slow down if it's something that is working as intended without extraneous loops or synchronous code.

I'm working on an absolute potato at work and I'm constantly in awe at the network tab and the unending eruption if error messages in the console on some pages. There's something wrong with our code or our jQuery version / library because there's like a million "asdf1235 is not a function!" Messages (lots of random letters and numbers) when we load a large collection of stuff.

Or a ton of redundant network requests for the same resource a million times when ever something loads. It loads from the browser cache but it still clutters the network tab.

So speeding things up is usually just cutting down on the number of loops you have, make sure any polyfill libraries you have aren't overwriting the native method if it exists, and threading / forking your server if a handful of synchronous calls are causing the slow down.

I think in a task I had to make a page faster I wrapped a bunch of legacy code in promises so the browser wouldn't freeze and I broke up isolated code on the server with forking to reduce the wait time to whatever call took the longest. I didn't shave to much time off, maybe like 5 seconds, but I served the loading screen without waiting for that forked call to finish so the clients didn't see their browser freeze for 20 seconds before even getting to the loading page lol.

troglo-dyke ยท 10 points ยท Posted at 06:55:15 on March 27, 2019 ยท (Permalink)

Because modern web developers have no idea what theyโ€™re doing and donโ€™t care about performance at all.

Erm...a large bundle size has nothing to do with performance; it might affect the perceived load time but there are pretty simple was to speed up the perceived load time for a bundle which takes a long time to load.

Your comment equates to "this game is 60Gb therefore it is slow"

Dworgi ยท -1 points ยท Posted at 09:24:04 on March 27, 2019 ยท (Permalink)

Except games actually spend time optimizing.

And partially, yes. Less data is probably going to be faster. If you cut all your 4K LOD0 textures out, then you'll never start pre-emptively loading a 4K texture, thus eating up 4 times more loading bandwidth than a 2K texture.

Not to mention your download size will probably be 45GB now.

mastocles ยท 1 points ยท Posted at 09:53:03 on March 27, 2019 ยท (Permalink)

The other day I needed an chevron sticking out of a card (an arrow like for tooltips). My first reaction was to see if there was anything that already existed and there was, but in hundreds of JS lines. It took 6 lines of CSS. Such a weird feeling.

[deleted] ยท 0 points ยท Posted at 01:51:04 on March 27, 2019 ยท (Permalink)

Aptly said

Hatshepsut420 ยท 5 points ยท Posted at 11:49:27 on March 27, 2019 ยท (Permalink)

Because you can download that bundled 1 megabyte of JS once and then cache it and only update what is necessary when the site updates, all thanks to service workers.

Because in SPA's there's no HTML and CSS, it's all bundled in JS.

Because the amount of pictures and videos on an average page makes any arguments against bloated JS laughable.

Because the size of node modules means absolutely nothing in production.

stang90 ยท 1 points ยท Posted at 13:13:51 on March 27, 2019 ยท (Permalink)

People are still caught up in how bad js was 10 years ago.

BundleOfJoysticks ยท 8 points ยท Posted at 04:53:52 on March 27, 2019 ยท (Permalink)

The even question is how did they perform the miracle of serving jQuery, lodash, react, redux, and 500 react components in less than 10MB? Because, hey, bandwidth and CPU are cheap, why spend precious human developer time trying to optimize anything for performance?

[deleted] ยท 8 points ยท Posted at 05:44:03 on March 27, 2019 ยท (Permalink)

Nah man the only right way to do it all is in pure C because it takes 300mb less ram and runs 10ms faster. No it doesnโ€™t matter that it takes 2 months to make the same thing developers today can make in two days, because performance. We also never see ram more than 1gb nowadays so we gotta do everything to save that precious memory

Dworgi ยท 3 points ยท Posted at 09:49:55 on March 27, 2019 ยท (Permalink)

I mean, meet me halfway and only pull in 500,000 node-modules instead of a round million?

[deleted] ยท -1 points ยท Posted at 14:30:31 on March 27, 2019 ยท (Permalink)

Who cares about how much node modules you have on your development machine? Are you suddenly worried about 2gb of storage in 2019? Webpack tre shaking only uses the functions you use in your code from node modules, itโ€™s not like the entire folder is going to production

Dworgi ยท 2 points ยท Posted at 14:34:17 on March 27, 2019 ยท (Permalink)

Of course I care. Code is a necessary evil to accomplish a goal, and thus should be a quantity that you minimize.

A solution with 2 KB of code is probably several orders of magnitude better than one with 2 GB of code.

It's scary that this isn't obvious to everyone.

[deleted] ยท 0 points ยท Posted at 14:39:46 on March 27, 2019 ยท (Permalink)

Sometimes people donโ€™t want to spend 2 months and risk having half a dozen bugs when they could do the same with tried and tested node modules in two days and no risk of bugs

Also do you understand 2gb node modules doesnโ€™t translate to 2gb of code? Do you even know what treeshaking is? You probably donโ€™t

Dworgi ยท 2 points ยท Posted at 14:44:00 on March 27, 2019 ยท (Permalink)

"No risk of bugs". Except apocalyptic ones like left-pad or Heartbleed?

Plus, you have an awful lot of faith in the quality of your libraries.

And yes, I know what tree shaking is. I am curious, though, do you think you could implement it? Or is this another thing you're just taking on faith.

[deleted] ยท 1 points ยท Posted at 14:53:16 on March 27, 2019 ยท (Permalink)

I donโ€™t use random libraries, also you canโ€™t just cite freak accidents as evidence to a pattern of problems. Apocalyptic shit happens everywhere all the time, including when you write everything yourself. What matters if there is a pattern of bad shit, which there isnโ€™t one. I do implement tree shaking, import {blah} from โ€œblahโ€is standard es6 and webpack 4 optimizes for it by default. I use tried and tested known libraries made by devs that have put years of work creating these libraries that handle complex tasks Iโ€™m trying to compete. I donโ€™t need to write everything myself.

[deleted] ยท 0 points ยท Posted at 05:59:22 on March 27, 2019 ยท (Permalink)*

[removed]

[deleted] ยท 7 points ยท Posted at 06:02:35 on March 27, 2019 ยท (Permalink)

These are a no brainer, literally everyone including fresh grads know and do this. What kind of weird twisted view of web development do you have? Also I was exaggerating if you didnโ€™t notice, but I was making fun of people who act like we need to optimize software down to the bone as if itโ€™s 2005 and waste months of extra manpower

BundleOfJoysticks ยท 1 points ยท Posted at 19:28:50 on March 27, 2019 ยท (Permalink)

But we do need to optimize. Study after study shows that every 500ms extra time costs real money in the form of abandoned carts, fewer purchases, fewer ad views, etc.

There is NO reason not to optimize. It's fucking lazy and disgraceful.

I bet you don't even measure anything.

[deleted] ยท 1 points ยท Posted at 19:30:34 on March 27, 2019 ยท (Permalink)

Thereโ€™s optimizing and then thereโ€™s rewriting everything to save 10ms adding 4 months to dev time just because everything has to be puretm

BundleOfJoysticks ยท 1 points ยท Posted at 20:04:34 on March 27, 2019 ยท (Permalink)

Nobody is advocating for that.

BundleOfJoysticks ยท 1 points ยท Posted at 19:26:29 on March 27, 2019 ยท (Permalink)*

Saving your precious ass days of work at the measurable expense of end users?

What a great deal.

[deleted] ยท 1 points ยท Posted at 19:31:05 on March 27, 2019 ยท (Permalink)

End users are not gonna notice a difference of 20ms

BundleOfJoysticks ยท 1 points ยท Posted at 20:04:02 on March 27, 2019 ยท (Permalink)

We're not talking about 20ms. We're talking about whole seconds.

Try loading massdrop. It takes 5-8 seconds on my modern machine with fast internet.

Hawxe ยท 1 points ยท Posted at 23:51:15 on March 27, 2019 ยท (Permalink)

Or discord, something everyone uses.

Gnago ยท 443 points ยท Posted at 23:34:12 on March 26, 2019 ยท (Permalink)

laughs in asp.netโ€™s 7 MB for a hello world program

THANKYOUFORYOURKIND ยท 52 points ยท Posted at 05:37:26 on March 27, 2019 ยท (Permalink)

I guess asp.net has nicer shoes then?

TheSpiffySpaceman ยท 3 points ยท Posted at 14:36:42 on March 28, 2019 ยท (Permalink)

they're cement shoes

atomicpenguin12 ยท 156 points ยท Posted at 02:49:54 on March 27, 2019 ยท (Permalink)

With Angular, you can turn your website into 2 GB of Javascript!

Qinistral ยท 29 points ยท Posted at 04:03:59 on March 27, 2019 ยท (Permalink)

Doesn't Angular support lazy-loading of the JS templates?

[deleted] ยท 22 points ยท Posted at 03:10:31 on March 27, 2019 ยท (Permalink)

At least it's a proper application. I'll take it for just 2 gigs

Tomnnn ยท 27 points ยท Posted at 03:44:07 on March 27, 2019 ยท (Permalink)

That would suck if someone on a 2gb data plan visited and then no more internet.

StevenC21 ยท 2 points ยท Posted at 06:45:27 on March 27, 2019 ยท (Permalink)

๐Ÿ‘‹

[deleted] ยท 0 points ยท Posted at 07:57:09 on March 27, 2019 ยท (Permalink)*

[deleted]

Strange_Temperature ยท 94 points ยท Posted at 00:59:13 on March 27, 2019 ยท (Permalink)

I know programmerhumor isn't the place for this, but is there a tool that analyses code coverage as a % of each npm package? Such a tool would be priceless in cutting down application file size.

Could also let you experimentally remove large unused parts of libraries, store the transformations and reapply them on library updates or after adding a new dependent package.

An_Anonymous_Acc ยท 65 points ยท Posted at 02:28:36 on March 27, 2019 ยท (Permalink)

I believe you're talking about tree shaking. It doesnt show you % coverage, but it does remove unused parts of libraries.

_3psilon_ ยท 8 points ยท Posted at 05:10:48 on March 27, 2019 ยท (Permalink)

It's not the same. Eg. webpack-stats-analyzer can give you JS sizes but won't tell you coverage. It would be interesting to run your app and see how many % of your libs go unused.

Plus not all libraries support tree-shaking plus it might take considerable work to migrate.

Most of the time devs should think about more lightweight lib alternatives... Or not using a lib at all. (Except lodash. Oh boy, it's so goood.... :))

NeverMakesMistkes ยท 2 points ยท Posted at 05:32:08 on March 27, 2019 ยท (Permalink)

You might not need lodash either. At least you don't need all of it.

Guisseppi ยท 1 points ยท Posted at 07:56:27 on March 27, 2019 ยท (Permalink)

Or you can take what you need and treeshake the rest

NeverMakesMistkes ยท 2 points ยท Posted at 08:25:55 on March 27, 2019 ยท (Permalink)

Sure, that's what I sort of implied with the "don't need all of it" :) Sadly, though, lodash internally uses stuff like its own forEach/map implementations, so you can't really get rid of those. TBH if it was just a few functions I would just reimplement them myself.

Anyway, if you do happen to use lodash and webpack, here's a quick tip: you can get even smaller bundles with babel-plugin-lodash, it tends to work better than just tree shaking.

Guisseppi ยท 1 points ยท Posted at 09:30:22 on March 27, 2019 ยท (Permalink)

Iโ€™m familiar with the plugin, in fact I have dwelled into lodashโ€™s implementation and found that same re-use pattern in other implementations like flatten and flattendeep

_3psilon_ ยท 1 points ยท Posted at 12:55:57 on March 27, 2019 ยท (Permalink)

True, I was exaggerating. :)

Strange_Temperature ยท 12 points ยท Posted at 02:32:18 on March 27, 2019 ยท (Permalink)

That sounds potentially disastrous with some of the crap quality code that makes itself into the npm modules directory. I'd have thought it would be better to have some manual involvement

An_Anonymous_Acc ยท 13 points ยท Posted at 02:39:43 on March 27, 2019 ยท (Permalink)

Why do you think it could be disastrous? I believe webpack does it automatically now if you use new es2015 syntax for imports like import { function1, function2 } from "library/functions";

Strange_Temperature ยท 3 points ยท Posted at 02:42:09 on March 27, 2019 ยท (Permalink)

I've seen some libraries do old c style single setup / include code, but now that I think about it, shouldn't be effected by this. It just may not work on it. Also that's cool, I didn't know that.

SPAs are still so big tho

kardnumas ยท 2 points ยท Posted at 06:18:53 on March 27, 2019 ยท (Permalink)

you can see code coverage in chrome after analyzing you can cut off unused js

Geldan ยท 3 points ยท Posted at 04:43:19 on March 27, 2019 ยท (Permalink)

You can tell Webpack to spit out a stats object that can be analyzed like you are suggesting. There are a few visualizations for it such as: http://webpack.github.io/analyse/

x0r1k ยท 1 points ยท Posted at 06:58:24 on March 27, 2019 ยท (Permalink)

It's hard to say what is used in some library. You can use chrome, but usually you have your external dependencies in one js file. So you need to split it before analysing

troglo-dyke ยท 1 points ยท Posted at 07:05:23 on March 27, 2019 ยท (Permalink)

You can use tools like depcheck which will list unused dependencies.

I do remember using a tool which output a graph of how much a dependency is used compared to its size - but I can't seem to find the name at the moment.

Jeb_Jenky ยท 28 points ยท Posted at 00:48:31 on March 27, 2019 ยท (Permalink)

I need to know where he got that bag.

Kazumara ยท 27 points ยท Posted at 04:57:37 on March 27, 2019 ยท (Permalink)

It's from a music video of the thoroughly weird band Deichkind. Might just be a prop.

Jeb_Jenky ยท 3 points ยท Posted at 16:40:48 on March 27, 2019 ยท (Permalink)

I'm not surprised it's German honestly. You just look at the guy and feel it.

schludy ยท 1 points ยท Posted at 10:50:36 on March 27, 2019 ยท (Permalink)*

Deine Eltern sind an einem Tennisturnier.

v____v ยท 5 points ยท Posted at 05:40:00 on March 27, 2019 ยท (Permalink)

There's a Japanese bag along the same lines https://www.plywood.jp/35378001

K1ngjulien_ ยท 2 points ยท Posted at 05:50:42 on March 27, 2019 ยท (Permalink)

But why?

antaryon ยท 9 points ยท Posted at 08:00:55 on March 27, 2019 ยท (Permalink)

There is no word for "why" in Japanese.

Jeb_Jenky ยท 1 points ยท Posted at 16:39:55 on March 27, 2019 ยท (Permalink)

That's awesome. "Backpacker's closet" haha!

hutilicious ยท 25 points ยท Posted at 05:36:16 on March 27, 2019 ยท (Permalink)

Love you for using Deichkind as a meme

pandemoniker ยท 29 points ยท Posted at 06:07:44 on March 27, 2019 ยท (Permalink)

Richtig gutes Zeuch, gefรคllt mir

pxlmess ยท 21 points ยท Posted at 06:28:05 on March 27, 2019 ยท (Permalink)

Da musst du richtig lange suchen fรผr

KreiswichsWegwerf ยท 15 points ยท Posted at 06:49:42 on March 27, 2019 ยท (Permalink)

Richtig lange recherchiiieeern

_N0x ยท 7 points ยท Posted at 07:47:09 on March 27, 2019 ยท (Permalink)

ja gut, gut, gut

smeikx ยท 6 points ยท Posted at 08:06:07 on March 27, 2019 ยท (Permalink)

echt

bromanclature ยท 32 points ยท Posted at 03:08:08 on March 27, 2019 ยท (Permalink)

Hey, hello world ainโ€™t free!

RastaLasagna ยท 13 points ยท Posted at 05:35:00 on March 27, 2019 ยท (Permalink)

I wish more web developers would follow the philosophy of http://motherfuckingwebsite.com - well, not that far, but still not as ridiculously bloated as they are today

Prawny ยท 10 points ยท Posted at 10:04:36 on March 27, 2019 ยท (Permalink)

If only clients didn't exist.

MittenMagick ยท 3 points ยท Posted at 09:46:40 on March 27, 2019 ยท (Permalink)

I would honestly love something kind of like PiHole, but instead of ads, it was anything and everything that wasn't straight HTML. I get that I'd lose a lot of functionality, but I would love to see how websites load when there's only a couple kBs of text to load instead of a ton of JS and CSS.

poisonousemu ยท 2 points ยท Posted at 16:18:48 on March 27, 2019 ยท (Permalink)

You could always disable JS in your browser. It kind of breaks the modern internet, but it will accomplish what you're looking for.

MittenMagick ยท 2 points ยท Posted at 17:42:00 on March 27, 2019 ยท (Permalink)

Wouldn't that still load their .js files though? I'll admit that web design is where I get out of my comfort zone.

lau6h ยท 3 points ยท Posted at 11:59:38 on March 27, 2019 ยท (Permalink)
dazedAndConfusedToo ยท 9 points ยท Posted at 04:26:54 on March 27, 2019 ยท (Permalink)

Heh, he's carrying his webpack

coladict ยท 17 points ยท Posted at 04:43:34 on March 27, 2019 ยท (Permalink)

"Single-page webapps are the future, man!" - everyone 2-3 years ago.

c0wb0yc0d3r ยท 10 points ยท Posted at 05:20:54 on March 27, 2019 ยท (Permalink)

Have you heard about our Lord and savior, Electron?

Lafreakshow ยท 5 points ยท Posted at 09:31:10 on March 27, 2019 ยท (Permalink)*

Whatever happened to writing real desktop apps in something like Java? Or at least on the JVM. The footprint is smaller and the effort comparable. At least from my experience. Can do that even better, use kotlin with TornadoFX and FXML to cut 50% of code in one swoop. Yes that means to include another framework but that framework is something like 1000x lighter than Electron. There's also C# which I hear is decent for multiplatform projects nowadays.

deception_lies ยท 7 points ยท Posted at 10:16:36 on March 27, 2019 ยท (Permalink)

It shows how deep we've gotten when a Java application is lauded as the lightweight option.

The scary thing is that, even as a C embedded developer, I agree with you. That's how bad things are!

Lafreakshow ยท 2 points ยท Posted at 10:21:01 on March 27, 2019 ยท (Permalink)

With how resources aren't scarce on consumer PC's any more I always thought the JVM is the ideal trade off between platform independence and performance. Then Electron came around and took the whole thing to the insane. I'm still not sure if I'm overlooking something or if developers nowadays are just lazy (saying this a 24 year old student, lol). Ah who am I kidding, It's about money. Must be cheap to build an Electron App.

deception_lies ยท 2 points ยท Posted at 10:33:54 on March 27, 2019 ยท (Permalink)

It's cheap enough, plus you can hire a dormfull of "web developers" for the same money that'd get you one real programmer >:]

K1ngjulien_ ยท 1 points ยท Posted at 11:54:16 on March 31, 2019 ยท (Permalink)

The problem is not that electron is bad, its just hard to build a lightweight, performant electron app (see VSCode)

themuzzotheory ยท 1 points ยท Posted at 10:18:37 on March 27, 2019 ยท (Permalink)

I don't know how but every single time I have to use something written with Java, not only it's slower, it's actually worse than Electron stuff. Maybe Android apps are an exception or something, or Java stuff hides the fact that it's Java so I'm not grumpy when using it.

Lafreakshow ยท 1 points ยท Posted at 10:24:54 on March 27, 2019 ยท (Permalink)

Ever used JetBrains Stuff? That's mostly Java. So yeah the hiding the Java nature might be the reason. It may also be down to a combination of Java just being terribly slow until rather recently and terrible developers.

Slower compared to native stuff? Yes. Slower than Electron? not necessarily. But certainly more lightweight than Electron. That's what annoys me about electron. It's just wasting resources. Saying this a laptop user primarily. VS Code saps the life out of my battery much faster than even the much more feature packed IntelliJ.

krazyhawk ยท 9 points ยท Posted at 03:18:33 on March 27, 2019 ยท (Permalink)

Here I am sweating over keeping my compiled JS under 200kb on one of my sites, haha. (It's at 198kb for the curious :P)

_3psilon_ ยท 7 points ยท Posted at 05:12:23 on March 27, 2019 ยท (Permalink)

200k is good even gzipped. But then you discover 800k of CSS :)

BundleOfJoysticks ยท 2 points ยท Posted at 05:14:03 on March 27, 2019 ยท (Permalink)

Heretic

TehVulpez ยท 6 points ยท Posted at 04:17:45 on March 27, 2019 ยท (Permalink)

what was even happening in the source image?

aenogym ยท 7 points ยท Posted at 05:35:51 on March 27, 2019 ยท (Permalink)

As /u/kazumara already said:

It's from a music video of the thoroughly weird band Deichkind.

WafflesAndKoalas ยท 5 points ยท Posted at 04:19:48 on March 27, 2019 ยท (Permalink)

I just wanted to say those shoes look weird to me

Okay, thanks, bye

Kazumara ยท 9 points ยท Posted at 04:55:55 on March 27, 2019 ยท (Permalink)

It's from a music video of the thoroughly weird band Deichkind.

jmwpc ยท 2 points ยท Posted at 04:45:28 on March 27, 2019 ยท (Permalink)

Ok good Iโ€™m not the only one.

marwarii ยท 4 points ยท Posted at 04:23:28 on March 27, 2019 ยท (Permalink)

500MB for footer styling only.

who_you_are ยท 14 points ยท Posted at 00:37:45 on March 27, 2019 ยท (Permalink)

2GB minimized and compressed !

pv42 ยท 5 points ยท Posted at 03:24:36 on March 27, 2019 ยท (Permalink)

+500MB decompression code

lmao_react ยท 1 points ยท Posted at 07:40:51 on March 27, 2019 ยท (Permalink)

nginx

murtrex ยท 15 points ยท Posted at 04:09:31 on March 27, 2019 ยท (Permalink)

Nobody is serving up 2 gigs of JavaScript.

_3psilon_ ยท 6 points ยท Posted at 05:14:40 on March 27, 2019 ยท (Permalink)

No, but a node_modules folder can indeed easily get to 1+ gigs with all the non-minified, uncompressed sources.

Just set up a hello project with Angular CLI and see the magic. Then compare to Vue. ;)

[deleted] ยท 15 points ยท Posted at 05:48:19 on March 27, 2019 ยท (Permalink)*

Who gives a shit about the node modules folder during development? What youโ€™re worried about 2gb of storage in 2019? Also this whole large node modules thing is what Webpacks tree shaking is for. It compiles relevant code and only functions you used from the modules in a minified file.

[deleted] ยท 8 points ยท Posted at 08:03:22 on March 27, 2019 ยท (Permalink)

[deleted]

Hollowplanet ยท 2 points ยท Posted at 10:56:09 on March 27, 2019 ยท (Permalink)

5mb is a lot for a web page.

_3psilon_ ยท 3 points ยท Posted at 12:55:06 on March 27, 2019 ยท (Permalink)

Who gives a shit?

  • OP
  • Webpack build time
  • yarn/npm operations time
  • page load times, so users & ISPs
  • developers who think this is unnecessary bloat, since your node_modules size will be proportional to your bundle size

Also, tree shaking is not a silver bullet. It only makes a difference if the library supports it by packaging the functions into separate files or separate, side-effects free exports in the same file that you can and do import separately, not with import *. See here

[deleted] ยท 3 points ยท Posted at 14:26:52 on March 27, 2019 ยท (Permalink)

Oh nos webpack takes 6 seconds to build instead of 2 seconds after every deployment, woah in 2019 2gb is too much bloat on your professional work computer, oh woah a 2mb JS file is the end of the world with modern internet speeds. Who will ever get back the 30 seconds it takes npm/yarn to install all dependencies to a new machine only once

All this stupid shit is fossil devs who learned how to develop 10-20 years ago where resources like ram and storage were extremely limiting bitching and moaning and acting like computer tech is still in the early 2000s. It isnโ€™t. Everything is much bigger and faster, making it easier to develop the awesome, extremely complex websites we have today

stang90 ยท 1 points ยท Posted at 13:17:18 on March 27, 2019 ยท (Permalink)

Every modern library uses es6 modules. I tree shake literally everything. Node modules does not meaningfully correlate to bundle size

Guisseppi ยท 3 points ยท Posted at 08:02:11 on March 27, 2019 ยท (Permalink)

Like the jdk is not including those sweet sweet extra apache libs you needed to get dates working on the shitshow that Java is.

gullinbursti ยท 1 points ยท Posted at 03:45:01 on March 28, 2019 ยท (Permalink)

A โ€œlittleโ€ react app I'm working onโ€ฆ

https://imgur.com/AgA1Wbq

brockisawesome ยท 4 points ยท Posted at 01:43:23 on March 27, 2019 ยท (Permalink)

NEEDS MORE INCLUDES

bonafido ยท 4 points ยท Posted at 04:22:22 on March 27, 2019 ยท (Permalink)

โ€˜npm i moment moment-timezoneโ€™

_3psilon_ ยท 2 points ยท Posted at 05:15:42 on March 27, 2019 ยท (Permalink)

Especially the latter. And there's no tree-shaking support for it. Let me know if you came up with a good solution for custom bundling.

kardnumas ยท 5 points ยท Posted at 06:21:08 on March 27, 2019 ยท (Permalink)

date-fns ?

_3psilon_ ยท 1 points ยท Posted at 18:01:12 on March 27, 2019 ยท (Permalink)

date-fns

Thanks!. Well we're already using moment everywhere (a quik search lists ~150 source files both on server & client), bit this one supports tree shaking at least.

Remgumin ยท 3 points ยท Posted at 05:09:07 on March 27, 2019 ยท (Permalink)

this is targeted harassment

/s

Klappstuhl_Johny ยท 3 points ยท Posted at 06:19:25 on March 27, 2019 ยท (Permalink)

Richtig gutes Zeug

fosefx ยท 3 points ยท Posted at 06:53:40 on March 27, 2019 ยท (Permalink)

Richtig gutes Zeug

anyfactor ยท 3 points ยท Posted at 07:32:19 on March 27, 2019 ยท (Permalink)

I have been waiting for this type of post to ask these basic (probably stupid questions) about frontend dev

  • What are the standards to make js go faster?
  • Should I avoid using framework even if is not convenient for me?
  • Someone was telling me to rather than "cdn" ing bootstrap I should extract relevant class name css stylings? Is this a industry practice?

And what is a efficient a backend framework. How do you guys balance out the learning curve and convenience with performance? I know django and a little bit node, should I learn something like rust, and haskell (I don't even know if they have a web framework) just to be performance oriented?

Hollowplanet ยท 1 points ยท Posted at 11:14:03 on March 27, 2019 ยท (Permalink)

Django is performant enough for instagram and Nasa so its probably performant enough for you.

Hawxe ยท 1 points ยท Posted at 18:35:03 on March 27, 2019 ยท (Permalink)

haskell is fun as fuck you should learn it anyway

CMWAidanx ยท 2 points ยท Posted at 04:44:59 on March 27, 2019 ยท (Permalink)

Iberia, I'm looking at you.

Dreadedsemi ยท 2 points ยท Posted at 05:43:34 on March 27, 2019 ยท (Permalink)

That's how I feel I look after I bought a 17 inch laptop and had to buy a huge backpack .

Argentum118 ยท 2 points ยท Posted at 05:45:44 on March 27, 2019 ยท (Permalink)

I mean... We can a bit more... It's not that much....

Jaikus ยท 2 points ยท Posted at 05:53:49 on March 27, 2019 ยท (Permalink)

"You are over incumbered and can not run."

I_will_draw_boobs ยท 2 points ยท Posted at 06:17:17 on March 27, 2019 ยท (Permalink)

This is my docker container right now in coreOS

joshwcorbett ยท 2 points ยท Posted at 06:26:22 on March 27, 2019 ยท (Permalink)

looks at NPM

karlcoin ยท 2 points ยท Posted at 07:34:00 on March 27, 2019 ยท (Permalink)

The Brave Browser and BAT tokens will fix that!

KoroSexy ยท 2 points ยท Posted at 07:55:40 on March 27, 2019 ยท (Permalink)

<rant>

People seem to always be concerned about the size of the JS but everyone seems to forget about the CPU pressure that the JS applies. Soon, it'll be cheaper on the hardware to play a AAA game compared to loading the site for said AAA game. It's all well and good minifying to reduce on the bandwidth, but that doesn't improve the execution time of said JS. And, a lot of the time, by reducing the complexity/efficiency, you indirectly reduce the amount of JS that you use.

</rant>

themuzzotheory ยท 1 points ยท Posted at 10:21:19 on March 27, 2019 ยท (Permalink)

People whining about JavaScript don't really think about performance more than they think about shitposting, so.

KoroSexy ยท 1 points ยท Posted at 10:38:55 on March 27, 2019 ยท (Permalink)

Basically all of /r/ProgrammerHumor

mudkipslol ยท 2 points ยท Posted at 08:41:34 on March 27, 2019 ยท (Permalink)

Remember having to close your internet browser to play games?

I could see that happening again.

DonTorleone ยท 2 points ยท Posted at 09:59:15 on March 27, 2019 ยท (Permalink)

I remember the time when JS was NO NO. And all that because 2% of people had JS turned off in IE6 or even IE5 ๐Ÿคฃ

ShayminFakeZz ยท 2 points ยท Posted at 12:35:58 on March 27, 2019 ยท (Permalink)

Richtig gutes Zeug

Cunfuu ยท 3 points ยท Posted at 05:12:54 on March 27, 2019 ยท (Permalink)

Laughs in vulnerabilities

Tyjex ยท 2 points ยท Posted at 02:11:03 on March 27, 2019 ยท (Permalink)

Pretty good stuff

Zechs2205 ยท 2 points ยท Posted at 02:33:10 on March 27, 2019 ยท (Permalink)

โ€œThe just a bit moreโ€ got me lmao.

kraftfahrzeug ยท 3 points ยท Posted at 23:58:28 on March 26, 2019 ยท (Permalink)

That's good stuff!

mogoh ยท 5 points ยท Posted at 00:44:07 on March 27, 2019 ยท (Permalink)

Richtig gutes zeug!

seven_seven ยท 1 points ยท Posted at 05:52:23 on March 27, 2019 ยท (Permalink)

WTF is all the JS doing???

Alcohorse ยท 2 points ยท Posted at 06:15:56 on March 27, 2019 ยท (Permalink)

Hamburger animations

seven_seven ยท 1 points ยท Posted at 06:46:25 on March 27, 2019 ยท (Permalink)

Well I do enjoy those.

Dojan5 ยท 1 points ยท Posted at 06:12:45 on March 27, 2019 ยท (Permalink)

Drooping.

thedomham ยท 1 points ยท Posted at 06:51:48 on March 27, 2019 ยท (Permalink)

Really good stuff

Wurstemann ยท 1 points ยท Posted at 07:23:34 on March 27, 2019 ยท (Permalink)

For those who are interested: Pic is a stillimage from the musicvideo "Richtig gutes Zeug" from Deichkind https://www.youtube.com/watch?v=1coEIN7safI

valkek ยท 1 points ยท Posted at 07:34:36 on March 27, 2019 ยท (Permalink)

What are thooooose

Also as someone who recently got put onto a project where they chucked everything into one main.js file with 5000+ lines and wanting to improve performance ... Any tips?

Guisseppi ยท 2 points ยท Posted at 08:03:12 on March 27, 2019 ยท (Permalink)

Modules, tree shaking, and clean code

Edit: the last one refers to Robert C. Martinโ€™s book

Xirzag ยท 1 points ยท Posted at 09:41:06 on March 27, 2019 ยท (Permalink)

That website have a cool css

AaronBonBarron ยท 1 points ยท Posted at 09:57:10 on March 27, 2019 ยท (Permalink)

There isn't a single line of JS in my personal website, websites that take forever to load and slow down my device fucking infuriate me.

If you manage to slow down a core i7 with your garbage, kindly cease this behaviour.

lecrappe ยท 1 points ยท Posted at 21:13:24 on March 28, 2019 ยท (Permalink)

Care to share your URL?

AaronBonBarron ยท 1 points ยท Posted at 22:30:55 on March 28, 2019 ยท (Permalink)

aaronjones.xyz

There's not much content yet,but most of the functionality is there.

use_your_imagination ยท 1 points ยท Posted at 10:29:53 on March 27, 2019 ยท (Permalink)

OK serious question. I literally stopped front since a few years because I got fed up with this situation. I am working on a medium size project now and wanted to go as minimal as possible. Is there any guide out there for an idiomatic way to do very minimal stacks with no bundler or framework ? For now I'm using yarn and parcel+a bit of Vue.

N_GHTMVRE ยท 1 points ยท Posted at 10:30:56 on March 27, 2019 ยท (Permalink)

That's some really good shit

Dyming ยท 1 points ยท Posted at 10:37:12 on March 27, 2019 ยท (Permalink)

Richtig gutes Zeug

Dyming ยท 1 points ยท Posted at 10:37:57 on March 27, 2019 ยท (Permalink)

It's from the German song "Deichkind: Richtig gutes Zeug"

chooseauniqueburrr ยท 1 points ยท Posted at 11:01:22 on March 27, 2019 ยท (Permalink)

Kennste JavaScript? Richtig gutes Zeug

vinnymcapplesauce ยท 1 points ยท Posted at 17:52:32 on March 27, 2019 ยท (Permalink)

Twitter. This is Twitter.

ProfessorToastie ยท 1 points ยท Posted at 18:13:02 on March 27, 2019 ยท (Permalink)

Richtig gutes Zeug, ja ja Richtig schwer zu bekommen

Eugene_V_Chomsky ยท 1 points ยท Posted at 01:14:14 on March 31, 2019 ยท (Permalink)

HTML 20KB
CSS 15KB
Images 800KB
JavaScript 3.6MB
Server scripts 150KB
someone who is good at the web please help me optimize this. my site is bloated

PaintingJo ยท 1 points ยท Posted at 00:59:03 on March 27, 2019 ยท (Permalink)

Nice footer, it's got some style

[deleted] ยท 1 points ยท Posted at 03:04:29 on March 27, 2019 ยท (Permalink)

*node apps

helloitsmui ยท 1 points ยท Posted at 04:07:10 on March 27, 2019 ยท (Permalink)

So fking true lol. Thatโ€™s me downloading netabeans

c0wb0yc0d3r ยท 2 points ยท Posted at 05:22:49 on March 27, 2019 ยท (Permalink)

Why netbeans?

d4harp ยท 1 points ยท Posted at 07:13:08 on March 27, 2019 ยท (Permalink)

Because Java === JavaScript \s

Guisseppi ยท 1 points ยท Posted at 07:58:53 on March 27, 2019 ยท (Permalink)

More like Java == Javascript, eh am i rite?

d4harp ยท 1 points ยท Posted at 09:05:02 on March 27, 2019 ยท (Permalink)

JavaBuilderFactory.createJavaBuilder().build().equals(JavaScript)

Lafreakshow ยท 1 points ยท Posted at 09:26:59 on March 27, 2019 ยท (Permalink)

JavaBuilderFactory nmshould be a singleton for maximum accuracy.

helloitsmui ยท 1 points ยท Posted at 10:35:00 on March 28, 2019 ยท (Permalink)

Hahaha my school uses that and forces us to download that.

Hellbasedgod ยท 1 points ยท Posted at 04:34:21 on March 27, 2019 ยท (Permalink)

True innovation.

[deleted] ยท -2 points ยท Posted at 03:25:13 on March 27, 2019 ยท (Permalink)

When a JavaScript program requires hardware the hardware to run most triple a games for a bunch of spinning ducks on the site.

Fish_jbg_zvt_je_srv ยท 0 points ยท Posted at 08:15:29 on March 27, 2019 ยท (Permalink)

If anime was real.

JustHereForTheCh1cks ยท 0 points ยท Posted at 09:11:34 on March 27, 2019 ยท (Permalink)

Only 2 GB ? I consider this a lightweight framework

fxworl_org ยท 0 points ยท Posted at 17:12:07 on March 27, 2019 ยท (Permalink)

bUT i NEeD mY FuNCtIoNS

neotorama ยท -6 points ยท Posted at 04:55:53 on March 27, 2019 ยท (Permalink)

My friend has a team in his company he call them react faggot. The team will use js to solve everything even it can be done with one file html instead of adding webpack and bajilion js modules