Python is my bread-and-butter, and I love it. Even though I’ve got some points of criticism against the language, I strongly recommend it for anybody starting out in data science. More experienced people in the field tend to be Python-evangelists anyway.
However, this doesn’t mean that you can’t challenge the limits in your field from time to time, for example by exploring a different programming paradigm or a new language.
This might sound trivial to do manually. But when you’re working on projects with thousands of lines of code, you’ll thank the Lord for having it.
There are a few other differences, like the fact that TypeScript has anonymous functions and asynchronous functions. Anonymous functions are a key feature of functional programming, which can make a program more efficient with big data loads.
That doesn’t mean that TypeScript isn’t a staple in the general programming world. Among data scientists, however, it’s never been particularly popular.
You could conclude that TypeScript may not be a good match for data science. But don’t rush. Although it might not be suitable for every part of data science, there are areas where it has distinct advantages over Python.
If you happen to work in one of these areas, it’s worth giving TypeScript a shot. And if you don’t, who knows where you’ll land next? The field is moving fast. You have a competitive advantage if you can look beyond your nose.
[Want to work at TNW? We’re looking for front-end developers to join our team]
How TypeScript became popular
Despite its young age, there are fields where TypeScript is inevitable. This adds to its popularity. For example, when Google announced that Angular.js would run with TypeScript in 2016, the number of tags on StackOverflow exploded.
Where TypeScript might have an edge over Python
Features like generics and static typing make it easier to do functional programming in TypeScript than in Python. This could be an advantage because demand for functional code is growing due to developments in data science, parallel programming, asynchronous programming, and more.
On the other hand, Python has been adding more and more features of functional programming, too. And when it comes to data science, machine learning, and more, Python is at the forefront of frontiers.
That leaves parallel programming and asynchronous programming on the table. Even though you can pull both of these things off in both languages, there is a big difference: in Python, you need to use particular libraries for the task. In TypeScript, all libraries are asynchronous from the core. And since the latter is a bit more functional by default, it’s often a tiny bit easier to do parallel programming.
In other words, if you’re a Python developer that is involved in asynchronous processes and parallel computing, you might want to give TypeScript a try.
What makes TypeScript great for data science — or not
Many data scientists deal with asynchronous and parallel programming. You might already be considering writing your next project in TypeScript rather than Python. Whether that’s a good idea depends on many other factors, though.
First of all, TypeScript doesn’t have a straightforward way of doing list comprehensions. This can be frustrating when dealing with large arrays, for example.
Second, there are no native matrix operations in TypeScript. Python has NumPy, as well as a host of other tools, that make them easy. So if your project is heavy in linear algebra, you might want to stay away from TypeScript.
Finally, you’ll want to take into account that programming isn’t a solitary occupation. There is an enormous community for Python in data science that offers support and advice. But at this point in time, TypeScript isn’t that popular among data scientists. So you might not be able to find that many helpful answers to your questions on StackOverflow and elsewhere.
That being said, if you’re starting a small project without too many big arrays and matrix operations, you might want to give TypeScript a go anyway. Especially if it involves some parallel or asynchronous programming.
The bottom line: know where to use your tools
There is no one language for every task. Sure, some languages are more fun or more intuitive than others. Of course, it’s important that you love your tools because that will keep you going when times are tough. Starting with a well-loved language like TypeScript or Python is therefore not a bad idea.
But at the end of the day, you shouldn’t stick to one language like to a religion. Programming languages are tools. Which tool is best for you depends on what you’re trying to do with it.
At the moment, Python is huge for data science. But in a rapidly evolving field, you need to be able to look past your nose. As your tasks are changing, so might your tools.
TypeScript, on the other hand, has a buzzing community around front-end web, back-end Node, and mobile development. What’s interesting is that these areas intersect with data science more often than one thinks. Node, in particular, is gaining more and more traction among data scientists.
Of course, this doesn’t mean that you should dabble with a dozen languages at a time. There is enormous value in knowing one language really well. But being curious about other languages and technologies will help you stay ahead of the curve in the long term.
So don’t hesitate to try something new when you feel like it. Why not with TypeScript?
Get the TNW newsletter
Get the most important tech news in your inbox each week.