Live data from Hacker News

RFC: Adopt a modern JavaScript framework for use with MediaWiki

phabricator.wikimedia.org

261–270 of 293 posts

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

#261
post #212

Earlier quoted context omitted.

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

> javascript is just typescript with documentation stripped off. JS, at its core is a dynamically typed, functional language. Typescript aims to model a strongly typed, OPP language. The two programming paradigms have their own strengths, weaknesses and most importantly: patterns and best practices . If the only difference between your pure javascript code and your typescript code is the annotations, you are doing it…

It's not very strongly typed at all, and it absolutely doesn't force you into the OOP paradigm.

Why don't I consider it strongly typed?: Structurally subtyped as opposed to nominal typing, the pervasiveness of any, allowance for vanilla JS coercion, exceptions and promise rejections are untyped, etc.

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

#262

Earlier quoted context omitted.

\s and not /s? I didn't realize there was such a thing a reverse sarcasm. Or is that some new fangled TypeScript string escape character?

\s or /s Dont care. Small minds, small arguments. Atleast you're consistent that way

It's kind of funny how you boast that you don't want any hand holding from the compiler or IDE, yet you proudly proclaim and demonstrate that you're careless about syntax, spelling, and punctuation. And how you sarcastically complain about immature thoughtless responses, yet you're insulting and patronizing. ;) At least you're consistently self contradictory.

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

#263
post #79

Earlier quoted context omitted.

>Typescript will not help us a dime with type checking for most of devs we hire are long past the stage when typing errors are a thing for them. Who are these mythical people? Do they just magically decipher what interface an argument conforms to? What methods are accessible on a returned result from any random library they're using?

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…

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

A decade ago isn't very long ago. JavaScript is more than 24 years old, and we had to get along without good design patterns or good linters or good debuggers or good libraries or good documentation or good IDEs or good compilers or even good interpreters back then. It sounds like you were late to the party and missed all the fun! ;)

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

#264
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.

Svelte lacks the robust and reliable error handling that Vue and React have.

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

#265
post #257

Earlier quoted context omitted.

> If that is your problem, why don't you just avoid importing typings for libraries? Yes? That's exactly what people are doing when they import a dependency written in Typescript into a pure JS project. > 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? Inste…

> Yes? That's exactly what people are doing when they import a dependency written in Typescript into a pure JS project. Except that in this way they also lose good typings for any other library and for their own code as well. I understand an outdated definition file can be annoying, but there can be various ways to only ignore type definitions for that specific library. > My claim is that Typescript does not solve th…

> you're confusing me with someone else.

Apologies. That actually explains a lot :)

> 1) ignoring the first part of his question, about having to remember signatures in general, including of your own code; 2) interpreted "random" in a strictly negative way, as if it meant "any junk library" instead of "every library".

The answer to 1) is that remembering type signatures in general (or primarily referencing them through a separate spec sheet) turns out to be about as easy as Typescript for some projects and some people. The answer to 2) is that not "every library" is complicated enough to need extensive bindings, and that since Typescript doesn't help you with junk libraries anyway, the benefits to well-documented libraries turn out to be relatively minor.

I mean, I don't even use an IDE for development. I'm on Vim/Emacs, so the immediate documentation benefits of Typescript you describe literally just don't apply to me. And there are plenty of JS devs in the same position, where their only interaction with the type checker will be during a compile.

The short answer to how people magically know the type signature of random methods is they don't. They use documentation, or they look at source code, which is something I still regularly have to do in the projects where I use Typescript.

----

> Who are these mythical people? [the developers who never make typings mistakes]

In general, typings mistakes aren't a major source of bugs in most of my projects. I only observe them to be a major source of bugs in large orgs where lots of teams are coordinating on large interfaces. And that's not because I'm a genius programmer or have a magic power, there are normal programmers who will find themselves in that situation.

> Do they just magically decipher what interface an argument conforms to?

No, I look at the documentation. In general, I also spend a lot of time on interface design so my interfaces are small enough and consistent enough that I can hold the entire API in my head without much cognitive load and without needing to check documentation very often.

> What methods are accessible on a returned result from any random library they're using?"

I look at the documentation, or the source code if I don't trust the documentation.

You are always going to be able to make the argument that I just don't understand how much time I could be saving. I don't know how to prove to you that this isn't a massive drop in productivity for me, in the same way that I don't know how to prove to you that it's not a massive drop in productivity for me to write DOM manipulation code in Vim instead of Webstorm with tab-completion. All I can say is, I use both JS and Typescript on an almost daily basis, and I pay attention to the cognitive loads, bugs, and time-sinks I have in each environment. The JS environments aren't any slower to program in.

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

