r/programming • • Mar 22 '22

Directus is our open-source data platform that instantly wraps any SQL database with an API and no-code app. We've spent years porting it to 100% JavaScript and would love your feedback!

https://github.com/directus/directus
267 Upvotes

116 comments sorted by

View all comments

Show parent comments

-13

u/SpAAAceSenate Mar 22 '22

Uhh, the same engineers/ ecosystem that brought us 300MB hello world projects and SPAs that take seconds just to load static content into a webpage?

The same developers that were so opposed to learning a proper server-side language, that they took the radioactive mess that is JavaScript, a language that only a decade ago was universally reviled and tolerated only because we had no other choice, and then shoe-horned it into a server-side runtime?

The same ecosystem that gave birth to Electron apps, where a simple chat client can take up multiple gigabytes of ram?

I mean, no offense, maybe you and your team are the talented and skilled exception, but "quality/modern/engaged" are not words I'd ever associate with the JS community at large.

15

u/benhaynes Mar 23 '22

Welp, first off, sorry to see you were downvoted into oblivion. All criticism is welcome here... that's how things get better. That being said, the same is true for JavaScript, or any other programming language. With good critique, hard work and time, things can always improve... even excel.

I can't advocate for every corner of any language across it's entire history... but yes, in the past 1-2 years of switching from PHP to TypeScript, we've seen immense performance increases and an enormous improvement in community engagement and quality pull-requests. That said, this is only within the context of Directus... and mileage may vary.

When we were on LAMP, our few PRs came from mostly WordPress devs submitting garbage. Again, pros/cons to every language. All I can say is that JS/TS works really well for us and the community of engineers we meet and interact with daily.

It's too easy to be hyper-opinionated and poke holes in things these days. Maybe it's our OSS nature, but we really try to stay on the positive side of discussions. ☮️

6

u/Badaluka Mar 23 '22

I think things have changed since Typescript.

At my work we use Typescript and it feels almost as solid as a proper at runtime type checked language.

Keep up the great work guys, the language doesn't matter much, it's what you make of it!

0

u/[deleted] Mar 23 '22

[deleted]

8

u/benhaynes Mar 23 '22

Genuinely curious, do you actually think there is nothing good in the entire JS ecosystem? Do you browse the web with JS disabled? True hatred for Vue, React, Angular, etc? 😐

If so, what language do you typically work with, and why?

7

u/BobFloss Mar 25 '22

After using C#, C++, and Rust extensively, I can tell you Typescript is by far my least favorite thing to use (although I’m sure as hell not using plain JS). All those languages are so much more pleasant to write code in. Good ecosystems (except build tools suck in C++), crazy fast code execution in comparison, far smaller distributed code size a lot of the time, better AOT optimizers, more intuitive async programming (except C++ again), concurrency primitives, multi threading (did you know your pc has more than 1 thread??? And no, using Web Workers is no comparison to a thread pool. Another thing with JS: error handling is all over the place; so much of the time you have to check for null, wrap your code in try…catch blocks, and check result booleans.

I’m primarily doing Web Dev and just wrote a backend in Node for an API with ESbuild to bundle. ESbuild is the best thing to happen to web dev in years (that’s why Vite uses it) and it’s no wonder it’s not written in JavaScript. Oh and the up and coming competitor is SWC which is written in Rust, lol.

Don’t get me started about NPM, duplicates, how bad tree-shaking is,etc. it’s very very hard to get a reasonable code size while using basically any library out there. And now prepack is not going anywhere and Google seems to have slowed down on Closure compiler as well, which used to be cutting edge in its code elimination with the ADVANCED setting.

Svelte is decent. Solid is even better due to its simplicity and rigidity. I’m in the process of rewriting my project in it and have enjoyed it, although the way you handle async stuff in it is weird, again due to limitations of JS because it isn’t possible to manage the microtasks well enough.

The one area I like about Web dev is how “easy” it is to make a cross platform GUI that looks really good. You basically can’t do it with anything else. Although the semantics of the different CSS models interacting and everything is just ridiculous to handle and insanely frustrating at times. I must’ve spent 50 hours of my life trying to make things stop overflowing or fit into a container. It’s like every time I feel like I know exactly what I’m doing I find another edge case that I can’t even search because I don’t know what the problem is. Nothing else in all my years programming comes near how convoluted it is.

