JavaScript is such a cool language, and I really love it, especially the FP subcommunity, but the AI community for Python is way bigger, I wish there were more options for neural nets, differentiable programming, and data frame type things in JS. The interoperability with WASM is hugely valuable, and so is the ability to easily publish results on the web. It feels like it’s way easier to make an AI system in python, but then you have to figure out how to monetize it, while if you use JS, you can build a web platform or service and monetize much easier. Thoughts?
I think these are two different languages for two different jobs.
I can see javascript slowly expanding from the front-end into the back-end, mostly thanks to projects like TypeScript that appeal to the back-end crowds, but also because of the whole serverless hype which IMO is justified. Now there still is a strong "cultural divide" between the software and the data-science communities. And when you see how strong the innertia for python's projects is.. Well I guess we won't see this changing anytime soon.
I think you're talking about two different systems and two different problems. First, there's the core service code, the AI system in Python you're talking about. Then, there's the web platform or service that you monetize. But there's no reason why you wouldn't just use both.
Write the core AI code in Python because that's what's practical to do. Write the app code in JS because that's what's practical to do. Sell the product to customers that want to use it and probably don't care what's underneath.
In my opinion it would be great to have a single language for developer productivity. Backend and frontend can be already written fully in TypeScript and you can share interfaces between frontend and backend so everything is connected and business logic is not repeated. Same thing could be done for machine learning.
If backend changes frontend has to change as well or compiler will yell. Same for machine learning input and output.
This shows how complex TypeSript has become. It may be fun to write complicated Type annotations such as this, but imagine having to read and maintain the code!
From years of real-world experience, it's rare to run into types that are too complex to easily understand. The syntax is pretty easy to read, and the compiler and language service make it easy to navigate types, even if you haven't looked at the source for them yet.
FWIW I find that TypeScript types can sometimes be overwhelming or hard to decipher, especially some third-party library type definitions. The connect function from react-redux is one example:
This is the complexity introduced when applying static types to a vanilla JS codebase, imo. It's easy to get crazy with types in vanilla JS. Adding Typescript forces you to resolve the different types explicitly and it can get hairy.
What this really demonstrates to me is the difference between starting with TS vs migrating to it. Code that has to think about the types the first time it is being built is going to be better structured, on average, than purely dynamic code.
Many complex/difficult to understand TS types exist precisely because the type system was too limited to express certain real world use cases without workarounds. As the type system takes on that complexity, and removes more limitations, it actually makes writing simpler types for those cases much easier.
I find these types still exist in JS it's just impossible to decipher what you're writing and supposed to be doing without a solid TypeSystem. The types might look complicated but really this is much more simplified that getting runtime errors.
Comments (191) 32 threads
Earlier commentsI am salivating at the potential use cases for this...
My mind is exploding at the possibilities.
https://devblogs.microsoft.com/typescript/announcing-typescr...
I can see javascript slowly expanding from the front-end into the back-end, mostly thanks to projects like TypeScript that appeal to the back-end crowds, but also because of the whole serverless hype which IMO is justified.
Now there still is a strong "cultural divide" between the software and the data-science communities. And when you see how strong the innertia for python's projects is.. Well I guess we won't see this changing anytime soon.
Write the core AI code in Python because that's what's practical to do. Write the app code in JS because that's what's practical to do. Sell the product to customers that want to use it and probably don't care what's underneath.
If backend changes frontend has to change as well or compiler will yell. Same for machine learning input and output.
https://github.com/DefinitelyTyped/DefinitelyTyped/blob/d07d...
Since types can get really complex, I feel a need to be conscious of avoiding complexity when writing types myself, unless the value is enough to justify a hard-to-read type.
What this really demonstrates to me is the difference between starting with TS vs migrating to it. Code that has to think about the types the first time it is being built is going to be better structured, on average, than purely dynamic code.
https://youtu.be/jmPZztKIFf4 at 49:50.
Ok, we might have went a bit too far
All comments shown.
Couldn't load more comments. Check your connection and try again.