As I delved into the Typescript documentation, something caught my attention.
Redefining Traditional Class Models
C# and Java are often seen as quintessential object-oriented programming (OOP) languages. In these languages, classes act as the fundamental component of code structuring, housing both data and functionalities during runtime. While organizing all features and information within classes may suit some problem domains, not every domain necessitates this rigid structure.
The Concept of Free Functions and Data
In contrast to C# and Java, JavaScript allows functions to exist independently anywhere in the code, enabling data to flow freely without being confined to a predefined class or structure. This flexibility grants developers immense power. Writing programs in JavaScript typically involves utilizing "free" functions—those dissociated from any specific class—to manipulate data without OOP constraints.
Having significant experience in C programming, I couldn't help but reminisce about the days when functions existed at a global level and searching for code was an adventurous task due to their universal accessibility. With modern editors, that challenge has largely been alleviated.
OOP brought a sense of order and organization to coding practices, yet TypeScript seems to be harkening back to the more flexible approach reminiscent of the 'good old days.'
Am I interpreting this shift correctly?