Live data from Hacker News

RFC: Adopt a modern JavaScript framework for use with MediaWiki

phabricator.wikimedia.org

211–220 of 293 posts

Re: RFC: Adopt a modern JavaScript framework for use with MediaWiki

#211

Earlier quoted context omitted.

Page Previews is a great example of leveraging "web app" that solves many problems at once: - quickly inform on a topic without clicking through (lower latency) - increase scanability (hence readability) - decrease expensive whole page loads - eliminate need to open many tabs https://www.mediawiki.org/wiki/Page_Previews

Whatever, but if wikipedia somehow becomes unusable without javascript, it will be a real tragedy.

You dont need to be worried about this. Our morales and principles are not changing.

I built the Wikipedia mobile site and there's a reason our hamburger menu, lazy loaded images and editor actually work without JS. We are for everyone regardless of internet connection speed, device value and internet stability.

That's a a hill at least I as an employee am prepared to die on.

Re: RFC: Adopt a modern JavaScript framework for use with MediaWiki

#212

Earlier quoted context omitted.

>This is a good example of the object oriented, strongly typed way of thinking. Explore languages that follow different paradigms, where interfaces just don't apply. I'm not sure whether you intended this to sound so patronizing, but wow. What languages should I explore while talking about Javascript? You are called to edit a function that takes 2 arguments: function handle_req(request, options): What is request in t…

> that will ensure that these situations no longer happen? Well... but Typescript doesn't ensure those situations won't happen, ironically because it's a superset of Javascript and it's not strict enough. Typescript is just documentation that compiles. If a library has bad documentation, it's likely to have bad Typescript as well, and bad Typescript can be a giant curse. Typescript will happily allow you to force a t…

> it will happily allow you to say that a method always returns a string when sometimes it returns a number

Just replace "say" with "assume" and you have the javascript situation: javascript is just typescript with documentation stripped off.

> Typescript is just documentation that compiles.

Exactly. And we're arguing whether code should contain documentation or not.

Re: RFC: Adopt a modern JavaScript framework for use with MediaWiki

#213
post #182

Earlier quoted context omitted.

Serious question: why are you using React for a blog? What interactive elements are there on the page that require it? EDIT: Saw the link in your profile. I see lower numbers than you, though not by much. But I also see 2.6 seconds time to interactive with 3.1 seconds of main thread work. Broadly speaking, that's fine for your blog. But if it was a site that you expect to add more and more features to over time that…

There are no interactive elements, I just enjoy using React more than the alternatives, even for static content. Instead of asking "what requires react", a better question is "what are the tradeoffs of using react in this situation". In my case React allows me to use Gatsby, a wonderful static site generator, and it also makes it easy for me to add any interactive content I want in the future. My site will load fine…

I’d say your use case isn’t really all that applicable to how React is normally used. Zero interactive elements and doesn’t require JS... that really isn’t typical for a React deployment.

> I really disagree with the narrative that anything written with React is going to have a much worse user experience compared to the "old" stack.

Why only compare to the old stack? When you’re evaluating a brand new solution would should be looking for the best one, not any solution that improves your current situation.

Re: RFC: Adopt a modern JavaScript framework for use with MediaWiki

#214

Earlier quoted context omitted.

Whatever, but if wikipedia somehow becomes unusable without javascript, it will be a real tragedy.

You dont need to be worried about this. Our morales and principles are not changing. I built the Wikipedia mobile site and there's a reason our hamburger menu, lazy loaded images and editor actually work without JS. We are for everyone regardless of internet connection speed, device value and internet stability. That's a a hill at least I as an employee am prepared to die on.

I cannot express how reassuring your words are, and how happy I am to hear them. Thank you very much!

Well; it turns out that I can: just made a donation.

Re: RFC: Adopt a modern JavaScript framework for use with MediaWiki

#215
post #4

Well I guess you can not go wrong with either React or Vue at this point as they have mature communities. However I feel like while React is just fantastic on its corner, Svelte seems like a better built Vue than Vue. It lacks the community but technically feels like a refinement and enhancement of Vue’s ideas. I wish it would gain more traction.

Actually using Svelte its main downside is the giant file size. I consider it unusable for that reason alone. Any minor speed advantages is entirely negated.

Re: RFC: Adopt a modern JavaScript framework for use with MediaWiki

#216
post #212

Earlier quoted context omitted.

> that will ensure that these situations no longer happen? Well... but Typescript doesn't ensure those situations won't happen, ironically because it's a superset of Javascript and it's not strict enough. Typescript is just documentation that compiles. If a library has bad documentation, it's likely to have bad Typescript as well, and bad Typescript can be a giant curse. Typescript will happily allow you to force a t…

