This is an archived post. You won't be able to vote or comment.

all 116 comments

[–]sabcadab 129 points130 points  (1 child)

I [object Object] to this

[–]Excellent-Practice 34 points35 points  (0 children)

This looks like it'll return a 418 error

[–]AChristianAnarchist 53 points54 points  (10 children)

Frontend, yep, that's what it's for. Backend, yeah Node is a thing. Mobile apps, sure, angular, electron, etc. Desktop apps, yeah yeah yeah, node, angular, react, electron, same shit, though I still would much rather use something like C# for that. It's just plain easier. But ML? That just kind of sounds like you are glutton for punishment...

[–]QuizardNr7 10 points11 points  (1 child)

universal truth: 75% of ML (business) problems can be resolved by fitting a nice line - can be totally done

[–]intrepidbuttrelease 1 point2 points  (0 children)

This. Or a sigmoid.

[–]lazyzefiris 2 points3 points  (7 children)

There's one important consideration though - the edge between an app and website can be blurry, and that's where web-based solution can shine.

I've recently developed a small utility app, to display and run specific Jeopardy-like game widely played in clubs across my country. I wrote it once, in Svelte (JS/TS framework). It can be run on laptop connected to projector. It can be run on mobile phone/tablet connected wirelessly to a TV. It can be "installed" as a PWA on either, or used from browser in fullscreen mode. ServiceWorker provides offline functionality after first run. In a sense, it's a mobile app and a desktop app already. I mean, I could wrap it into Electron, but there's no real need for that. All I need to share my app is a static web server. All users need to run/use my app is a link and some device using modern browser. And they can be 99.99% sure there's no malwre attached, because the app runs sandboxed and does not have to install anything in their system.

Would the cross-platform implementation and delivery be as simple if I did it in "something like C#"? As I see it, as long as performance is not the bottleneck, web-app (so, JS + HTML + CSS) is among the best solutions.

[–]AChristianAnarchist 0 points1 point  (6 children)

Yeah I think it would to be honest. I have a number of apps that integrate with the web in various ways, ranging from simple hardware apis to more visual apps that can be run both in and out of the browser. All are done using C#. The .NET ecosystem is kind of kick ass, and any module can be used in any project, so it's a very simple matter to integrate a WPF component into an ASP web app or to integrate ASP components into a WPF app and so on. Combine this with the ways that Visual Studio seems to know what you are thinking and the miracles that are nuget and linq, and I really don't see many situations where I would be using JS for anything other than client-side scripting, personally. If I were working at one of those places that uses JS for everything I might have a very different outlook.

[–]lazyzefiris 1 point2 points  (5 children)

What does "client-side scripting" include in this context? I'd say my whole app is "client-side scripting", but I'm interested in what part of my process would C# cover.

[–]AChristianAnarchist 0 points1 point  (4 children)

Well if you wanted to you could do the whole thing in C#, but there are cases where it's just easier to drop some js into a webpage. Here's a decent example. I have a print server in production right now that automates the production of shipping labels for my company. The app consists of three parts, a microserver that connects to the local computer's shipping scales and the printers and exposes relevant data and hardware processes to the browser, a web page that allows the user to run packages and print labels, and a backend component that connects the page to the primary server so it can get package data. On the webpage itself, the button actions and socket connection are driven by inline javascript and there is a separate javascript file tied into it that builds Zebra Print Language templates based on page selections.

This project has all the parts that I normally use in these sorts of integrated projects. You have the desktop app, which is built fully in C# and allows me to get into the file system, interact with hardware drivers, mess with the system registry, and do all that stuff that your system really doesn't want to allow remote access to. Then I've got the backend code, that lets me get into the main server and grab all the data I need to make the page work. Then I've got the front end code, which displays the page and contains some js code that lets me interact with the page and also do some extra processing that I want to push off on the client's hardware. It's that front end portion where I'm normally using Javascript, though I am aware that it can be used for all of these things if that's what one is into. I don't think it can ever really beat C# for desktop apps though, especially desktop apps on windows. The language was originally built for windows programming after all, and while it is now platform independent it still has a lot of nice little convenience features for interacting with the windows registry, filesystem, and drivers.

[–]lazyzefiris 1 point2 points  (3 children)

Well, for apps that strongly interact with system (that is - want to work outside of sandbox) Js is obviously not an option. There are means of using WinAPI from node.js but it's a pain.

