4 ms·
It's interesting that TypeScript often gets lumped into "OOP" when a few functional projects like RxJS and Cycle use it. Are their codebases also OOP?
by sotojuan 10y ago
It's interesting that TypeScript often gets lumped into "OOP" when a few functional projects like RxJS and Cycle use it. Are their codebases also OOP?
- bsimpson 10y agoActually, yes, TypeScript uses OOP patterns like classes and interfaces: https://github.com/ReactiveX/rxjs/blob/master/src/Observable.ts https://github.com/ReactiveX/rxjs/blob/master/src/Observable... But they also use the pipeline operator (::) to chain together methods in a way that's effectively functional.
- sotojuan 10y agoInteresting! More interesting is that apparently the TS compiler itself uses no classes. I just think jeremiep is conflating static typing with Java-style OOP and "design patterns".
- addicted 10y agoI think typescript development is driven more by functional languages, than OOP languages. However, they do provide some syntactic sugar for OOP, which is useful if you have a JS codebase that is using OOP, because if nothing else, it provides a standardized method of creating objects and classes. Unfortunately, because most devs are comfortable only with OOP and since typescript is amongst the easiest ways to do OOP in JS, a lot of Typescript code in the wild tends to be OOP heavy.
- FrancoDiaz 10y agoThe Typescript compiler (written in Typescript) uses no classes.
- qwertyuiop924 10y agoTS has some functional leanings, but there are probably a good many users from enterpriseland who see the "class" keyword, and have their eyes glaze over with the assumption that they already know everything, as the continue to create monstrosities in the name of best practices. A little common sense goes a long way.