r/programming • • Aug 06 '22

'The best thing we can do today to JavaScript is to retire it,' says JSON creator Douglas Crockford • DEVCLASS

https://devclass.com/2022/08/04/retire_javascript_says-json-creator-douglas-crockford/
2.1k Upvotes

759 comments sorted by

573

u/fresh_account2222 Aug 06 '22

Why has JavaScript been such a wild success?

Because everybody who wanted to get on the internet was shipped a JavaScript interpreter along with their browser. I swear so many people in tech don't understand how mass markets work.

58

u/piniondna Aug 06 '22

This is so true… a good historical example is Flash pre-AS3. The Flash editor allowed completely non-technical creative users to create wildly interactive visual experiences with barely any code.

as soon as Adobe acquired Macromedia and went about “fixing” ActionScript by making it more appealing to Java developers, they drove away the exact user who was fueling its adoption from the beginning. And worse, the Java devs who were being forced to use the platform still hated it because it wasn’t as mature as Java at the time, and had no 3rd party library support. Being forced to write code from basic principles was too much for them, I guess.

when Steve Jobs barred Flash from iOS, that was just the nail in the coffin that Adobe built by alienating its core users.

67

u/mindbleach Aug 06 '22

Exactly.

Adoption is a feature you cannot design.

120

u/svartkonst Aug 06 '22

And it being literally the only way* to run scripts in a browser environment until fairly recently, and even now the barrier for entry for JS is vastly lower than with rescript/clojurescript/wasm/purescript.

with non-browser programming you could hypothetically discover programming in VB and then move to C++, but if you're doing web things there is only js.

  • except for like Java applets

0

u/[deleted] Aug 06 '22

[deleted]

→ More replies (1)

50

u/tjones21xx Aug 06 '22

That's a good point. Kinda like how all personal computers in the 80's shipped with a BASIC interpreter built in.

→ More replies (7)

27

u/barjam Aug 06 '22

It’s also not nearly as bad as people say it is. It’s going to be impossible to unseat something that is good enough and ubiquitous.

6

u/[deleted] Aug 06 '22

And it’s stupid east to drool on a keyboard and make something run in a browser. Adoption and excitement are big motivators, bad tech or not.

4

u/htraos Aug 06 '22

I swear so many people in tech don't understand how mass markets work.

Exactly this. A typical (flawed) argument starts with "has bad performance", "wasn't designed for this purpose", "doesn't scale well" and so on. And the conclusion is that any solution that falls into said categories should be discarded.

Just no.

2

u/JessieArr Aug 08 '22

Used to work with an engineer who would always balk at PRs containing "good enough for now" solutions other engineers at the company built, pointing out that a massive framework he envisioned (and was eager to spend 12+ months building) would have been a much superior solution for this use case.

My team lead always used to reply "yes, but this solution has the advantage of actually existing."

It's easy to imagine a browser scripting language better than JS. But JS exists and works... so JS is what gets used.

Once something that is better in every way exists and is supported by all browsers, JS will die out on its own.

3

u/scootscoot Aug 06 '22

Sure but this doesn’t explain why people also chose to run it serverside.

11

u/MrAckerman Aug 06 '22

Because one language across the whole stack minimizes mental overhead when switching tasks and allows your team to be more flexible.

→ More replies (2)
→ More replies (2)
→ More replies (4)

828

u/fullctxdev Aug 06 '22 edited Aug 06 '22

As Douglas has said before, DOM is a horrible abstraction to create applications. It was made for text documents. The modern usecase of the web was hacked into a tech that was fundamentally born to properly support a much more limited purpose.

The real solution would be to replace the DOM API of every browser with something that was made to render 2D/3D graphics with discoverability, accessibility and machine readability in mind. That new engine could use any new language properly designed to handle this use case. The notion or a website would change this way. It could became application over udp/tcp.

I believe JS is a symptom not the problem. The limitations of the browser concept itself is the issue and its mismatch with what we are using it for.

263

u/Khutuck Aug 06 '22

I am always amazed that while we have hundreds of programming languages for everything, we are stuck with the HTML/CSS/JS stack for the web. It is very inefficient, hard to develop for, and has so much weird idiosyncrasies and historical baggage.

I want a new and easy to use language for the web (like Flash but easy to use and secure), but I don’t expect that to happen any time soon.

94

u/[deleted] Aug 06 '22

Its year 2122 and people are still wondering why do we have == and ===

46

u/aecrux Aug 07 '22

Triple equal is like double equal, but with more equality.

15

u/vital_chaos Aug 07 '22

Some equals are more equal than other. Two equals good, three equals better.

→ More replies (2)

4

u/jonzezzz Aug 07 '22

== is equality and === is equity

→ More replies (6)

102

u/ElectronWill Aug 06 '22

There are 2 ways to do this

  1. Use another language and transpile it to JS. Like TS and Scala.js. Much more fun and powerful than JS.

  2. Use Web Assembly, aka WASM.

70

u/Bouffant_Joe Aug 06 '22

But you still need JS and the DOM to use WASM right?

37

u/Graineon Aug 06 '22

Yes but you can also deploy a full application using WASM, think something like flutter, which basically uses a canvas component and supplies all its own rendering stuff. I'm not a huge fan of flutter personally, but it does serve a specific niche.

→ More replies (2)

9

u/TheWix Aug 06 '22

Scala.js looks really interesting. Always wanted to try Scala. How's does it compare?

→ More replies (7)
→ More replies (6)

24

u/jl2352 Aug 07 '22

hard to develop for

Is it though? As having done development in several UI frameworks. I find modern web applications much easier to develop for than anything else I've used.

12

u/adjustable_beard Aug 07 '22 edited Aug 07 '22

Exactly! Out of every UI framework I've ever used, web frameworks like react are the easiest by far and its not even close.

→ More replies (22)
→ More replies (2)

9

u/Slapbox Aug 06 '22

It's the same reason we all use QWERTY.

21

u/Darioxyzz Aug 06 '22

well I use QWERTZ

4

u/WingedGeek Aug 06 '22

There are days I would kill for QWERTY. ABCDEF doesn't seem like it would be unnatural, but it is.