#266
post #79

Earlier quoted context omitted.

>Typescript will not help us a dime with type checking for most of devs we hire are long past the stage when typing errors are a thing for them. Who are these mythical people? Do they just magically decipher what interface an argument conforms to? What methods are accessible on a returned result from any random library they're using?

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…

>no strong typing and IDE to hold our hand and tell us every time you make a mistake

Ha ha! You remind me of Larry Wall:

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

>"I think IDEs make language developers lazy." -Larry Wall

https://www.youtube.com/watch?v=AO43p2Wqc08

To which James Gosling replied:

>"IDEs let me get a lot more done a lot faster. I mean I'm not -- I -- I -- I -- I -- I'm really not into proving my manhood. I'm into getting things done." -James Gosling

Andrew Hejlsberg also made some good points in that same discussion:

>Maybe I'll just add, with language design, you know one of the things that's interesting, you look at all of us old geezers sitting up here, and we're proof positive that languages move slowly.

>A lot of people make the mistake of thinking that languages move at the same speed as hardware or all of the other technologies that we live with.

>But languages are much more like math and much more like the human brain, and they all have evolved slowly. And we're still programming in languages that were invented 50 years ago. All the the principles of functional programming were though of more than 50 years ago.

>I do think one of the things that is luckily happening is that, like as Larry says, everyone's borrowing from everyone, languages are becoming more multi-paradigm.

>I think it's wrong to talk about "Oh, I only like object oriented programming languages, or I only like imperative programming, or functional programming".

>It's important to look at where is the research, and where is the new thinking, and where are new paradigms that are interesting, and then try to incorporate them, but do so tastefully in a sense, and work them into whatever is there already.

>And I think we're all learning a lot from functional programming languages these days. I certainly feel like I am. Because a lot of interesting research has happened there. But functional programming is imperfect. And no one writes pure functional programs. I mean, because they don't exist.

>It's all about how can you tastefully sneak in mutation in ways that you can better reason about. As opposed to mutation and free threading for everyone. And that's like just a recipe for disaster.

In the HN discussion of that talk, I wrote:

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

>Anders Hejlsberg also made the point that types are documentation. Programming language design is user interface design because programmers are programming language users.

>"East Coast" MacLisp tended to solve problems at a linguistic level that you could hack with text editors like Emacs, while "West Cost" Interlisp-D tended to solve the same problems with tooling like WYSIWYG DWIM IDEs.

>But if you start with a well designed linguistically sound language (Perl, PHP and C++ need not apply), then your IDE doesn't need to waste so much of its energy and complexity and coherence on papering over problems and making up for the deficiencies of the programming language design. (Like debugging mish-mashes of C++ templates and macros in header files!)

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

#267

Earlier quoted context omitted.

> Explore languages that follow different paradigms, where interfaces just don't apply. Interfaces as a general concept applies whether there is a type system to ensure that they are satisfied or not. Do you have function parameter lists? Do you have expected shapes for function inputs and outputs? Do you have distinct types? Then you have interfaces. Your shit breaks when they aren't conformed to. It has nothing to…

>> Then you have interfaces. Not really. My definition of a language feature is something the compiler supports and checks for. JS does not have interfaces. What you're talking about are patterns and best practices, so you're getting there... JS is a dynamic language. Just deal with it already... you sound smart enough to support both paradigms at the same time in your head.

> Not really. My definition of a language feature is something the compiler supports and checks for. JS does not have interfaces.

It doesn't matter what your definition of a language feature is. The person you responded to was obviously talking about interfaces in the general sense of the word and was asking a question about it.

> What you're talking about are patterns and best practices, so you're getting there...

Nope, what I'm talking about is interfaces. The nature of function signatures as interface points is not a matter of patterns and best practices. They simply are exactly that, whether it's spelled out for you or not.

> JS is a dynamic language. Just deal with it already... you sound smart enough to support both paradigms at the same time in your head.

This doesn't constitute an argument or an objection to anything I've said. It presumes that I won't "deal with it" when there is no evidence that I'm not. It supposes that "support[ing] both paradigms at the same time", whatever that means, is a matter of my intelligence. It doesn't argue for any of this.

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

#268

Earlier quoted context omitted.