> it will happily allow you to say that a method always returns a string when sometimes it returns a number Just replace "say" with "assume" and you have the javascript situation: javascript is just typescript with documentation stripped off. > Typescript is just documentation that compiles. Exactly. And we're arguing whether code should contain documentation or not.

This is kind of a subtle idea, but in some instances, the illusion of safety can be harmful. It is occasionally (not always) better not to give people the illusion of safety when that safety doesn't actually exist. Sometimes putting an ineffective railing along a mountain path increases accidents, because it's human nature for people walking on that path to watch their footing less when they see the railing.

>> Do not use random libraries. A good library should have even some basic docs outline its API and how to use it.

> A whole lot of the time, especially in Javascript land you will join projects where libraries are being used, and where documentation is lacking. Your advice here is basically to not be part of those projects? Instead of developing and using tooling that will ensure that these situations no longer happen?

I'm not here to hate on Typescript, I think it has its uses. I use Typescript in some places. I generally avoid it for personal projects, but I would probably encourage it for larger orgs.

But the idea that Typescript protects you from needing to care about interfaces is exactly the problem with over-reliance on Typescript, and is the source of a lot of really badly written code that treats interface design like an afterthought. If you're using Typescript for documentation and you're treating it like a tool, you can write some really elegant code, you can catch some shallow bugs around types and assumptions, you can integrate your documentation into your IDE. If you're looking at Typescript and saying, "this is an efficient way for me to document what my code does", then this is all very good.

But if you're using Typescript and saying, "now I can pull in any dependency I want", then Typescript is doing you more harm than good.

The specific advice orange gives in those two sentences is good advice. If Typescript is giving you a false sense of confidence about using random libraries, then that's a real negative.

I use both pure JS and Typescript almost daily, and I consume plenty of dependencies written in Typescript. I still occasionally need to debug the stack traces in those dependencies. I still occasionally need to read through their source code to figure out what they're doing. Badly documented dependencies are not a problem that Typescript solves.

Re: RFC: Adopt a modern JavaScript framework for use with MediaWiki

#217

Team lead of Vue.js here. Clarifying a few points being raised in this thread: - This does not mean Wikipedia is becoming an SPA. One of the reasons they picked Vue is because Vue can be used to progressively enhance a statically rendered page (just like jQuery, but with a declarative development paradigm), and it allows you to do so without a build step (while keeping the going-full-build-step option open). - Wikime…

This is IMO one of the killer features of vue. Sure, you can plug react components in a progressive way, but you still have to move the HTML into the JS file. And you certainly won't ship the babel behemoth to the client so, no JSX. With Vue, you have a friendly migration path, with a style close to angular 1, if you need. It's also awesome for prototyping or making quick and dirty projects. Evan, every time I use Vu…

> The API is full of little details that show you care (I smile every time I see you can do '.prevent" - "oh right, they though of that!").

I tend to have the opposite reaction. I want a framework with a small API I can keep cached in my head. I don't want to worry about finding the magic switches to get it working the way I want.

Re: RFC: Adopt a modern JavaScript framework for use with MediaWiki

#218
post #5

I've loved Vue for a long time, worked two years with it almost daily, but right now I avoid it as much as I can, as I can't stand working with JavaScript without TypeScript. The TypeScript support in the current version of Vue is crap, and the simplest things, such as creating a (typed) component library, are hard and require numerous hacks. If I were to use something that lacks TypeScript support, it would be Svelt…

I use Vue without a compile step (I abuse Go's templating engine to achieve this). Mostly to avoid the security nightmare of Webpack's 434583593e4735683 dependencies (and most of the other options are not much better) so Typescript is not an option. I love that I can do this with Vue (I can't with React).

so what you're saying is you avoid vue's poor typescript support by not using typescript

Re: RFC: Adopt a modern JavaScript framework for use with MediaWiki

#219
So I've been working with React/Vue/etc since 2015 and I agree that if you are looking for an ES5 jQuery replacement Vue is the best candidate of the most popular options. You can work old school, just import it via a script tag and start writing ES5 .js files.

That said, ES5 is going to die at some point and big projects like Wikipedia need to prepare for that. Making long term decisions that do not take that into account will be essentially flawed. It would be better to adopt TS than to keep writing ES5 in 2020.

Re: RFC: Adopt a modern JavaScript framework for use with MediaWiki

#220
Reminds me of when archive.org "improved" their site with javascript a year or two back and it stopped working entirely if you don't run JS and don't use a modern commercial browser.

They can say whatever they want about how this won't happen but likely it's not up to them (because it's a corporation and because they won't control the decisions of the JS framework they pick). Wikipedia isn't broken. Fixing it is bad.

Post reply on HN