→ More replies (2)

2

u/grumblingdeveloper Aug 08 '22

It's so much better that we have one language for the web.

What you describe is the current desktop experience. Just imagine a browser, but inside each tab is a sandboxed native app, that you can access by visiting a link.

Each with their own weird rendering quirks, and usability differences. Just like Flash apps felt like.

I've never seen another technology that is as easy to develop for cross platform.

→ More replies (16)

126

u/stikves Aug 06 '22

It has been tried before... many times... but "good enough" JavaScript has won every challenge.

We had Flash, but that was even before we have any good DOM or JS

We had Java Web Applets, which never took off (for good reason)

We had ActiveX, argh...

We had Silverlight 1.0, which was a "canvas" API with remote connectivity

We had Silverlight 2.0, which was kinda good, modern, fast, multi-platform (Moonlight), but was not entirely open

And we had Canvas, which is actually part of JS family, and still used extensively (Google Docs, various "Maps", etc). + WebGL +SVG. But these have not replaced DOM.

DOM is here to stay. Like C, Java, and COBOL before it.

At best we will have WebAssembly to optimize things a bit.

35

u/dnkndnts Aug 06 '22

Arguably many of these were superior, they're just locked down and proprietary, which turned everyone off from them.

19

u/thephotoman Aug 07 '22

They all had implementation problems, ranging from "too early" to "what were you thinking".

I mean, what we want is something like what Java applets and Flash programs gave us: an in-browser runtime for a real application programming language. We want programs to be a part of hypertext.

And so far, everything has sucked. A part of me thinks a big part of it is the browser itself. The entire Web experience needs to be rethought.

→ More replies (1)

25

u/inbooth Aug 06 '22

None of those are language agnostic core platforms..... They are all Vendor Locked bs.....

Apples and oranges ...

9

u/faaace Aug 06 '22

Web components promised this but the W3C killed it because they were afraid of the power it would give Google.

9

u/username-must-be-bet Aug 06 '22

How did W3C kill web components? Aren't web components pretty widely supported.

→ More replies (1)
→ More replies (16)

25

u/IrritableGourmet Aug 06 '22

The real solution would be to replace the DOM API of every browser with something that was made to render 2D/3D graphics with discoverability, accessibility and machine readability in mind.

VRML? /s

8

u/Airless_Toaster Aug 06 '22

Clearly SMIL is the answer.

35

u/Phobos15 Aug 06 '22

The document nature of the web standardizes it and enables things like plugins. How is anyone going to do plugins if every website can be a binary graphical application of some kind?

→ More replies (1)

9

u/MjrK Aug 07 '22

render 2D/3D graphics with discoverability, accessibility and machine readability in mind

Perhaps we could use some kind of document structure to encapsulate these different semantic elements...

28

u/ExF-Altrue Aug 06 '22

The real solution would be to replace the DOM API of every browser with something that was made to render 2D/3D graphics with discoverability, accessibility and machine readability in mind. That new engine could use any new language properly designed to handle this use case. The notion or a website would change this way. It could became application over udp/tcp.

Google is too busy designing standards to prevent adblockers they don't have time for small things like "discoverability, accessibility, and machine readability"

(I wish it was /s)

60

u/josefx Aug 06 '22

The real solution would be to replace the DOM API of every browser with something that was made to render 2D/3D graphics, ...

So you want flash back?

The limitations of the browser concept itself is the issue and its mismatch with what we are using it for.

We had plugins that worked around these limitations decades ago. However instead of improving on those, the browser makers starting with Apple decided they where a threat to be removed.

The resulting limitation is fully artificial and enforced top down.

74

u/Nivomi Aug 06 '22

honestly plugins were and would have continued to be an accessibility nightmare, among other concerns

the web needs a good, open, unified standard, not a "we give up, you do it" hole for any old system, good or bad, to get shoved into

65

u/anon_cowherd Aug 06 '22

They were a threat- to users. Every major plugin became a vector for viruses, because they were out of the browser vendor's control and the companies behind them simply didn't give a rat's ass.

JavaScript isn't innocent either, but the browser vendors have a much stronger motivation to stay on top of it, and with evergreen browser versions, users get updates quickly and seamlessly.

8

u/jl2352 Aug 07 '22

We had plugins that worked around these limitations decades ago. However instead of improving on those, the browser makers starting with Apple decided they where a threat to be removed.

You are wearing some very rose tinted glasses.

My memories of the early days of the web was that most plugins were garbage. Utter utter garbage. Java and QuickTime being two big examples. I remember plugins being a security and accessibility nightmare. I remember being constantly asked to update different plugins all the time. I remember people building whole websites out of Flash, and they were terrible.

Once browsers got video and music. Most of the need for Flash died overnight.

I'm glad the age of plugins is gone.

→ More replies (20)

75

u/elsjpq Aug 06 '22

I also wish most of the web would go back to pure text documents. There's very little on the web that actually needs to be an app. It's like when people used to put Flash on everything because it's cool, except now they're not getting criticized for it.

14

u/metal-trees Aug 06 '22

This reminds me of the brutalist web design guidelines

13

u/elsjpq Aug 06 '22

I'd also like to add breaking zoom to that list. So many sites are breaking the most basic accessibility feature by scaling even things like font size to viewport width

→ More replies (1)

40

u/[deleted] Aug 06 '22

Well maybe not pure text documents. I like when menus only are displayed when I hover over them. And CSS styling is pretty cool too. But yeah, people should stop making blogs into web apps

34

u/ObscureCulturalMeme Aug 06 '22

I like when menus only are displayed when I hover over them.

I hate that particular example. I hate when menus and shit are popping up on the page just because the mouse pointer happened to pass over their trigger zone on the way to whatever I'm actually intending to point at.

If I want something to happen, then I will indicate such by clicking. Conversely, if I haven't clicked, then I expect nothing to happen.

Agreed that interactive menus are still well outside "pure text documents" though. It's just the hyper aggressive sites annoy me to no end.

15

u/bcstpu Aug 06 '22

