News for hackers. Stuff that matters.
Re:Today’s Javascript, from an outsider’s perspective by esperent on Monday May 25, 2020 @10:47PM (#23306983)
I had a similarly frustrating experience when I first set up Python to use Django. The complete mess that is the Python 2/3 split (thankfully somewhat better now after many years), trying to figure out what the hell pip and pipenv were (this was before I was familiar with package management).

However, I initially learned some Python in university and I liked it then. We just installed Idle and ran some simple scripts, and everything worked. That's the right way to learn a language. If you dive straight into JS package management, you are attempting to learn multiple things at the same time:

* Node.js environment

* Browser environment

* JavaScript syntax

* 'running a localhost'

* JavaScript modules

* NPM package management

You need to tackle these one by one. If you do them all at once, even with prior experience in other languages, of course you're gonna have a bad time.

Really what I take away from this post is that the author is a bad teacher, although the experience of her student is probably similar to what many people experience when trying to learn by themselves.

There are many improvements that could be made to the JS ecosystem, but this post does not do the current state justice. What it highlights, if anything, is a problem with the available of a standardized learning path. But I'm not sure what the solution to that would be.

Re:Today’s Javascript, from an outsider’s perspective by cornishpixels on Tuesday May 26, 2020 @01:18AM (#23307668)
IMO this is a symptom of a larger problem with the entire web 'ecosystem' (HTML, CSS, JS primarily). It all tries (or tried, anyway) to be simple and easy and forgiving - which means that simple things are easy, and moderately complex things are insanely difficult.

I honestly think the only real solution is re-doing all of it 'from scratch', to make everything (a) stricter and (b) more normal/consistent.

(I think the extant transpilers/preprocessors tend to try to be too 'thin' of a wrapper around CSS/JS: they do give some nice quality of life features but still don't really clean up the mess that is JS and the DOM.)

Re:Today’s Javascript, from an outsider’s perspective by wrnr on Tuesday May 26, 2020 @06:08AM (#23309178)
It actually it is (mostly) as easy as it can be if you think about how the web lets one run third part code safely, not only as a sandboxed in the host environment but also from different domains. I've seen this space evolve since the days of DHTML and the best way to create dynamic content is with document.createElement. Actually I use the crelt[1] util, and the code is shorter and faster then any React/Vue virtual-dom templating system. It like finally riding a bicycle a without training wheels after 15 years of practice.

[1] https://github.com/marijnh/crelt

Re:Today’s Javascript, from an outsider’s perspective by Paperweight on Tuesday May 26, 2020 @01:38AM (#23307768)
If you push down the front of the learning curve, the back gets steeper.
Re:Today’s Javascript, from an outsider’s perspective by michaelt on Tuesday May 26, 2020 @05:03AM (#23308830)
That depends on how much of the front of the current learning curve is composed of things people will need to know later.

A person can be a successful programmer for decades and do millions of HTTP operations without knowing the distinction between TCP and IP.

Re:Today’s Javascript, from an outsider’s perspective by pottertheotter on Tuesday May 26, 2020 @01:12AM (#23307632)
I've been learning Vue this year (I'm new to anything JavaScript so that means I also had to learn JavaScript, Node, NPM, We pack, etc.). I'm getting a lot better, but it has been a pretty frustrating experience. There are so many different layers and they are constantly changing what they do and don't use in another layer.

I've been working in Python for the last several years. There's definitely a learning curve there, and I get frustrated with things all the time, but the whole JavaScript ecosystem seems like such a mess compared to Python.

One of the things I miss the most about Python when working in JavaScript is the documentation. And I mean the core documentation from Python.org. The Tutorial is amazing [0]. And you can download the entire documentation already in PDF. Maybe I'm one of the few, but when I'm learning something new it is such a better process if I can leave my computer and read through a tutorial and mark it up.

[0] https://docs.python.org/3/tutorial/index.html

Re:Today’s Javascript, from an outsider’s perspective by nicbou on Tuesday May 26, 2020 @03:12AM (#23308265)
When I learned Vue, I just inclued the library with a script tag, and started writing plain JavaScript around it.

That was about 3 years ago, and I just started using modules. Even then, I use the native browser modules, no Webpack. With HTTP2, there is little cost to requesting many small files.

Likewise, I don't use a CSS preprocessor in any of my projects. They aren't that complicated.

Those projects have no build process. What you write is what you run (WYWIWYR?). If the project is small enough I'll serve its root directory with Python's SimpleHttpServer. Later, I might have nginx do it.

This allows me to get a project running in a minute. I add tools when they are needed, because then I have the motivation to learn them and set them up properly.

Such tools are required if you must coordinate the work of multiple developers. Their cost is divided by the number of devs, and their benefits multiplied.

If you're just a home gamer toying around, you can do without them.

Re:Today’s Javascript, from an outsider’s perspective by rk06 on Tuesday May 26, 2020 @02:52AM (#23308168)
if you are learning vue and new to javascript ecosystem, would it not be better to start with index.html using Vue from a CDN, and switch to advanced workflow (node, npm, webapack, etc) later?

of course, if you are new, then this approach may not be obvious

Re:Today’s Javascript, from an outsider’s perspective by tbran on Tuesday May 26, 2020 @09:34AM (#23310884)
I completely agree!

I started using Vue from a script tag a year ago (not that hard). But when I started building an SPA, things got complicated very quickly.

I found myself longing for a really good tutorial similar to Django's [0], rather than the thousand variations of "Today We'll Build a To-Do App in Vue!" that are so common.

For the projects that I work on, I use the same pip/virtualenv setup that I've used for years. Can't imagine that happening with Webpack (Side note: it might be that I could use the same Webpack setup for years, but the unstable reputation around the JS ecosystem makes me think I couldn't).

[0] https://docs.djangoproject.com/en/3.0/intro/tutorial01/

Re:Today’s Javascript, from an outsider’s perspective by emilsedgh on Tuesday May 26, 2020 @02:31AM (#23308055)
That's an unfair comparison.

Javascript runs directly on the browser. That automatically makes it much more complex because:

1. There are some packages written for browser and some for Node.

2. There are transpilers, abstractions layers, bundlers, etc to make packages run on both environments.

3. Browser based packages need to have all sort of backward incompatibilities in mind (from IE6 to now)

Multiply these 2 and 3 together and you'll see why it's a mess of an ecosystem...

Yet, it only takes a little bit of knowledge and experience to get something working. It's hugely productive.

I mean honestly considering the hand dealt with it (decades of backward incompatibility required), I think the js ecosystem is holding up real well.

Re:Today’s Javascript, from an outsider’s perspective by conradfr on Tuesday May 26, 2020 @09:40AM (#23310969)
I haven't done the tutorial specifically but https://developer.mozilla.org/en-US/docs/Web/JavaScript is very good these days.
Re:Today’s Javascript, from an outsider’s perspective by open-source-ux on Tuesday May 26, 2020 @07:54AM (#23309970)
"Really what I take away from this post is that the author is a bad teacher"

No she isn't.

This entire thread is full of the generic excuses one has come to expect from this profession when people struggle with programming setup and running programs. Always a defence of the (broken) status quo.

Something has gone wrong? You didn't read the documentation (the incomplete or non-existing documentation). Or it's actually simple, all you need to do is x, y, z followed by a, b, c - how could you not know that? (Often implied in these responses: you're clearly a clueless noob).

This is quite simply a profession that wouldn't recognise 'simple' if it came and bit it on the arse (or ass).

Re:Today’s Javascript, from an outsider’s perspective by hajile on Tuesday May 26, 2020 @02:59PM (#23315113)
Javascript is the ONLY language where people think they can just pick it up and use it with ZERO education first. Sure, they spent years learning to program in language X or Y, but even a couple days to learn Javascript is just too much effort.

If you think learning NPM is hard, try telling a new dev how to setup a Java or C# build by hand. If you think webpack is hard, try teaching someone the intricacies of make.

What about babel? Other languages make breaking changes and dictate that the new version of code just won't be compatible with older stuff. Python 2/3 wouldn't be a blip on the radar if the same option to transpile between versions existed. Those famous "update your .Net version to whatever" warnings simply wouldn't be needed. Instead, people complain that learning a few lines of config is too difficult.

If people put half the time into learning JS that they put into learning the other languages and build tools they know, there would be almost no complaints because the tooling these days just isn't that bad.

Re:Today’s Javascript, from an outsider’s perspective by growse on Tuesday May 26, 2020 @07:32PM (#23317674)
> Javascript is the ONLY language where people think they can just pick it up and use it with ZERO education first. Sure, they spent years learning to program in language X or Y, but even a couple days to learn Javascript is just too much effort.

The problem is not one of putting the effort in, it's even knowing where to go.

If I want to learn about how to use some new JS library/utility/webpacker, I can probably find about 30 good-quality-looking blogs/articles/documentation pages on how to do it. Most of them won't work, because they'll be out of date. This is hugely frustrating, because you don't know if it's not working because the documentation is wrong, or because you're holding it wrong.

> If you think learning NPM is hard, try telling a new dev how to setup a Java or C# build by hand. If you think webpack is hard, try teaching someone the intricacies of make.

Make is actually a brilliant example of something that's complex and daunting, but ultimately rewarding. It's easy to put the effort in to learn it because the maintainers don't change their minds every 2 minutes about what the Makefile syntax is, so learning how to use it is pretty straightforward. And once you know it, you can understand makefiles written both yesterday and decades ago.

Give me make over webpack any day of the week. I'll put money on which dies first.

Re:Today’s Javascript, from an outsider’s perspective by number6 on Tuesday May 26, 2020 @02:53AM (#23308170)
How did you come to the conclusion that the author is a bad teacher?

Sometimes I am in the same boat. Thinking, this should be easy, ending up yak shaving.

Re:Today’s Javascript, from an outsider’s perspective by weiming on Tuesday May 26, 2020 @02:28AM (#23308042)
And so I use create-react-app anytime I need to start a front-end JS/TS project, even if I am not using React at all. Basically avoiding dealing with troubleshooting the soup of build time dependencies and mismatching package versions, which unfortunately comes with the modern JS (or node) ecosystem.
Re:Today’s Javascript, from an outsider’s perspective by onion2k on Tuesday May 26, 2020 @03:17AM (#23308293)
Using Parcel.js (https://parceljs.org/getting_started.html) or Snowpack (https://www.snowpack.dev/) would give you the same benefit without pulling in the React things that you're not using.
Re:Today’s Javascript, from an outsider’s perspective by torb-xyz on Tuesday May 26, 2020 @03:28AM (#23308345)
I was going to use Django for a project, but ended up not doing so, as I was literally not able to set up my Python project correctly.

For all Python's ease of use language wise it‘s ecosystem can be utterly inscrutable.

Re:Today’s Javascript, from an outsider’s perspective by esperent on Tuesday May 26, 2020 @08:59AM (#23310540)
Yeah, I almost gave up. I'm glad I didn't though, because, occasional hiccups with pipenv aside, Django is great to work with.
Re:Today’s Javascript, from an outsider’s perspective by PopeDotNinja on Tuesday May 26, 2020 @01:22AM (#23307688)
Coming from a language that didn't need virtualenvwrapper, I can't say I was a fan of needing to learn how to use virtualenvwrapper.
Re:Today’s Javascript, from an outsider’s perspective by toyg on Tuesday May 26, 2020 @03:38AM (#23308404)
I’ve been using django since v1 and never, ever used virtualenvwrapper.

Python3 -m venv env. That’s all it takes.

Re:Today’s Javascript, from an outsider’s perspective by wyclif on Tuesday May 26, 2020 @05:33AM (#23308975)
A lot of people make the mistake of including the point release in that command. It's not necessary, specifying Python3 will do it.
Re:Today’s Javascript, from an outsider’s perspective by guggle on Tuesday May 26, 2020 @07:26PM (#23317628)
That's what I do too. Never understood why I should use something else.
Re:Today’s Javascript, from an outsider’s perspective by number6 on Tuesday May 26, 2020 @02:55AM (#23308180)
Yeah I used it fairly late and installed everything globally. It was a mess but stuff still worked.
Re:Today’s Javascript, from an outsider’s perspective by extra88 on Tuesday May 26, 2020 @09:53AM (#23311115)
> the author is a bad teacher

She wasn’t helping one of her students, she was helping a friend who is a computer scientist. The closing thought was if this person, with so much existing knowledge and some assistance, can’t make one “simple” thing work in a reasonable timeframe, what hope do actual novices have?

Re:Today’s Javascript, from an outsider’s perspective by machiaweliczny on Wednesday May 27, 2020 @04:00AM (#23320580)
Novices don't need any of this - Babel and webpack are for pros who need to support IE9. I have in my team 19 year old who knows all this stuff to implementation detail, so it's not that hard to learn - speaks more about this friend.

Novices should be referred to preset codesandbox.

Re:Today’s Javascript, from an outsider’s perspective by extra88 on Wednesday May 27, 2020 @07:41AM (#23321831)
The article didn't mention Babel or Webpack, the first attempts to use the module were with Node, not in a browser.

There's blame to go around but I mostly blame npm for being full of hot garbage while obscuring what is garbage and hot.

Re:Today’s Javascript, from an outsider’s perspective by thawaway1837 on Tuesday May 26, 2020 @12:39PM (#23313285)
I’m pretty sure the author isn’t teaching anything but is instead pointing out the unfortunately common pitfalls when having someone new start with the JS ecosystem.