Monday, 3 February 2020

Most idiomatic way to organize modern JS application

Hi Redditors,I wouldn't say I am a newbie to Node.js (implemented a few projects), therefore I have one question that bothering me a lot and I really appreciate community help. My background as a software engineer related mostly to OOP languages such as Java/C# and despite I am writing JavaScript I am pulling approaches and ideas from my past experience. But let's cut the crap and get closer to the topic.Modern JS gives the developer a wide range of approaches on how to organize codebase from a more "procedure" oriented approach to a more OOP approach. But since ES6 came upon the scene we have full OOP support with language syntax - classes, inheritance, etc. In such languages as Java defining functions in global scope considered bad style - all data (variables, properties) and functions (methods) encapsulated within the class definition. At the same time, in most Node.js or Reactjs projects I see a mixed approach when classes are used but not everywhere and exporting function directly or defining a function within global scope instead of class scope is the pretty usual thing. For me, "all-in-class" approach seems to be more clear ad elegant, though more verbose. So I wonder - what is the most idiomatic way to organize JavaScript application? Maybe some live project references?

Submitted February 03, 2020 at 12:03PM by vokinneberg

No comments:

Post a Comment