I find that so, so incredibly irritating. I can understand limited exceptions like hovering your mouse over images and having a separate display window for what you're hovering over, like a magnifying glass, or such. But it's like they learned nothing from when early GUIs were around, and "click a menu" vs "point at a menu" was an actual question.

Interactive menus are still pretty close to pure text documents though. It's still fundamentally treating the medium as passive until queried, which makes the types who want to guide user interactions for profit very angry, but, makes a much better user experience.

20

u/bcstpu Aug 06 '22

Dear god this x1000.

I'm fine with CSS or a bit of Javascript or something for, like, a meaningful bar of buttons for something like reddit. Fine with a single-page webapp for things it makes sense for, like small games or tools (dartpad, replit, etc), or for devs who hate dealing with framework-of-the-week and just prefer a cross-platform solution they can export their application to with a click or two because seriously Flutter is way less of a pain in the butt.

But it's infuriating when everything has to be a bloated mess of Javascript where the page doesn't even load without it, or the UI is an overbuilt mess with endless "feeds", or there's two forms of the website and the desktop version is the only one that works on mobile, etc. The internet is basically 99.99% static text, images, audio, and video, and that's easy as hell to make and supported; a site like Wikipedia is fine and simple.

When I look into "why is this shit so complicated?", the answer usually is "stupid fractal" and marketing/social media buzzwords rather than any good underlying reason.

→ More replies (1)

45

u/rdfox Aug 06 '22

It’s so much easier to make an IOS app than a web app. No need for styling or routes. Everything you need is baked into SwiftUI. Too bad Apple’s idea is not to take over the web but to lock you into their App Store.

→ More replies (5)

8

u/killerstorm Aug 07 '22 edited Aug 07 '22

DOM is a horrible abstraction to create applications.

Not really, it's OK.

It was made for text documents.

You're talking about CSS. And that's largely solved now.

he real solution would be to replace the DOM API of every browser with something that was made to render 2D/3D graphics with discoverability, accessibility and machine readability in mind.

Yes, let's throw out a mature solution which is a result of hundreds of people working for decades which offers high-performance rendering, accessibility, internationalization, scaling, etc.

And replace it with, I dunno, wishful thinking?

People building desktop apps with web UI via Electron indicate that maybe it's not that horrible?

4

u/remy_porter Aug 07 '22

It could became application over udp/tcp.

You've reinvented X windows. Congratulations.

8

u/coolpeepz Aug 06 '22

I’m not so sure. When you look at stuff like Electron and React Native it seems like people actively want to use DOM to make applications. I’ll agree that it’s original design was much more oriented towards static text documents but at this point you have all sorts of ways to make interactive applications.

3

u/[deleted] Aug 07 '22

The real solution would be to replace the DOM API of every browser with something that was made to render 2D/3D graphics with discoverability, accessibility and machine readability in mind. That new engine could use any new language properly designed to handle this use case. The notion or a website would change this way. It could became application over udp/tcp.

Well, kinda. The document structure at the very least gives you relatively easy way to make website accessible and for robots to parse it.

"here is 2D/3D canvas, do whatever you like" makes that much, much harder. We've seen that in Flash days with SEO problems "just a full screen flash page" caused

3

u/melanko Aug 06 '22

100% this. Also not to mention that the majority of web security issues we encounter are due to us jury-rigging new technologies onto browsers and the HTTP protocol that it was never designed to support (see cookies for example).

→ More replies (17)

159

u/JaggedMetalOs Aug 06 '22

Well Google tried that with Dart and it didn't work out too well. JS is going to be very hard to un-entrench I think...

39

u/HalfRiceNCracker Aug 06 '22

Why didn't Dart take off?

331

u/Shautieh Aug 06 '22

It missed the target.

→ More replies (5)

27

u/Iggyhopper Aug 06 '22

Because we never know if Google will stop supporting it for no god damn reason.

→ More replies (2)

8

u/Daelan3 Aug 06 '22

It was developed by Google which also has a browser. The other browser makers felt Chrome would have a huge advantage with supporting Dart if it became mainstream, and thus didn't support it.

→ More replies (1)

4

u/Eirenarch Aug 07 '22

Mozilla, Opera and Microsoft told Google to fuck off (probably Apple too but privately). JavaScript could have been replaced multiple times if it was not for the big browser vendors blocking each other's efforts. It might be Mozilla finally achieving a replacement via wasm, but they went for it with a very interesting and creative middle step (asm.js)

6

u/jl2352 Aug 07 '22

There are multiple reasons. What I remember from the time was that a lot of people were talking about Dart, but very few were interested. Very few were hyped for the language. People thought of it mostly as a weird experiment. It was almost like people were waiting for everyone else to adopt and try it out first, before they would chose try it out.

A big factor is that Dart isn't a very compelling language. At the time, and I'd argue still to this day, it's a fairly generic and unimpressive dynamic language. At the time dynamic languages were all the rage. If you take Ruby, Python, PHP, and JS, they all have compelling things about them. Even if it's something as simple as being shipped in every browser. Dart has none of this. There was no real USP so no one wanted to try it.

Calling JS from Dart was not as seamless as with other languages (like CoffeeScript or TypeScript). Given the target audience were people writing JS day to day, and using JS frameworks and libraries. This was a major barrier to entry.

Google had been touting Dart as a JS replacement. As a part of their strategy they wanted other browser vendors to add support for Dart. They said no. In fact they were quite anti-Dart in many ways. This both scuppered Google's plans, and was quite embarrassing. This plan failing meant people saw the language as essentially dead on arrival.

You could also compile Dart to JS. However it would run slower, and resulted in huge bundle sizes. The latter really mattered back then. Given the language wasn't compelling, why would you switch to just have your site take 10x longer to load up?

The industry wanted to move towards improving JS over replacing it, and where it is replaced, JS is used as the compiler target. This approach won. In part because it meant people didn't need to drop their current language / tooling / etc.

It was also a time of JS-replacement language wars. Notably between Dart, CoffeeScript, and TypeScript. TypeScript won that war. TypeScript's rise in turn hurts Dart.

→ More replies (4)
→ More replies (13)

599

u/Striking_Peach_5513 Aug 06 '22