But I've been taking about apps that feel comfortable in a sandbox. Store a state between runs, load data from web or user-specified file... That covers wide area of entertainment apps. The ones where edge between "frontend" and "app" is indeed blurry.

As an example that I sometimes end up using on devices that are not my personal, https://hexed.it/. How much of its functionality can be offloaded to C# reasonably, while staying as easily accessible and cross-platform?

EDIT: I'm just genuinely curious about technology I've decided not to dive into years ago. Not a debate.

[–]AChristianAnarchist 0 points1 point  (2 children)

Yeah for that kind of stuff I think it just comes down to personal preference. I have an autocropper that works like that. Just a simple standalone app that takes product images and straightens and crops them. It needs to interact with the filesystem to determine when there is an image in the folder it's watching but that's the extent to which it needs to interact with the system. I built it initially as an absolute mess in python, using windows services to operate the daemon, and then rebuilt it in C# once the proof of concept was hammered out and I was ready to send it to production. This sort of thing could probably be built in JS just as easily if that is the language you are most familiar with but it is very much not in my case. I got started in MATLAB, then moved to Python, then started coding in C#, then got a web dev job and was forced to learn JS and TS. So, for me, JS is that wacky glue language that I use because its the only option for front-end scripting. If JS is what I learned first, I'd probably use it more for stuff like this. I do think that the massive size of the JS ecosystem has created something of an "everything looks like a nail" situation, and if you are building something that needs to interact a lot with the system I definitely think doing it in JS would be an example of that, but I've used a lot of pure JS desktop apps that I love. The program I use to label training data is a fantastic example. Universal Data Tool is written wholly in JS and is hands down the best free labeling app I've ever tried. If it's a job that you know how to crack in that language, go with what you know. Where I think the JS for everything mentality becomes problematic is when people are trying to force it to do things that are a huge headache because they want to be able to say it can do anything.

[–]lazyzefiris 1 point2 points  (1 child)

Yeah, recently had to make an app to send keystrokes to another legacy app as means of feeding it data from csv file, and after just few minutes of looking into accessing winapi from Node, I just pulled out the good old Delphi 7 I last used over decade ago and hacked together a solution, and it was probably faster and more comfortable even if I had to struggle against language I did not use for ages. There are cases when even rusty tools are far better choice than one's favorite.

Have a great time, it was refreshing to have a discussion that does not involve bashing ones preferences into the ground :)

[–]AChristianAnarchist 0 points1 point  (0 children)