> Explore languages that follow different paradigms, where interfaces just don't apply. Interfaces as a general concept applies whether there is a type system to ensure that they are satisfied or not. Do you have function parameter lists? Do you have expected shapes for function inputs and outputs? Do you have distinct types? Then you have interfaces. Your shit breaks when they aren't conformed to. It has nothing to…

> Do not use random libraries. A good library should have even some basic docs outline its API and how to use it. >>Hearing this assurance from someone who just complained about their jenga tower of tooling causing issues, I'm not convinced. It wasn't me. Maybe a TypeScript compiler will help you correctly follow the comment threads? ;)

[deleted]

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

#269
post #238

Earlier quoted context omitted.

I see that a lot in the JS world, "libraries over frameworks" and all that. The result is that when you go from project to project, people solve the same problems, again and again, in a different way. And create their own custom abstractions, badly tested and documented. Eventually, the API you could "keep cached in your head" lead to a system you MUST keep in your head because it's very hard to follow how things wor…

> It took me 2 weeks to understand react, and much more to actually write decent code with it. Practically, react is very unproductive without something like create-react-app because you have to take so many decisions about it for every new project. I won't argue that bootstrapping a React project is more complicated than a Vue project. I will argue that React's developer ergonomics are much better. > Everybody has a…

> I will argue that React's developer ergonomics are much better.

Depends for what. For industrial size project, a little, because of the better typescript support. But that's it. You have the same vscode and browser extensions otherwise.

> we use CRA at my company and I can comfortably drop into projects I've never seen before with complete confidence.

First, on this part I'm talking about JS in general. Only a minority of projects use react.

Of course, not all projects use CRA. Many projects use different versions of react with different things you can do with it. Many projects will chose different convention for adapting components, passing children rounds, talking to parent, binding function, etc.

And I _never_ see two react projects with the same me directory tree. There is no strong convention on it.

Then you must chose.

One project is using an inhouse store with useContext, on other use manual redux with that convention, on use redux with that other convention, one use redux-toolkit, one use manual mobx with that convention, one use mobx react, etc. None of them work the same. None of them integrated the same.

And that's just for one lib. One project as many of such libs, all integrated manually.

And yet, the CRA experience is supposed to be one of the best integration you can have.

When you come from another world like Ruby or Python, it's a mad house.

In fact, I'll argue than only experienced programmers manage to get a consistent experience in the JS world.

> Simple things like placing a setInterval()/clearInterval() at the right place

Nope, in react you can use lifecycle OR hooks. You have to choose. And they don't work the same at all.

In vue, for a simple hello world, you can even place the setInterval outside of the component and hapily modify the model, it will update. You don't have to figure out the lifecycle for small app, only for a reusable component.

>How? It's just JavaScript, write a conditional. This is exactly what I'm talking about: you don't need to know how to conditionally set a class in React, you just need to know how to conditionally set a value in JavaScript.

C strings are just an arrays of char, so you don't have to learn those pesky high level string objects in those modern language with all their new fancy API.

> My go-to example to explain why I find React so much simpler is Vue's slots. It's an entire API that many people find confusing to replicate something that comes for free in React.

In both case the user will google "how to get a reference on children components". There is now way you can guess that it's passed as props.

And then, you will want to have several children at different places. And now the illusion breaks, because props.children doesn't work, you have to manually pass each children as props, and you can use them nested as before. And because it's not a "feature", but a convention, you have to know that you need to do that for components that use it. So it's no more natural that slots.

While in vue, you still use slots, you just give them names. The feature is congruent from the simple use case, to the advanced one.

So maybe for the simple case it took 5 minutes in react, and 6 in vue, and the same time for the complex case. For a rarely used feature.

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

#270
post #247

Earlier quoted context omitted.

I see that a lot in the JS world, "libraries over frameworks" and all that. The result is that when you go from project to project, people solve the same problems, again and again, in a different way. And create their own custom abstractions, badly tested and documented. Eventually, the API you could "keep cached in your head" lead to a system you MUST keep in your head because it's very hard to follow how things wor…

>no Django/RoR equivalent in JS Both angular and ember are pretty close in my opinion.

They are client side, not server side.

They have a very, very limited scope.

They don't have to deal with the DB, the authentication, the permissions, the deployment, the creation of a REST API, the migration, the mix of several run times, uploads, logging, sending emails, session management, etc.

And yet.

Their support for i18n, validation, routing, caching, pagination, data formating and presentation - what they should be good at - is abysmal compared to what you can do with django/ror.

The only thing they are better at is templating and creating a hierarchy of components. Which is the least they can do given they are literally there to render the UI.

Post reply on HN