We're not doing it

348

u/MysteriousEmployee54 Aug 06 '22

That being said, if they develop a low level interface for Web assembly to access the DOM then I can see a future where you can program in any language and then the language is in charge of providing a high level interface to the developer.

Then when people have the ability to choose their own language, it may lead to a decline in JS, not to mention the incredible perf benefits Web assembly has.

207

u/Athanagor2 Aug 06 '22

WebAssembly does not have a lot of performance benefits in the majority of usecases. V8 optimizes JS extremely well (at the price of insane complexity).

173

u/[deleted] Aug 06 '22

Yes but the point is to not use JS and not have to compile to JS

→ More replies (16)

59

u/matthieum Aug 06 '22

Yes, and no.

This reminds me of a serie of blog articles:

  • A "random" developer explains how they use Rust to compile to web-assembly to get good performance for a specific operation.

  • A chromium developer replies how you can use chromium-specific tools to figure out the performance bottlenecks in your JavaScripts, and chromium-specific tricks to help the JIT better optimize the code, as well as demonstrates an algorithmic improvement.

  • The "random" developer thanks the chromium developer for the algorithmic improvement, and replies that the main advantage of using Rust -> WebAssembly is that one doesn't have to be a chromium wizard to get good performance.

JavaScript can run fast, but it's easy to have very similar JavaScript run slow; it's not a dint on JS, or the JS JITs, all optimizers suffer from the same issue of being thrown off their happy paths by the slightly alteration -- even when it looks basically the same to a human.

If performance matters, with JavaScript you should find a way to somehow guarantee that optimizations take place: good luck, it's a real pain. With WebAssembly, you get good performance by default, no worries.

→ More replies (4)

69

u/hekkonaay Aug 06 '22

WASM gives you predictable performance and memory usage, which will be much better on average than JS, because WASM doesn't suffer from deoptimization and inline cache misses.

→ More replies (5)

19

u/MysteriousEmployee54 Aug 06 '22

Part of why WebAssembly does not have the same level of performance as JS will come down to the fact that it has not existed for anywhere near as long and so there hasn't been time for the same level of optimization work to be done.

→ More replies (61)

3

u/recycled_ideas Aug 06 '22

That being said, if they develop a low level interface for Web assembly to access the DOM then I can see a future where you can program in any language and then the language is in charge of providing a high level interface to the developer.

At a fundamental level JavaScript is the way that it is because the DOM is the way that it is.

It's evolved specifically for the needs of the Web. This is why Webasm doesn't support multithreading even in languages that natively support it and why even in WASM 2, it won't support multithreaded access to the DOM.

Because it's a big blob of horrific shared state and none of the features other languages offer can really deal with that.

7

u/jl2l Aug 06 '22

It's called Blazor.

→ More replies (3)
→ More replies (20)

12

u/maest Aug 06 '22

I really like how clearly you argued your position.

7

u/EasywayScissors Aug 06 '22

We're not doing it

It's not like I like the JavaScript, I hate it, but there's nothing I can do about it right now. And it's such a long way from typescript.

→ More replies (6)

221

u/mohragk Aug 06 '22

The only way it will be replaced is if there’s a better alternative. Web Assembly is a step in that direction, but no one in their right mind is creating web apps with it.

119

u/Adhalianna Aug 06 '22

I see plenty of insane people these days then and I'm about to join 🤔.

To be fair however, probably the primary benefit of choosing WebAssembly over JS that buys most people nowadays is either the ability to share code with other applications or just skipping learning JavaScript.

This is most likely not happening in companies which already have JS in their stack and a bunch of JS developers hired. WebAssembly needs to grow much, much more before businesses consider a it as a replacement and it might still linger in the web forever like COBOL does in banking systems.

30

u/iamapizza Aug 06 '22

The last bit you said is really important for adoption. No matter what is created or used, it needs very very long term support, businesses do not want to spend money on having to recreate applications whose tech stacks have been retired. For that reason I can't see JS going away, ancient websites still need to continue working; similarly WASM needs full commitment from browsers, as well as fully fledged development frameworks, before it's considered and its adoption spreads, with assurances that it won't suddenly stop working one day.

→ More replies (2)

14

u/CyclonusRIP Aug 06 '22

The knowledge is way more tied up in knowing how browsers work than knowing JS or React or whatever. Whether you do Web Assembly or JS the only way you get a good result is deep knowledge of the browser ecosystem.

If you want to waste a bunch of time on solving basic functionality go for Wasm or something that transpiles to JS. If you want to spend time building your actual application then use JS or typescript. Until another ecosystem for programming in the browser gets decent market share it’ll never be worth it to choose for a real business. You’re going to end up investing tons of time in basic tools or low level components and less time building the actual app.

3

u/[deleted] Aug 06 '22

Vanessa Freudenberg, who did the Smalltalk zoo which involved writing Smalltalk virtual machines that run in the browser, said she stuck to JS as her experiments with WASM showed it wasn’t nearly as fast.

Lot of work to do there.

78

u/mr_tyler_durden Aug 06 '22

The alternative suggested by the creator of JSON (“E”) looks like a sick joke. The website is out of the 90’s, has broken links, and no easily to find code samples and this is what he wants to replace JS with? Grow up.

Neither of these people live in reality and just want to throw stones. I don’t care if they had a hand in or created JS/JSON, it’s not theirs anymore and the world has take it, advanced it, and the only possible “alternative” to JS is WASM (like you mentioned) but practically no one is using that or proven it to be better than what we have (for actually interacting with the DOM).

52

u/jl2352 Aug 06 '22

Modern JS is very different to the old JS Crockford made. What he advocated was everything people hated, and have moved away from.

Building applications in a single script is not how people want to build websites. Yet it's what he still sees as a plus. The prototype system was, at best an interesting curiosity, and in reality a horror show. Everyone used their own class building library to avoid it. Today you can learn and use JS, without ever knowing that prototypes exist.

There are problems with modern JS. I'd 100% take it over anything Crockford has ever advocated.

→ More replies (4)

16

u/merreborn Aug 06 '22

The website is out of the 90’s,