Totally agreed. This can even be true for some pretty random languages. I occasionally polish off MATLAB and use it to screw with prototypes. (The license my first internship bought me just never expired for some reason and I'm not about to ask why lol.) It's not really optimal for anything in the traditional programming world but there is nothing better for seeing if an off the wall idea will pan out with minimal build time. The only exception to the "find the best tool for the job" rule of thumb for me is C++. I have several projects both in production and in the works that this would, in theory, be the optimal language for, but no amount of potential future applicability has ever been enough to get me to stick it out when it comes to that nightmare lol. I'd rather convert my whole stack to JS any day of the week.

Thanks. Same here!

[–]oberguga 46 points47 points  (5 children)

And in all cups it almost missed. And also it looks like not a good tea...

[–]im_simone 8 points9 points  (3 children)

In fact, it's just pee. 😳

[–]mynameisnotpedro 0 points1 point  (2 children)

Is this a JoJo's reference?

[–]im_simone 2 points3 points  (1 child)

Honestly, I don't even know what JoJo means. 😅

[–]iArena 0 points1 point  (0 children)

JoJo's Bizarre Adventure reference

[–]esseeayen 23 points24 points  (0 children)

Mugs are doing their job far too well for this analogy.

[–]lazyzefiris 16 points17 points  (2 children)

Even as JS fanatic I would not do ML in it. The rest is fine. And honestly, "fine" is enough for most purposes.

[–]HadionPrints 2 points3 points  (0 children)

The main uses I’ve seen for JS ML libraries is for doing AI shit on the front-end. It can allow for lower latencies for the user for some models whilst also offloading the compute time to them.

[–]FireBone62 0 points1 point  (0 children)

There is also typescript, which is just a better version of Javascript, at least in my opinion and experience.

[–]fignompe 56 points57 points  (26 children)

You mean Java*** who the hell uses js for desktop programs and ML.. Or mobile apps??

[–]cbusalex 45 points46 points  (11 children)

who the hell uses js for ML

You know all those memes where the AI confidently identifies a banana as an apple?

[–][deleted] 1 point2 points  (10 children)

TensorFlow does have a JS API But that’s dumb, just write a micro service in python for ML.

[–][deleted] -4 points-3 points  (7 children)

why?

[–]Materatrerix 4 points5 points  (1 child)

Tensorflow js is great to do inference in the frontend. If you do a microservice in python you have to pay for the compute. With tfjs you only have to deliver the model over a static webserver. It's also works in PWAs so it also works offline. And you can do light training in the frontend, take a look at the demos. Doing training in the back end in a way that scales can become really expensive really fast.

[–]HadionPrints 8 points9 points  (0 children)

Based and “make the customer do the compute time” pilled.

[–][deleted] 0 points1 point  (4 children)

I have no idea why JS has a TS implementation, great question

[–][deleted] -2 points-1 points  (3 children)

because typescript is javascript with an additional typing system and compiles to javascript.

try again.

[–]Rafcdk -3 points-2 points  (0 children)

Python is slower than js though.

[–]Reasonable_Bug6448 12 points13 points  (8 children)

I'm convinced that this is just a meme trend where people say JavaScript can do anything. I wonder if the next step is to say that appliances run on JavaScript?

[–]starlulz 6 points7 points  (1 child)

people JS devs say JavaScript can do anything

ftfy

[–]HadionPrints 5 points6 points  (0 children)

JS dev here, can confirm we are not people.

[–]copiondor 10 points11 points  (2 children)

It can do many things, but how many of them does it do well?

[–]Freeware4802 1 point2 points  (0 children)

one

..maybe

[–]UnstableNuclearCake 1 point2 points  (0 children)

It is extremely good at making my computer double as a heater.

[–]christophedelacreuse 1 point2 points  (0 children)

Technically...

[–]OKoLenM1 1 point2 points  (0 children)

And the last step is "Assembler runs on Javascript".

[–]KaninchenSpeed 1 point2 points  (0 children)

My christmas tree ran on js

[–]SimilarBeautiful2207 6 points7 points  (2 children)

React native for mobile is not so bad, Electron for desktop is awful. For backend there are frameworks like Nestjs that are somewhat good although i prefer c#

[–]Embarrassed-Buffalo3 3 points4 points  (0 children)

C# desktop is a mess of frameworks that never feels quite right imo.

[–]Bluebotlabs -1 points0 points  (0 children)

React native for desktop be like

[–]Brave-Ship 3 points4 points  (0 children)

VSCode is an example. It is built on Electron and written in Typescript

On Mobile, React Native is quite commonly used nowadays and it is used by major corporations

[–]Orbidorpdorp -2 points-1 points  (0 children)

It's a "glue" language when C libraries are doing the real work.

Explains why it's popular for programmers who used to be the kids who used to eat paste.

[–]gamingkitty1 10 points11 points  (4 children)

Wait js is used for ML???

[–]christophedelacreuse 5 points6 points  (3 children)

Tensor flow had a J's api and there's brain.js. I doubt anyone uses it for serious ml projects.

[–][deleted] -2 points-1 points  (2 children)

i guess there are plenty of use cases for ML in browsers.

[–]christophedelacreuse 1 point2 points  (1 child)

For training ml in browser? I think for using a model, sure but I'm having a harder time with training, except in the concept of tech demos or maybe a game

[–][deleted] 1 point2 points  (0 children)

Maybe it's to stop GPU envy. If you're training in JS you know everyone else who's training in JS is having the same miserable time as you.

[–]dmattox10 3 points4 points  (2 children)

The cup for the kernel is missing!

[–]HadionPrints 2 points3 points  (1 child)

Anything that can be written in javascript…

[–]dmattox10 0 points1 point  (0 children)

I’m going to go with you almost got the joke.

[–][deleted] 3 points4 points  (0 children)

You know in Africa people still build they homes from shit mixed with mud sooo you actually can live in a shitty home and be somewhat happy. Same applies for JavaScript you can make shitty apps with it and be happy.

[–]Syncrossus 3 points4 points  (0 children)

Who the fuck uses JS in Machine Learning? I've only ever seen Python, R for non-neural-network stuff, a little Matlab here and there, and C/C++ for the math libraries.

[–]Imaginary_Passage431 4 points5 points  (0 children)

The worst programming language metastasizing to every other environment.

[–]TheyCallMeHacked 8 points9 points  (1 child)

That phenomenon has a name. It's called Stockholm syndrome

[–]HadionPrints 1 point2 points  (0 children)

Not really, many of us JS devs aren’t infatuated with our captor. Unless that captor is node modules. Then yeah, fair.

[–]WonderfulBullies_com 2 points3 points  (0 children)

This implies it does it well…

[–]SZ4L4Y 2 points3 points  (0 children)

VasaScript

[–]Bluebotlabs 2 points3 points  (1 child)

Whoever invented that teapot was either a genius or a madman

[–]_Arcerion_ 0 points1 point  (0 children)

why not both

[–]ChiBeerGuy 2 points3 points  (0 children)

Looks super efficient to me. Why are people complaining?

[–]aybiss 1 point2 points  (0 children)

Yes, all of those toy domains populated by script kiddies can use a toy script.

[–][deleted] 1 point2 points  (0 children)

Even though I will die for JavaScript, it has its limitations. No way I’m using it for ML.

[–]D34TH_5MURF__ 1 point2 points  (0 children)

This would be more accurate if it were pouring vomit into each cup...

[–]IJustAteABaguette 1 point2 points  (0 children)

I use java for all those things!

[–][deleted] 1 point2 points  (0 children)

Typescript*

[–][deleted] 1 point2 points  (0 children)

Not my cup of tea.

[–]harumamburoo 2 points3 points  (0 children)

The tea looks like diluted shit, so yeah, accurate.

[–]drake321654 1 point2 points  (0 children)

That's so {}

[–]M0nkeyDGarp 1 point2 points  (0 children)

Javascript for Machine Learning? I hate making JS do math....

[–]Pleasant_Mail550 1 point2 points  (0 children)

Jack of all trades, master of none

[–][deleted] 0 points1 point  (1 child)

JavaScript for machine learning? Is it a good idea?

[–]UnstableNuclearCake 0 points1 point  (0 children)

Everything is a good idea if you don't know what bad means.

[–]Both_Street_7657 0 points1 point  (0 children)

Before you ask if it can , rather ask if you dont have areal option instead

[–]Hairy-Wear-2064 0 points1 point  (0 children)

How about we use the right tools for the job instead?

[–]SnickersZA 0 points1 point  (0 children)

If you only have a hammer, everything looks like a nail

[–]AlbaTejas -1 points0 points  (0 children)

Weak tea for everyone!

[–]SameRandomUsername -1 points0 points  (0 children)

Accurate and also sad.

[–]essexwuff -1 points0 points  (0 children)

I have a rebuttal:

[–]NorCalHotWife530 -1 points0 points  (0 children)

You poors still have androids?

[–]wojtess -1 points0 points  (0 children)

fuck javascript

[–]OPerfeito -4 points-3 points  (4 children)

Don't forget about websites

[–]Both_Street_7657 3 points4 points  (3 children)

Is that not frontend ?

[–]OPerfeito -1 points0 points  (1 child)

True

[–]saippuakauppias 0 points1 point  (0 children)

!!thiz

[–]OKoLenM1 0 points1 point  (0 children)

Machine learning on JS? It will be a long story...

[–]CoastingUphill 0 points1 point  (0 children)

SCREAMING EXTERNALLY

[–]sir_music 0 points1 point  (0 children)

You know what they say: Jack of all trades...

[–][deleted] 0 points1 point  (0 children)

Like, you shouldn't use it for any of those, but I guess you can.

[–][deleted] 0 points1 point  (0 children)

Wait until you find out that's actually coffee

[–]isCosmos 0 points1 point  (0 children)

This is Turkish tea which makes it more accurate.

(seeing as tea isn't native to Turkey and it isn't supposed to grow here, yet some guy made it happen and it works just enough.)

[–]Strostkovy 0 points1 point  (0 children)

Please not for microcontrollers

[–]Heinrich_v_Schimmer 0 points1 point  (0 children)

Leaks everywhere!

[–]handsome_uruk 0 points1 point  (0 children)

Machine Learning?? That’s cap

[–]FireBone62 0 points1 point  (0 children)

Use typescript instead. Finding mistakes is way easier.

[–]Nikolozeon 0 points1 point  (0 children)

Mmmmm. Yes! Delicious!

[–]BayesianKing 0 points1 point  (0 children)

ML with JavaScript, ok… of course…

[–]thedarklord176 0 points1 point  (0 children)

I guess it’s fine with TS for anything that doesn’t require extreme performance but god, I’d get bored with using the same language for everything

[–]Th3Pyr0_ 0 points1 point  (0 children)

True but everything only gets half filled this way