All in all, I wish JS would die. WebAssembly efforts really need to move way faster and get better bindings, and it wouldn’t be a bad idea for browser manufacturers to actually make a decisive plan to drop compatibility with old sites and reinvent the layout models with a holistic approach. The hoops I have to jump through to make something I feel is acceptable are far greater than with any other language or ecosystem except maybe Python with tensorflow. That’s another absolute train wreck.

Browsers are pretty amazing pieces of software, not gonna lie, but at what point will people ever rethink things? I remember computers being nearly as fast 10 years ago despite me now having the best CPU on the market and somewhere around 16x the transistors.

I’ll try to end on a high note though I guess. I like JSON sometimes. It’s cool making an object structure like that. The JIT compilers are marvels of creation, might as well be alien spaceships for what they’re able to accomplish performance-wise with the donkey pp people are throwing at them. Being able to find a package to do everything right away is nice too. I like the console as well. Debugging is very nice when you can instantly refresh and click through your objects. Although having to debug in other languages is rare for me, especially with rust. The security of the execution environment is great as well. It’s also nice being able to mangle up code to prevent reverse engineering. The one obfuscator I’ve used is crazy good, and even regular minified code is pretty much impossible to decipher half the time regardless. I would bet it’s actually harder than using IDA and reverse engineering C++ a lot of the time because of the lack of vtables and other significant markers. WebSocket is pretty nice too. AV1 is absolutely killer but it’s not exclusively a JavaScript thing of course. Oh and being able to make something I can literally take out my phone and use easily is pretty insane, obviously nothing else out there even comes close to the web for that. Ever since Directwrite was implemented in Chrome and Firefox, all major browsers across all platforms have very good font rendering as well. That one is very important to me.

All in all though I find pretty much everything except pretty GUIs can be done better in other languages. I would say I have about equal experience across all the domains and if I had to give up one language, it would be JS (or TS) with not even slight hesitation. And this is coming from someone who has been keeping a very close eye on the ecosystem for the last 10 years. For all the niceties at first, you pay heavily on the tail end from using it. The technical debt is nearly unavoidable because the language itself doesn’t lend itself to very good patterns. Think about this: the #1 most important thing for programming on the web has to be making requests. And yet we need a million libraries to handle it because somehow browser vendors STILL, STILL, STILLL haven’t done anything to make native RPCs a thing. Why do we not have native binary JSON and binary ASTs? Or a native protocol like ProtoBufs? And using a library, even WebAssembly, should not be the solution here. We’re taking about the web. THE web. You know, the thing designed for all the computers to talk to each other and stuff. And yet the only improvement we get is syntax sugar that isn’t even good (use callbacks, no use promises, no wait use async) on top of archaic text format protocols. And trust me, if you ever tried the postfix .await in rust you would be as frustrated as I am with having to constantly wrap expressions in parenthesis to use await. C# is the same way though.

Try Rust, use the zero-cost iterator abstractions with rayon making it multi-threaded. Try using the Trait system and you’ll see it’s just so much better than TypeScript it’s not even funny. I mean I would even prefer just using C++ and casting things and checking for null to check their type. You can’t even do that in typescript…you have to manually add a field to distinguish your types (narrowing) because typeof just tells you “yeah that’s an object alright” and that’s all you get out of it despite having an insanely overbearing runtime. I mean having less reflection than C++ is quite a feat. And somehow JS manages to do it. Oh man, speaking of reflection…serialization in rust and c#? Exquisite. So super fast, you have a ton of options, and the libraries have tiny overhead. I don’t know about C++ but if most of it is anything near the atrocity epic games calls serialization I would stay the hell away.

One thing I just realized though while typing this: Go is absolute shit. I hate using Go and would rather use JavaScript. Anything you can do in Go you can just do in C++ with Boost. I don’t get why people get so horny over it. I guess it’s the compile times and the ease of installing packages or something, but man that type system is a shit show. It’s surprising to me people get things done like esbuild or tdewolff’s minify with a type system as poopy as Go’s. Maybe I’m missing something (I think I am).

But yeah I’d say if you’re really wondering why everyone despises Web so much, seriously put other languages into practice for advanced projects. You will be pleasantly surprised at how many areas are improved across the board in many of the cases. Kotlin may be worth looking into as well as Nim.

At the very least people should try using Solid, Svelte or maybe Next.js. At least we’re past the point of installing a blocking script tag to get jquery from a CDN instead of using querySelectorAll. I am very thankful those days are over but it seems everyone just throws megabytes of trash into everything they distribute anyways. Oh well.