That is literally the last time that page was updated. I briefly worked at the company that developed E in 1997. I'm told the team just started an effort to revive the project this year.

→ More replies (2)

28

u/EasywayScissors Aug 06 '22

The only way it will be replaced is if there’s a better alternative. Web Assembly is a step in that direction, but no one in their right mind is creating web apps with it.

<script type="text/typescript">

27

u/nightfire1 Aug 06 '22

I love typescript but first-class support for it would only cement the JavaScript language and all it's issues even further. I think a totally new language is needed.

14

u/EasywayScissors Aug 06 '22

In that case I choose C#.

→ More replies (4)

4

u/DoctorGester Aug 06 '22

First one would need an actually performant typescript compiler, unless you are willing to just strip types and accept unsound programs, at producing which js programmers are already the best

→ More replies (17)

5

u/HonestlyQuestionMark Aug 06 '22

Web Assembly is used plenty of places. Every major tech company’s research division is utilizing it in some way or currently researching how to implement it. WASM is pretty great

23

u/unique_ptr Aug 06 '22

I'm currently working on a WASM web app using Blazor.

It's pretty fucking awesome as a C# guy who loathes web development. To call my back-end I literally just use the same auto-generated REST client I use in the non-webapp portions of the service and it just fucking works.

10

u/[deleted] Aug 06 '22

To call my back-end I literally just use the same auto-generated REST client I use in the non-webapp portions of the service and it just fucking works.

That's possible with swagger/open-api for over a decade.

21

u/unique_ptr Aug 06 '22

Yes, of course. It's the fact that it's a regular-ass C# assembly that I use for "normal" .NET development that impresses me--there's no special consideration required for targeting Blazor where, oh, you can't use x part of the framework or Blazor provides it's own y and you have to worry about z or it'll be too slow etc. etc. That's a big boon for a small C#-centric company.

5

u/mobrockers Aug 06 '22

Guess what blazor uses to interact with the DOM and browser APIs?

6

u/PlanesFlySideways Aug 06 '22

The same thing everything uses to interact with the DOM?

→ More replies (3)
→ More replies (2)

9

u/ShiitakeTheMushroom Aug 06 '22

I made a little developer site/blog in wasm + gRPC-web to hit my backend server over gRPC from the client. Everything is written in C#, leveraging Blazor, and it's been wonderful to work in. The fact that the package management system is actually sane using NuGet is a huge win as well. Modern C# is just really nice to work with.

I'm not a frontend dev, but my guess is that I wouldn't want to implement a more complex webapp in Blazor any time soon, though. You need JS interop at times to interact with the DOM and it's not mature enough yet. Telling people not to use Web Assembly for web apps isn't going to be productive in terms of getting it into a more mature and useful state, though.

12

u/[deleted] Aug 06 '22

I am creating web apps with it. Why would’nt we be in our right minds?

14

u/zippy72 Aug 06 '22

I'm not so sure about WebAssembly. It feels way too much like the second coming of ActiveX to me

37

u/[deleted] Aug 06 '22

I mean yeah if Webassembly had no security at all, didn't integrate with browsers at all and only worked on x86.

Fortunately it's nothing like ActiveX.

→ More replies (7)

13

u/dCrumpets Aug 06 '22

Idk I kinda love working in typescript now. Even more than I like my backend programming in Python.

9

u/xX_sm0ke_g4wd_420_Xx Aug 07 '22

skimming through a well-typed TS codebase is so much easier than looking at python, even if the python code has type annotations

44

u/ryegye24 Aug 06 '22

This talk from 2014 is a fascinating, evergreen look at how JavaScript's end is both impossible and inevitable. Can't recommend it enough.

https://www.destroyallsoftware.com/talks/the-birth-and-death-of-javascript

7

u/jediknight Aug 06 '22

This talk documents the only realistic way to retire javascript.

→ More replies (3)

124

u/_asdfjackal Aug 06 '22

"Developer of new programming language thinks we should all abandon what we're doing and use his thing instead."

Yeah hard pass.

→ More replies (15)

22

u/birdbrainswagtrain Aug 06 '22

I get the hate for javascript. I went through that phase, and like Crockford I wish we had something better. I just don't think it's gonna happen. There's just such a massive investment in the langauge and the ecosystem. Maybe in a few decades.

I know people point to webassembly as if it's going to be our savior, and I don't see it. I like webassembly, but when the pitch is "let's ship an entire runtime for a different (probably garbage collected) language, compiled to webassembly, which will likely perform worse, take longer to build, and be even more cumbersome to interact with browser APIs" you start to lose me.

18

u/Avaxi-19 Aug 06 '22

This.

I always think its funny when people act like Blazor is the second coming of Christ. Its never front enders that recommend blazor but always C#ers that are too afraid to step outside of the .net bubble.

I work with both Blazor and React for my daily job... and the Blazor project is a massive pain in the ass to work with. One thing that drives me nuts is due to it being a compiled language that hot reload barely works. And more...

2

u/angeal98 Aug 07 '22

It's not "funny" to me.

Node became popular for the same reason, devs didn't have to learn another language to write backend. C#ers (i like this word to much) don't want to learn js to program frontend. It's all about developer experience it seems

→ More replies (2)

18

u/EasywayScissors Aug 06 '22

Just need to upgrade:

use strict

to:

use strict nosemicoloninsertion nonullorundefined staticallytyped

13

u/arnitdo Aug 06 '22

Hmmm.....TypeScript?

→ More replies (1)

23

u/vegiimite Aug 06 '22

Biggest problem with JS is not the language it is the NPM ecosystem. An official body should look at writing an official standard library that removes the need for the crazy node_module bloat.

3

u/ILikeChangingMyMind Aug 06 '22

Well, that's essentially Lodash (JS's unofficial standard library) ;)

21

u/Raunhofer Aug 06 '22

Well, you could say the very same thing about most of the languages really.

TypeScript is a great alternative, also the language I nowadays prefer, but I do see how it is not as welcoming as JS was. At times the typing can get stupidly cryptic.

It's super valuable to have an easy to hop-in language being as popular as JS is. It brings in a lot of great new developers.

