Live data from Hacker News

RFC: Adopt a modern JavaScript framework for use with MediaWiki

phabricator.wikimedia.org

171–180 of 293 posts

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

#171
post #79

Earlier quoted context omitted.

I'm not a myth. Some of us started JS programming over a decade ago, with no strong typing and IDE to hold our hand and tell us every time you make a mistake. The key is just discipline, good design patterns and a good linter. I see TypesScript as a VERY opinionated linter that affects how you think and write JS. JS is a dynamically typed language, which means you loose a lot of its power and flexability by shoe-horn…

>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 typecast that doesn't reflect reality -- it will happily allow you to say that a method always returns a string when sometimes it returns a number, and it will happily compile in those scenarios.

Tracking those bugs down are a giant pain. I don't hate Typescript, but people who look at this and think, "I don't have to care about what libraries I'm using, I can just trust the interface" are fooling themselves. I've debugged plenty of errors in Typescript code that ended up being the result of me trusting an interface that didn't reflect the reality at runtime.

There's value in Typescript for some projects, but it does not remove the need to be careful about documentation and dependencies, because it's so easy for both dependencies and downstream code to circumvent the protections Typescript gives you.

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

#172

> The need to evolve our platform is very evident when it comes to how we design, develop, and deliver experiences to users in the browser. > Requirements: > The framework allows UI elements to be defined in a declarative way > UI elements created within the framework are reactive (update automatically in response to changes in data or user input) by default > The framework is open-source, widely used, and has a thri…

That's because the issue they're trying to solve is being slowed down by existing JavaScript tooling and infra. This is very explicitly to improve Dev UX. And they already called out the most important concern when switching to a new lib:

> The framework is heavily optimized for performance.

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

#173
post #9

I looked at Vue.js and came away with the impression that it requires me to learn a lot of framework-specific implementation details. For instance, a list requires that you know the v-for directive, while in React it's just JavaScript's Array::map(). Couldn't see the value there.

> Couldn't see the value there.

When you're choosing a JS framework you need to factor in the experience the user has along with the experience you have. I don't know much about Vue but React comes with a huge amount of bulk. A lot of JS that has to be parsed before anything can even be done on the page.

If you're choosing React because it allows you to fall back on what you know rather than learn something new you're making an ill-informed choice.

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

#175
post #9

I looked at Vue.js and came away with the impression that it requires me to learn a lot of framework-specific implementation details. For instance, a list requires that you know the v-for directive, while in React it's just JavaScript's Array::map(). Couldn't see the value there.

Right now, Corona made some time for that, I'm rewriting something I tried to do in Vue. I don't work with Vue daily and that makes it real hard to do even the simplest things. I'm back to vanilla JS, few sprinkles of jQuery and HTML5. Works well for me.

exactly. React works so well with js. And vue claims to be simple but tbh its hard. working with async await function, promises are so weird. And you need packages for simple stuff also.

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

#176
post #99

Earlier quoted context omitted.

Modern JavaScript runs on the server just fine, they will probably use server side rendering and build time rendering.

Server side rendering is slow and expensive . Wikipedia needs to be fast for all of it's users, and needs to be very cost centric.

Static site generation is very cheap in terms of generation and delivery.

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

#178

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 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).

I was not aware of this. That's actually really cool. I've dabbled a little in Vue and Angular but haven't taken the plunge and deployed an actual App because I prefer to have sites that degrade gracefully.

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

#179
post #44

Can someone give a quick code example for the follwing? The framework allows UI elements to be defined in a declarative way How can you use Vue so that what you do is more declarative then when using a template engine like handlebars?

I believe the templating is what's declarative, here. For instance, in Vue you can insert logic such as for loops, conditionals, event listeners, two-way data binding and so on right in the template with directives (HTML attributes). Instead of an imperative JavaScript for loop.

How in seven hells is moving imperative loop constructs from Javascript to HTML supposed to be "declarative"?!

If anything, it's the opposite - you're now polluting HTML with imperative programming features where there previously were none.

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

#180
post #111

Earlier quoted context omitted.

It's not just a bad idea... it's a horrible, dangerous idea. All of their points can be easily addressed with a static site generator or just some CMS that lets you write pages using templates instead of just pure HTML. That's absolutely declarative, a lot more than a JS-framework based app. The only point that would be missing is the reactive part as you mention: but who the hell expects a wiki to be reactive?! I ex…

> a static site generator You really think 140,000 people are going to learn git all of a sudden?

Learning Git (there are GUIs for it as well) can aid one in so many additional ways though.
Post reply on HN