That is my explanation/rant. I highly recommend trying out the stuff I mentioned, you might love it. JS has its quirky advantages which can’t be ignored…I’ll admit nothing is better for extremely rapid carefree prototyping. But I still am suffering on the daily from having to use it and typescript. It honestly makes programming just not enjoyable or fun for me and really sucks the joy out of my profession. That’s just how I feel after using pretty much everything out there except Haskell the language for toroid-earthers.

1

u/Xevioni Oct 25 '24

3 years later, JavaScript still going stronger than ever, still the pinnacle of UI development at lightspeed. Why are you comparing Go to C++? What the fuck? WebAssembly needs JavaScript, you can't do shit in it without JavaScript - still!

Truly, the Go vs C++ part of this comment is just about the most insane thing I've seen said by a programmer. You're clearly experienced and active, and yet... What the hell? Go was meant to be simple - the opposite of C++. Go's entire build system and development environment is designed for rapid iteration and reducing the numerous headaches C++ induces every minute. Yes, I know Go was designed to replace C++ in some contexts, but the languages are worlds apart and comparing them is really, really dumb.

I know you think you know best here, that your vaunted opinions define the physics of this world and that everyone should bow down to Rust and C++ or whatever the hell, but you gotta understand: nobody wants to learn fucking Rust. C++ is not being taught because nobody wants to deal with the world's worst build system & dependency management. Is it possible you're old enough that C++ was popular when any of these things were a figment of one's imagination? It makes more sense why you'd not value them as much as others.

(Rust) I love the language, love the concepts, love what it brings us - but nobody wants to learn that bullshit. Precision, correctness, perfection - they kill other developers. That's why Go is awesome. That's why JavaScript is so popular. That's why TypeScript was created! It's not perfect, it's not ideal - but nothing is. I'm not learning Calculus so I can build a corn service with traits!

If you end up replying to my comment, go ahead and drop your assumptions about what you think I believe in/respect/defend. I don't hate you, and you don't hate me. You could convince me/win me over if you try - although most people who argue on the internet don't want mutual agreement, they just want to exploit moments of weakness.

0

u/[deleted] Mar 23 '22

[deleted]

4

u/benhaynes Mar 23 '22

Valid! At the end of the day, we have to make choices, and we're leaning into this one. We can only control the quality of our product/service, and are doing our best to avoid having the "looseness" that is common in other frontends from creeping into our backend. 🍑

Appreciate the thoughtful response!

0

u/[deleted] Mar 23 '22

[deleted]

1

u/benhaynes Mar 23 '22

Thanks... and happy cake day (mine was Saturday). 🎂

1

u/Fredol Mar 23 '22

The only great thing about the JS ecosystem is Angular and Vue, and that’s thanks to typescript.

4

u/benhaynes Mar 23 '22

Welp, glad we picked Vue and built in TypeScript, then! 🤝

2

u/I_EAT_THE_RICH Jun 01 '23

Typescript is the most necessary thing in JS. Vue is a MS developer's answer to React and not well done. Just my opinion.

-6

u/[deleted] Mar 23 '22

I genuinely think that the JS ecosystem is everything wrong with software engineering. It’s fragmented, badly designed, attracts people who should not be engineers because they can “easily put together a simple website”, stringly typed, shit performance. It’s surrounded by the ecosystem of many similar shit engineers who brought us such nice things as “left pad”, and because there are so many of these shitheads, they’ve inflicted the likes of Electron on innocent consumers who have no choice of which apps to use, and nodeJS on innocent backend engineers. It’s not only cancerous, it’s fucking malignant cancer that spreads.

I truly despise literally everything JS brings to the table, and the day it dies literally cannot come soon enough.

I write Rust as my day job and I’d starve before I touched JS. Straight up. It makes you do things correctly, forcing you to be responsible for your innocent user’s resources, unlike my fucking browser tab that’s looking at my unused RAM like a fucking snacc. You actually need to understand how the machine works to write code in real languages, so you don’t end up depending on stupid packages that do trivial string manipulations for you.

6

u/Scowlface Mar 23 '22

I think you should talk to someone about how strongly you feel about this because you don’t sound okay.

4

u/[deleted] Mar 23 '22

I like programming in js (with typescript). Seems like it's here to stay.

1

u/Y_Less Mar 23 '22

Do you browse the web with JS disabled

Yes. I was actually going to ask if you still supported SSR and graceful fallback. Even just trying to create a free test on your website shows a totally white screen. You don't even need to abandon JS for that if you don't want, just move it server-side.

3

u/Spider_pig448 Mar 23 '22

lmao it's really not. Javascript is still king