John Carmack about JavaScript

12

u/[deleted] Aug 06 '22

Bruh that's a 5 hour podcast. At least link to the portion that is about JS.

3

u/Raunhofer Aug 07 '22

I did. See the link, there's a timestamp.

→ More replies (1)

98

u/WeaponX86 Aug 06 '22

This is rich coming from the guy responsible for comments being forbidden in JSON

41

u/alternatex0 Aug 06 '22

His argument was sound. JSON is a data transfer format. Parsing is an extremely fast operation because it's simple. There are plenty of good formats for configuration files that support comments.

→ More replies (6)

17

u/DoctorGester Aug 06 '22

Why would JSON need comments per the original idea? It’s a data transfer format, not a config file format.

24

u/UghImRegistered Aug 06 '22

Anybody can make a more efficient data transfer format than JSON. The things that made JSON popular were its compatibility with JS object literals, its readability by humans, and the fact that it is schemaless. All three of these points would be strengthened by allowing comments.

→ More replies (4)

14

u/ILikeChangingMyMind Aug 06 '22

Human beings need to document things. As a result, virtually every computer language since the dawn of time has had comments ... even many non-programming ones (eg. SQL, XML, HTML, and CSS all have comments).

It was an obvious need that anyone except an opinionated blowhard like Crockford could have seen coming (and many did ... Crockford just prevented them from adding comments to JSON).

→ More replies (7)
→ More replies (2)
→ More replies (1)

101

u/TheSanscripter Aug 06 '22

Just let browsers compile straight from TS.

39

u/besthelloworld Aug 06 '22

Or don't. There's no point in sending your types with your bundle. You'd be increasing the amount of data you send to clients for no reason because there's no reason to do type checking at run time if you can just do it at build time. In no way does this improve the current system.

Even the current proposal isn't recommending browser compile types, they're recommending the browser treat types as comments. And then you'd typecheck with something like ESLint rather than TypeScript itself. But you'd still end up compiling the types out of your final bundle anyways.

33

u/hekkonaay Aug 06 '22

There's a proposal for this, it's somewhat controversial, so who knows if it's going anywhere.

13

u/alternatex0 Aug 06 '22

Type annotations in JS != TypeScript. I think the proposal idea is to allow our tooling to help out more during development even though at runtime the hints will be ignored as usual JavaScript. TypeScript can do a lot of stuff that I believe aren't in the proposal.

→ More replies (2)

2

u/AnimalLibrynation Aug 06 '22

That proposal isn't for TypeScript compiling, that proposal is for TypeScript syntax inspired strippable type hints.

62

u/[deleted] Aug 06 '22

TS is JS with type annotations.

17

u/Tblue Aug 06 '22

And it doesn’t give you any runtime type checking, IIRC.

58

u/sothatsit Aug 06 '22

Don’t forget the most important bit: type checking!

Sure, they inherit the quirks of JavaScript, but there’s no question that adding types give you many, many advantages for large codebases.

17

u/besthelloworld Aug 06 '22

I don't think that person disagrees with this statement, but there's just no gain in shipping types to clients. You'd force them to download larger scripts for a type checking process that is built to only work at build time (and has very few use cases for runtime).

19

u/jl2352 Aug 06 '22

But it provides no benefit when shipping code. It's just extra noise.

That's why I feel the idea of having browsers compile TS directly is utterly pointless. You'll still need to compile TS ahead of time, so pre-compiling doesn't go away. Whilst you get zero type benefits at runtime, and a larger bundle size.

It's a lot of effort for no real benefits.

→ More replies (1)
→ More replies (1)
→ More replies (1)

5

u/[deleted] Aug 06 '22

Why don't we solve the real problem (it being JS)? No-no, that's for lame people. Let's be negligent and make a crude bandaid into fully-fledged medication treatment.

And then, after 5-10 years there will be yet another debate about where to go after TS didn't solve the root problem.

4

u/besthelloworld Aug 06 '22

What's the problem? That seems to be consistently poorly defined.

Also are we not already on the way with WASM?

→ More replies (4)
→ More replies (7)

62

u/javajet10 Aug 06 '22

Keep reinventing the same wheel is a ‘barrier to progress’

→ More replies (13)

22

u/modernkennnern Aug 06 '22

That'd be a dream, but unfortunately that'll not happen

WebAssembly at least exists now, so it could happen at some point in the future

22

u/testonaut Aug 06 '22

JS hate reminds me of the PHP hate back in the day, except JS isn't anywhere close to that bad PHP was back then.

I don't really get what the big problem is, I've done massive complex programs and didn't have too many problems. The language is far from my favorite, but it isn't that bad.

11

u/LukeLC Aug 06 '22

And PHP has improved dramatically since then and quietly powers a far greater percentage of the web than people talk about.

JS has also improved to the point of making most frameworks obsolete, but because companies are invested in said frameworks they won't pivot to vanilla JS now that it's feasible. Meanwhile, everyone is using frameworks and complaining about how bad JS is, when the problem is primarily the frameworks ecosystem.

→ More replies (4)

3

u/ScandInBei Aug 06 '22

I personally quite enjoy programming Javascript and typescript. But I can see innovation being held back (especially long term) and I don't think it matters if we get typescript natively in browsers or if we get an excellent standard library. I mean, will we still do Javascript in 10 years? 25 years?

It will have to change at some time to make room for more modern languages. Perhaps languages that hasn't been invented yet. The best way is to let developers decide on what language is best for the product they develop and WASM seems like the best way forward at the moment.

9

u/MpVpRb Aug 06 '22

And the cycle continues

Quick and dirty, sloppy hack makes it easy to write small stuff fast. It gets popular. It gets bloated and inconsistent as people use it to write bigger stuff it was never intended to support. People see the problems and propose a major change to an obscure and unpopular alternative

Visual Basic

Javascript

Wonder what's next ???

12

u/ApatheticWithoutTheA Aug 06 '22

Yeah, no thanks. Typescript already fixes the major issues with vanilla JS if you want to use that instead.

3

u/mrstratofish Aug 06 '22

