If you use javascirpt (or typescript) for backend server development, you can basically write web apps only with it.
From this, do you agree that javascript or typescript is the best language for backend development?
- Why do you agree/disagree?
- In what cases, are they suitable for backend server?
Top comments (3)
Since Typescript is basically transcompiled to Javascript, in terms of performance, libraries, and frameworks you can use is almost identical.
So the key for the difference between TypeScript vs Javascript is understand the advantages of Static Typed Languages vs Dynamic Typed Languages.
Rule of Thumb:
If you plan to have lot of people working on a the same project, or your code base is likely get very big. It is better to use Static Typed Languages. Since often it is self documentating and more maintainable.
If you want to get some a small project started fast, Dynamic Typed languages sometimes is better. static typed languages have a lot of boiler plate code you have to write, sometimes adds to development time. And more things (more complex syntax to handle types) to learn for beginners.
Thanks! I'm sorry I think my explanation was unclear.
What I meant is not the difference between javascript and typescript, but
javascript(or typescript) vs other languages (e.g. Golang, Python...).
I love JavaScript but having worked almost exclusively on backends written in Node for the past half a year - I am missing static typed languages a lot. While some may find it takes longer to get a project going in a statically typed language vs something dynamic, I've found that the iteration cycles are nice and quick in a statically typed language where the compiler can bark at you, your IDE can be sure about the hints it gives you, etc. whereas with something like JavaScript, my code can look fine, but I forgot about this one instance where I get some undefined property which screws up some nested query I'm making. And I won't find out about it until I run the project and hit that particular use case. IDEs have gotten much better about interpreting JavaScript, but I still run into the lovely "undefined is not a function", or "cannot read property of undefined". Compiled languages allow you to be sure of these classes of errors.
There are tradeoffs of course, but I like the safety of static typing in something like Go for a backend.