Typescript and SOLID

John Peters - Oct 23 '19 - - Dev Community

JavaScript people often reject the concepts of OOP the way OOP people rejected JavaScript in the early days. Think about that a little longer, if you will.

Alas JavaScript and it's big brother Typescript are here to stay. Much to the chagrin of many OOP-ers. Yes JavaScript is king like it or not. What did the OOP-ers learn in their 20+ year run leading up to JavaScript's dominance?

The major takeaways were 1)Favor composition over inheritance and 2) The SOLID principal. The S in Solid is the Single Responsibility Principle (SRP), which says each class or function or method should only be responsible for one thing. Think hard on that one, commit it to memory and live by it. Following the SRP rule means frequent refactoring. Anytime a new concern is introduced, it is split into a new function, method, class, object etc. This then, results in code full of functions, methods, classes, objects that only do one thing. This is exactly what JavaScript people are teaching when mentioning Pure-functions.

All good OOP winds up at functional-styles anyway. So what's the problem with OOP again?

Any questions?

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player