A WWW where every page is potentially a loosely constrained executable is a horrible thought.

HTML/JS/CSS may not be the best, but it makes it far easier to keep an eye on, and then shut, security vulnerabilities than an "anything goes" approach. Sandboxes only work until someone finds how to get out of them

3

u/theoldboy Aug 06 '22

I scrolled all the way through a r/programming thread featuring both Javascript AND Douglas Crockford and was extremely disappointed. It's old but c'mon, it's still funny.

Javascript: The Good Parts

3

u/Hand_Sanitizer3000 Aug 07 '22

I think the issue is with more and more developers not receiving proper education in the fundamentals of software design and also the business side of a development team creating tech debt with unrealistic expectations/deadlines.

3

u/DindoNuffin_ Aug 07 '22

Holy C what is up with the survey??

Why would anyone take the news seriously if it gives HTML and SQL as options in survey for the most popular PROGRAMMING LANGUAGE?

16

u/hunteram Aug 06 '22

Please lord let this happen. Let's have a new standard language for browsers.

8

u/[deleted] Aug 06 '22

Short sighted. Let’s have a proper language supporting infrastructure so languages are pluggable.

11

u/mindbleach Aug 06 '22

https://xkcd.com/927/

Except in this case, there is one standard. We've already got the end goal. We don't care that it sucks. Universal adoption is a feature you cannot design.

→ More replies (2)
→ More replies (1)

11

u/SimonDKnight Aug 06 '22

JS is a nasty little language we had to live with…then people started shoe horning it into web servers and native applications. Now we will never get rid of it.

2

u/Bouffant_Joe Aug 06 '22

I understand why they did it. It's natural to want to be able to use one language everywhere. The single language available on the web limits the candidates for this to be that one. Apart from transpliled languages which are never completely independent from javascript.

5

u/Mammoth_Cat_9929 Aug 06 '22

How can we retire something used to build the entire internet

→ More replies (2)

4

u/Kevin_Jim Aug 06 '22

We haven’t gotten rid of C, and we’ve tried for decades, we ain’t getting rid of JavaScript, either.

→ More replies (1)

6

u/keithgabryelski Aug 06 '22

Says the guy who prevented comment tokens from being added to a language (that desperately needs use-case documentation) because he didn’t want meta data in the document that people could use to enhance syntax.

Take a hike, buddy

7

u/twotime Aug 06 '22

Yeah, and the sad thing that I don't think he has ever retracted that "rationale".

(Mistakes happen, even stupid mistakes, but his "rationale" for not allowing comments in json is so ridiculous that it should have been retracted next morning after waking up)

6

u/ILikeChangingMyMind Aug 06 '22

Crockford is a man who will never admit he's wrong ... even when he disagrees with himself during his own speech ;)

I once saw him give a talk at Code Camp years ago, where he spent the entire first half of the talk explaining the importance of good patterns, and why you shouldn't just follow them because of personal preference, but because they protect against some issue or have some other tangible/objective benefit.

That very same man then spent the entire second half of his talk listing out his own favorite pet patterns (some of which I'd argue were anti-patterns), with zero justification or objective reason for adopting them ... after he just spent the first half of his talk saying how important that was!

7

u/elgholm Aug 06 '22

So, just to clarify, a 25+ years proven language, with easy to parse and understandable C-style syntax, which nowadays runs almost everything on the web, frontend for sure but also a lot of backend, should now be killed? Why? Because there's something else? Ah, yeah. That'll be a no.

You can do stupid shit with every language. It's not JS fault idiots of today has jumped on the framework/module/npm-wagon.

2

u/[deleted] Aug 06 '22

JS in my opinion is the best, and the worst thing that web have seen

→ More replies (1)

2

u/the-samizdat Aug 06 '22

Noooo, that’s the only language I know

2

u/moreVCAs Aug 06 '22

I say we take off an nuke the entire site from orbit. It’s the only way to be sure.

2

u/soopersalad Aug 07 '22

Lets bring back Java Servlet

9

u/[deleted] Aug 06 '22

Not gonna happen

6

u/[deleted] Aug 06 '22

JS has gotten out of hand. Back 15-20 years ago when I started working, JS was meant to be used to enhance web pages, things like front end validations, minor animations, etc. Not build the entire thing.

4

u/MrCrunchwrap Aug 06 '22

Things change dude. It’s okay.

8

u/[deleted] Aug 06 '22

They do change, but the idea of running a dynamically typed language to handle a large codebase on the server side is as dumb as it can be.

→ More replies (4)
→ More replies (1)

4

u/FinnT730 Aug 06 '22

Wow, why are the charts I see of "most popular languages" all different from each other? One has Rust on top, one JS, other has CSS..... But I agree, JS should die out... Everything is becoming KS with Electron has wrapper

7

u/mzalewski Aug 06 '22

LOL, this guy doesn't know what he's saying. The greatest thing about the web is backwards compatibility. I can open a website I have created almost 20 years ago and it will look as ugly as it did back then. And that's awesome.

Anyone who says that JavaScript and DOM should be "replaced" is self-selecting to be ignored. If anything, perhaps there's a room for another language and another API that could live side by side with JS and DOM.

→ More replies (1)

3

u/Sixstringsoul Aug 06 '22

Just shut er down folks, it’s that simple

→ More replies (1)

3

u/postmodest Aug 06 '22

Douglas Crockford: "Javascript is a bloated language"

Developers: "JaVaScrIpt NeEds A StAndArd LibrArY!"

Everyone involved is nuts.

5

u/MT1961 Aug 06 '22

Or, you know, we could stop programming for a platform (the browser) that was never intended to be programmed for in any way shape or form, and simply create something new that might actually be safe.

5

u/Letiferr Aug 06 '22

Yeah let's just reverse all progress on the web because someone didn't explicitly intend on things going this far decades ago?

Are you high? That's easily the worst suggestion on these comments.

→ More replies (1)

2

u/wankthisway Aug 06 '22

Was this shit written by a kid who just found out why "JavaScript and modern web bad" or something? Good luck trying to usurp what is basically the entire internet. One of the most asinine comments on this so far.

→ More replies (1)
→ More replies (2)

3

u/starlulz Aug 06 '22

UPVOTE. JavaScript is a tool made for the 1990s web extended to do things it wasn't made to do, and then those extensions were extended, and then those extensions were extended, and those extensions were extended, and then those extensions were extended, repeat ad nauseam until the year 2022

2

u/acroback Aug 06 '22

While we are at it, Json is the worst format out there.

Verbose, bloated, no strong types and parsers have their own interpretations.

Sucks

2

u/[deleted] Aug 06 '22

20 years too fucking late.

→ More replies (1)

1

u/[deleted] Aug 06 '22

Before retiring JavaScript we need to retire Css first, just saying.......

10

u/maitreg Aug 06 '22

I have hated dealing with CSS and JS for two decades, but what's even worse is trying to track down the CSS or JS that needs to be tweaked every time I need to change something in my web apps at work.

It usually takes me 1-2 hours just to find the code that can be fixed in 5 seconds. There is never any way to know which particular file, class, or function is responsible for the manipulation that's happening on the screen.

Oh, those 2 buttons are too far apart by 2 pixels? Good luck!

It's so aggravating when JS/CSS devs will tell you that there can't possibly be a better way to do it than JS/CSS.

Come on.

13

u/mdatwood Aug 06 '22

JS and CSS very much fall into the classic quote, "there are only two kinds of languages: the ones people complain about and the ones nobody uses". - Stroustrup

4

u/maitreg Aug 06 '22

Aye. The only language with no complaints is Klingon.

The fact that complaining about Klingon can be punishable by assassination or execution is coincidental.

→ More replies (1)

0

u/[deleted] Aug 07 '22

[deleted]

2

u/[deleted] Aug 07 '22

Finally someone with common sense here👍👍👍

1

u/TeamUlovetohate Aug 06 '22

JS is too ubiquitous now to be replaced/retired…. Unless you consider typescript as a replacement. So yeah don’t get your hopes for JS being usurped in our lifetime.

1

u/beej71 Aug 06 '22

It doesn't solve any DOM complaints, but Crockford can compile E to WASM and be done.

There's still more WASM work to be done, but that's the right track, and DOM and CSS can be solved in parallel.

Also, he should have allowed comments in JSON. ;-p

1

u/Graineon Aug 06 '22

Personally I think it would be great if HTML, CSS and JS could be compiled and you could ship binaries. I know the deal with WASM, which kind of solves the issue - ish. But for example, CSS has so many properties. Every property assignment is on average 25 characters, which is 25 bytes, lets say. But if there's less than 256 css properties, each can be represented by one byte. And the same goes for what they're set to in many different ways. By doing this properly you could essentially reduce the size of a css file almost tenfold and save the compilation step for the browser. It obviously introduces some other issues, but I think it would solve more problems than it creates, speed up downloading AND loading times.

1

u/making-flippy-floppy Aug 06 '22

Just like we did with Cobol and Fortran?

1

u/og_m4 Aug 06 '22

I think it's ridiculous that people are advocating for Flash-like browser APIs. Have we learned nothing from the past? Such an API can be a huge drain on resources in the hands of an idiotic programmer, and it will take a lot of work to ensure that it also always works (to some degree) on less capable computers. The long history of HTML/CSS/JS, while rife with legacy baggage, also includes countless optimizations that have been learned along the way. Maybe they need extensions to be more efficient, easier to work with, and more capable for people who want more control of the browser window, but don't destroy something that's already good enough just for your desire for more syntactic sugar.

1

u/Seankps Aug 06 '22

Dart, the language for flutter, was supposed to be a replacement for JavaScript. But generally reception to that idea was not very good. So they pulled the plug and made it a standalone thing. That could Transpile to JavaScript

1

u/boringuser1 Aug 06 '22

People like to shit talk the DOM, js, html and CSS, but we have historically noticed more developers moving towards this stack (you'd be surprised where you might find electron) rather than away from it, so it has somehing going for it.

→ More replies (2)

1

u/houseband23 Aug 06 '22

C'mon Kotlin multiplatform, do something...

pokes with stick

1

u/ChimpScanner Aug 06 '22

Ah yes, let's abandon JavaScript for "E". Totally gonna happen /s

1

u/[deleted] Aug 06 '22

JavaScript just needs polishing and some improvements (like typescript), its a good language overall. The real problem is how JS and HTML works together

1

u/TheFuzzball Aug 07 '22

Crockford hasn’t been relevant for 10 years at least.

He doesn’t have new ideas that solve problems with the DOM or JavaScript, he just want some attention.

The problem with the modern web isn’t technologies, it’s ads, tracking, and bloat.

1

u/myringotomy Aug 07 '22

How are you going to retire the most widely used and most popular programming language in the world?

1

u/freakmaxi Aug 07 '22

I’m waiting to see that day before I die…

1

u/Sivart13 Aug 07 '22

The best thing Douglas Crockford can do today is to retire

1

u/APUsilicon Aug 07 '22

Blazor is the answer

1

u/[deleted] Aug 07 '22

What would at a technical level be the best language to use for the Web?

→ More replies (2)

1

u/jonsakas Aug 07 '22

I agree that JavsScript on its own is unsuited for large applications. The number of supersets that have come about to solve its flaws shows this problem well. However, I feel like a native typescript interpreter is much more likely than the E programming language at this point.

1

u/Maamman Aug 07 '22

Omg yes plz. Javascript syntax makes me want to die.

1

u/grumblingdeveloper Aug 08 '22

JS used to be so horrible. I couldn't stand it without CoffeeScript. Every library with a different way to make classes, the UMD/requirejs module crap. Everything in a single file.

But now it is great. It's so clean and easy. And almost every data set you work with is in JSON, and it supports JSON so nicely. I will never understand how every other language fails to support native json syntax. They all want to do their own wierd thing.

The entire world is JSON. Every language is just manipulating it.

1

u/RabidLustre Jan 11 '23

It's been a wild ride, but maybe it's time for JavaScript to take a break.

1

u/LastTopQuark Aug 06 '22

It is one of the worst languages I’ve encountered.